Skip to content

Commit 423cdcc

Browse files
Merge pull request #27 from Web3Auth/feat/new-params
Updates to new params
2 parents 5e70804 + c082e91 commit 423cdcc

File tree

17 files changed

+74774
-19630
lines changed

17 files changed

+74774
-19630
lines changed

example/.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"root": true,
32
"extends": ["@toruslabs/eslint-config-react"],
43
"parser": "@typescript-eslint/parser",
54
"parserOptions": {

example/App.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { StatusBar } from "expo-status-bar";
22
import { useState } from "react";
33
import { StyleSheet, Text, View, Button } from "react-native";
4-
import Web3Auth, { LOGIN_PROVIDER, OPENLOGIN_NETWORK } from "@web3auth/react-native-sdk";
4+
import Web3Auth, { LOGIN_PROVIDER, OPENLOGIN_NETWORK, State } from "@web3auth/react-native-sdk";
55
import Constants, { AppOwnership } from "expo-constants";
66
import * as Linking from "expo-linking";
77
import * as WebBrowser from "expo-web-browser";
@@ -19,6 +19,7 @@ const resolvedRedirectUrl =
1919
export default function App() {
2020
const [key, setKey] = useState("");
2121
const [errorMsg, setErrorMsg] = useState("");
22+
const [userInfo, setUserInfo] = useState<State>(null);
2223
const login = async () => {
2324
try {
2425
const web3auth = new Web3Auth(WebBrowser, {
@@ -30,18 +31,18 @@ export default function App() {
3031
redirectUrl: resolvedRedirectUrl,
3132
});
3233
setKey(state.privKey || "no key");
34+
setUserInfo(state);
3335
} catch (e) {
3436
console.error(e);
3537
setErrorMsg(String(e));
3638
}
3739
};
3840
return (
3941
<View style={styles.container}>
40-
<Text>Key: {key}</Text>
41-
<Text>Error: {errorMsg}</Text>
42+
{key !== "" ? <Text>Key: {key}</Text> : null}
43+
{userInfo !== null ? <Text>UserInfo: {JSON.stringify(userInfo)}</Text> : null}
44+
{errorMsg !== "" ? <Text>Error: {errorMsg}</Text> : null}
4245
<Text>Linking URL: {resolvedRedirectUrl}</Text>
43-
<Text>appOwnership: {Constants.appOwnership}</Text>
44-
<Text>executionEnvironment: {Constants.executionEnvironment}</Text>
4546
<Button title="Login with Web3Auth" onPress={login} />
4647
<StatusBar style="auto" />
4748
</View>

0 commit comments

Comments
 (0)