diff --git a/native/community-settings/tag-farcaster-channel/tag-farcaster-channel.react.js b/native/community-settings/tag-farcaster-channel/tag-farcaster-channel.react.js --- a/native/community-settings/tag-farcaster-channel/tag-farcaster-channel.react.js +++ b/native/community-settings/tag-farcaster-channel/tag-farcaster-channel.react.js @@ -7,9 +7,10 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { NeynarClientContext } from 'lib/components/neynar-client-provider.react.js'; +import type { FarcasterChannel } from 'lib/types/farcaster-types.js'; import { useCurrentUserFID } from 'lib/utils/farcaster-utils.js'; -import type { TagFarcasterChannelNavigationProp } from './tag-farcaster-channel-navigator.react'; +import type { TagFarcasterChannelNavigationProp } from './tag-farcaster-channel-navigator.react.js'; import SWMansionIcon from '../../components/swmansion-icon.react.js'; import { type NavigationRoute } from '../../navigation/route-names.js'; import { useSelector } from '../../redux/redux-utils.js'; @@ -29,10 +30,11 @@ const fid = useCurrentUserFID(); invariant(fid, 'FID should be set'); - const [selectedChannel, setSelectedChannel] = React.useState(null); + const [selectedChannel, setSelectedChannel] = + React.useState(null); const [channelOptions, setChannelOptions] = React.useState< - $ReadOnlyArray, + $ReadOnlyArray, >([]); const neynarClientContext = React.useContext(NeynarClientContext); @@ -42,11 +44,9 @@ React.useEffect(() => { void (async () => { - const data = await client.fetchFollowedFarcasterChannels(fid); + const channels = await client.fetchFollowedFarcasterChannels(fid); - const result = data.map(channel => channel.name); - - setChannelOptions(result); + setChannelOptions(channels); })(); }, [client, fid]); @@ -72,8 +72,10 @@ ); const onPressSelectChannel = React.useCallback(() => { + const channelNames = channelOptions.map(channel => channel.name); + const options = - Platform.OS === 'ios' ? [...channelOptions, 'Cancel'] : channelOptions; + Platform.OS === 'ios' ? [...channelNames, 'Cancel'] : channelNames; const cancelButtonIndex = Platform.OS === 'ios' ? options.length - 1 : -1; @@ -103,8 +105,8 @@ [styles.sectionContainer, styles.touchableSectionContainer], ); - const channelSelectionTextContent = selectedChannel - ? selectedChannel + const channelSelectionTextContent = selectedChannel?.name + ? selectedChannel.name : 'No Farcaster channel tagged'; const tagFarcasterChannel = React.useMemo(