diff --git a/shared/chat/conversation/bot/install.tsx b/shared/chat/conversation/bot/install.tsx index c1e24c343beb..66cae67162a9 100644 --- a/shared/chat/conversation/bot/install.tsx +++ b/shared/chat/conversation/bot/install.tsx @@ -56,7 +56,6 @@ const blankCommands: Array = [] const InstallBotPopup = (props: Props) => { const {botUsername, conversationIDKey} = props - // state const [installScreen, setInstallScreen] = React.useState(false) const [channelPickerScreen, setChannelPickerScreen] = React.useState(false) @@ -201,6 +200,7 @@ const InstallBotPopup = (props: Props) => { botAlias={featured.botAlias} horizontal={true} metaOne={featured.description} + onClick="profile" username={botUsername} size="big" /> @@ -228,7 +228,7 @@ const InstallBotPopup = (props: Props) => { ) const usernameContent = !featured && ( - + {inTeam && isBot && !inTeamUnrestricted && ( { () => ({canFixOverdraw: false, isHighlighted: false, ordinal}), [ordinal] ) + const showUserProfile = useProfileState(s => s.dispatch.showUserProfile) + const onClickUser = React.useCallback( + (username: string) => { + onHidden() + showUserProfile(username) + }, + [onHidden, showUserProfile] + ) + const renderItem = React.useCallback( + ({item}: {item: ListItem}) => ( + + ), + [onClickUser] + ) + if (!visible) { return null } @@ -144,19 +169,6 @@ type ListItem = { username: string } -const renderItem = ({item}: {item: ListItem}) => { - return ( - - ) -} - const renderSectionHeader = ({ section, }: { diff --git a/shared/chat/conversation/messages/text/coinflip/participants.tsx b/shared/chat/conversation/messages/text/coinflip/participants.tsx index a5d36fd592a5..7207d7bb9661 100644 --- a/shared/chat/conversation/messages/text/coinflip/participants.tsx +++ b/shared/chat/conversation/messages/text/coinflip/participants.tsx @@ -25,6 +25,8 @@ const CoinFlipParticipants = (props: Props) => { colorFollowing={true} key={`${p.username}${p.deviceName}`} horizontal={true} + onClick="profile" + withProfileCardPopup={false} username={p.username} metaOne={p.deviceName} containerStyle={styles.participants} diff --git a/shared/common-adapters/floating-menu/index.tsx b/shared/common-adapters/floating-menu/index.tsx index 1203fb03a5e5..a9f46e7fd946 100644 --- a/shared/common-adapters/floating-menu/index.tsx +++ b/shared/common-adapters/floating-menu/index.tsx @@ -15,7 +15,7 @@ import { import {useSafeAreaInsets} from '@/common-adapters/safe-area-view' import {FloatingModalContext} from './context' import {FullWindowOverlay} from 'react-native-screens' -import {useNavigation, type NavigationProp, type ParamListBase} from '@react-navigation/native' +import {NavigationContext} from '@react-navigation/core' const Kb = { Box2, @@ -61,10 +61,11 @@ const FullWindow = ({children}: {children?: React.ReactNode}): React.ReactNode = const defaultSnapPoints = ['75%'] -type SafeNavigationHook = >() => T | null - -const useSafeNavigation: SafeNavigationHook = Styles.isMobile - ? (useNavigation as SafeNavigationHook) +// useNavigation() throws when called outside a navigator (e.g. inside a gorhom +// portal rendered at popup-root, which is a sibling to the router). Using the +// context directly returns undefined instead of throwing. +const useSafeNavigation = Styles.isMobile + ? () => React.useContext(NavigationContext) ?? null : () => null const FloatingMenu = React.memo(function FloatingMenu(props: Props) {