Skip to content

Commit

Permalink
Replace authURL by a callback fetchAuthUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyaschorge committed Apr 11, 2024
1 parent 30abac6 commit 9e19754
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion react-native-sign-in-with-neynar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neynar/react-native-signin",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [
"react-native",
"neynar",
Expand Down
7 changes: 5 additions & 2 deletions react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum ButtonText {
}

interface IProps {
authUrl: string;
fetchAuthUrl: () => Promise<string>;
successCallback: (data: ISuccessMessage) => void;
errorCallback?: (error: any) => void;
theme?: Theme;
Expand Down Expand Up @@ -75,7 +75,7 @@ interface IProps {
}

export const NeynarSigninButton = ({
authUrl,
fetchAuthUrl,
successCallback,
errorCallback = () => {},
theme = Theme.LIGHT,
Expand All @@ -97,6 +97,7 @@ export const NeynarSigninButton = ({
textStyles: customTextStyle,
}: IProps) => {
const [modalVisible, setModalVisible] = useState(false);
const [authUrl, setAuthUrl] = useState<null | string>(null);

const handleMessage = (event: WebViewMessageEvent) => {
const data = JSON.parse(event.nativeEvent.data);
Expand All @@ -105,6 +106,8 @@ export const NeynarSigninButton = ({
};

const handleOnPress = async () => {
const authUrl = await fetchAuthUrl();
setAuthUrl(authUrl);
setModalVisible(true);
};

Expand Down

0 comments on commit 9e19754

Please sign in to comment.