diff --git a/react-native-sign-in-with-neynar/package.json b/react-native-sign-in-with-neynar/package.json index ff0353a..a96ccb5 100644 --- a/react-native-sign-in-with-neynar/package.json +++ b/react-native-sign-in-with-neynar/package.json @@ -1,6 +1,6 @@ { "name": "@neynar/react-native-signin", - "version": "1.0.0", + "version": "1.0.1", "keywords": [ "react-native", "neynar", diff --git a/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx b/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx index aba7fc2..d978c2e 100644 --- a/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx +++ b/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx @@ -40,7 +40,7 @@ enum ButtonText { } interface IProps { - authUrl: string; + fetchAuthUrl: () => Promise; successCallback: (data: ISuccessMessage) => void; errorCallback?: (error: any) => void; theme?: Theme; @@ -75,7 +75,7 @@ interface IProps { } export const NeynarSigninButton = ({ - authUrl, + fetchAuthUrl, successCallback, errorCallback = () => {}, theme = Theme.LIGHT, @@ -97,6 +97,7 @@ export const NeynarSigninButton = ({ textStyles: customTextStyle, }: IProps) => { const [modalVisible, setModalVisible] = useState(false); + const [authUrl, setAuthUrl] = useState(null); const handleMessage = (event: WebViewMessageEvent) => { const data = JSON.parse(event.nativeEvent.data); @@ -105,6 +106,8 @@ export const NeynarSigninButton = ({ }; const handleOnPress = async () => { + const authUrl = await fetchAuthUrl(); + setAuthUrl(authUrl); setModalVisible(true); };