Skip to content

Commit 85a5a38

Browse files
authored
Update README.md
Update useful readme description
1 parent 89727ed commit 85a5a38

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,71 @@ React-Native custom library which provides short discovery about how to integrat
66
## Installation
77

88
```sh
9-
npm install react-native-modifier
9+
yarn install
10+
11+
**For run example workspace directly:**
12+
yarn example android
13+
yarn example ios
14+
15+
**For Android example run:**
16+
yarn android
17+
18+
**For iOS example run:**
19+
cd ios
20+
pod install
21+
cd ..
22+
yarn ios
1023
```
1124

1225
## Usage
1326

1427

1528
```js
1629
import { multiply } from 'react-native-modifier';
17-
30+
**OR**
31+
import { methodModifier, signInWithApple, configureAndroidAppleAuth, AppleSigninButton } from 'react-native-modifier';
1832
// ...
1933

2034
const result = multiply(3, 7);
35+
36+
// Configure and run Apple signin and get the signin response
37+
const onAppleSigning = useCallback(async () => {
38+
try {
39+
if (Platform.OS == 'android') {
40+
await configureAndroidAppleAuth({
41+
// The Service ID you registered with Apple
42+
clientId: '{your Apple service Id}',
43+
// Return URL added to your Apple dev console. We intercept this redirect, but it must still match
44+
// the URL you provided to Apple. It can be an empty route on your backend as it's never called.
45+
redirectUri: '{your app service call back url}',
46+
});
47+
}
48+
49+
let result = await signInWithApple();
50+
console.log('result....', result);
51+
} catch (error) {
52+
console.log('error....', error);
53+
}
54+
}, []);
55+
56+
**Apple signin failure or success response from native iOS side using event listener**
57+
useEffect(() => {
58+
calculate();
59+
eventEmitter.addListener('onSigninComplete', (event) => {
60+
console.log('Event Success received from Swift:', event);
61+
});
62+
eventEmitter.addListener('onSigninFail', (event) => {
63+
console.log('Event Error received from Swift:', event);
64+
});
65+
66+
return () => {
67+
eventEmitter.removeAllListeners('onSigninComplete');
68+
eventEmitter.removeAllListeners('onSigninFail');
69+
};
70+
}, []);
71+
72+
// Render AppleSigninButton UI directly from native iOS swift code
73+
{Platform.OS == 'ios' && (<AppleSigninButton style={styles.appleButtonStyle} />)}
2174
```
2275

2376

0 commit comments

Comments
 (0)