diff --git a/lib/shared/community-utils.js b/lib/shared/community-utils.js --- a/lib/shared/community-utils.js +++ b/lib/shared/community-utils.js @@ -22,6 +22,7 @@ function useCreateFarcasterChannelTag( commCommunityID: string, setError: SetState, + onSuccessCallback?: () => mixed, ): { +createTag: (farcasterChannelID: string) => mixed, +isLoading: boolean, @@ -34,16 +35,25 @@ const createCreateOrUpdateActionPromise = React.useCallback( async (farcasterChannelID: string) => { try { - return await createOrUpdateFarcasterChannelTag({ + const res = await createOrUpdateFarcasterChannelTag({ commCommunityID, farcasterChannelID, }); + + onSuccessCallback?.(); + + return res; } catch (e) { setError(e.message); throw e; } }, - [commCommunityID, createOrUpdateFarcasterChannelTag, setError], + [ + commCommunityID, + createOrUpdateFarcasterChannelTag, + onSuccessCallback, + setError, + ], ); const createTag = React.useCallback( diff --git a/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js b/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js --- a/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js +++ b/native/community-settings/tag-farcaster-channel/tag-farcaster-channel-by-name.react.js @@ -42,6 +42,7 @@ const { createTag, isLoading } = useCreateFarcasterChannelTag( communityID, setError, + goBack, ); const onPressTagChannel = React.useCallback(async () => { @@ -56,13 +57,11 @@ } createTag(channelInfo.id); - - goBack(); - }, [channelSelectionText, createTag, goBack, neynarClientContext.client]); + }, [channelSelectionText, createTag, neynarClientContext.client]); const errorMessage = React.useMemo(() => { if (!error) { - return null; + return ; } return ( @@ -70,7 +69,7 @@ {tagFarcasterChannelErrorMessages[error] ?? 'Unknown error.'} ); - }, [error, styles.error]); + }, [error, styles.error, styles.errorPlaceholder]); let submitButtonVariant = 'disabled'; if (isLoading) { @@ -145,6 +144,9 @@ textAlign: 'center', color: 'redText', }, + errorPlaceholder: { + height: 18, + }, }; export default TagFarcasterChannelByName;