Skip to content

Commit 7c52a10

Browse files
committed
Merge branches 'feat/ts-5' and 'master' of github.com:Web3Auth/web3auth-react-native-sdk into feat/ts-5
2 parents 865cef2 + 5bfc340 commit 7c52a10

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

demo/rn-bare-example/App.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Button,
77
ScrollView,
88
Dimensions,
9+
TextInput,
910
} from 'react-native';
1011
import * as WebBrowser from '@toruslabs/react-native-web-browser';
1112
import EncryptedStorage from 'react-native-encrypted-storage';
@@ -16,7 +17,7 @@ import Web3Auth, {
1617
} from '@web3auth/react-native-sdk';
1718
import RPC from './ethersRPC'; // for using ethers.js
1819

19-
const scheme = 'web3authrnbareaggregateexample'; // Or your desired app redirection scheme
20+
const scheme = 'web3authrnbareexample'; // Or your desired app redirection scheme
2021
const resolvedRedirectUrl = `${scheme}://openlogin`;
2122
const clientId =
2223
'BHr_dKcxC0ecKn_2dZQmQeNdjPgWykMkcodEHkVvPMo71qzOV6SgtoN8KCvFdLN7bf34JOm89vWQMLFmSfIo84A';
@@ -26,6 +27,7 @@ export default function App() {
2627
const [key, setKey] = useState<string | undefined>('');
2728
const [console, setConsole] = useState<string>('');
2829
const [web3auth, setWeb3Auth] = useState<IWeb3Auth | null>(null);
30+
const [email, setEmail] = React.useState('[email protected]');
2931

3032
const login = async () => {
3133
try {
@@ -41,7 +43,7 @@ export default function App() {
4143
mfaLevel: 'default',
4244
curve: 'secp256k1',
4345
extraLoginOptions: {
44-
login_hint: '[email protected]',
46+
login_hint: email,
4547
connection: 'email',
4648
},
4749
});
@@ -52,7 +54,7 @@ export default function App() {
5254
uiConsole('Logged In');
5355
}
5456
} catch (e: unknown) {
55-
window.console.log(e, e.stack);
57+
window.console.log(e, (e as Error).stack);
5658
setConsole((e as Error).message);
5759
}
5860
};
@@ -138,7 +140,7 @@ export default function App() {
138140
uiConsole(message);
139141
};
140142

141-
const uiConsole = (...args) => {
143+
const uiConsole = (...args: unknown[]) => {
142144
setConsole(JSON.stringify(args || {}, null, 2) + '\n\n\n\n' + console);
143145
};
144146

@@ -157,6 +159,13 @@ export default function App() {
157159

158160
const unloggedInView = (
159161
<View style={styles.buttonArea}>
162+
<TextInput
163+
editable
164+
onChangeText={text => setEmail(text)}
165+
value={email}
166+
// eslint-disable-next-line react-native/no-inline-styles
167+
style={{padding: 10}}
168+
/>
160169
<Button title="Login with Web3Auth" onPress={login} />
161170
</View>
162171
);

demo/rn-bare-example/android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
<action android:name="android.intent.action.MAIN" />
2121
<category android:name="android.intent.category.LAUNCHER" />
2222
</intent-filter>
23+
<intent-filter>
24+
<action android:name="android.intent.action.VIEW" />
25+
<category android:name="android.intent.category.DEFAULT" />
26+
<category android:name="android.intent.category.BROWSABLE" />
27+
<data android:scheme="web3authrnbareexample" />
28+
</intent-filter>
2329
</activity>
2430
</application>
2531
</manifest>

demo/rn-bare-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@
4444
"jest": {
4545
"preset": "react-native"
4646
}
47-
}
47+
}

0 commit comments

Comments
 (0)