Skip to content

Commit

Permalink
Workaround RN bug on conversation menu (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
duogenesis authored Nov 20, 2024
1 parent db4af84 commit 6925cfe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
33 changes: 18 additions & 15 deletions components/conversation-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,15 @@ const ConversationScreenNavBar = ({
setShowMenu(x => !x);
}, []);

// There's a bug in React Native which causes `overflow: hidden` to be
// ignored when zIndex or elevation are set.
const menuWorkaround = showMenu && Platform.OS === 'android' ? {
elevation: undefined,
zIndex: undefined,
} : {};

return (
<TopNavBar>
<TopNavBar containerStyle={menuWorkaround} >
<TopNavBarButton
onPress={() => navigation.goBack()}
iconName="arrow-back"
Expand All @@ -304,6 +311,9 @@ const ConversationScreenNavBar = ({
justifyContent: 'center',
alignItems: 'center',
maxWidth: 220,
overflow: 'visible',
flexDirection: 'row',
gap: 10,
}}
>
<Image
Expand All @@ -315,9 +325,6 @@ const ConversationScreenNavBar = ({
width: 30,
height: 30,
borderRadius: 9999,
position: 'absolute',
left: -40,
top: -3,
}}
/>
<DefaultText
Expand All @@ -329,17 +336,13 @@ const ConversationScreenNavBar = ({
>
{name ?? '...'}
</DefaultText>
{!isOnline &&
<ActivityIndicator
size="small"
color="#70f"
style={{
position: 'absolute',
right: -40,
top: 3,
}}
/>
}
<ActivityIndicator
size="small"
color="#70f"
style={{
opacity: isOnline ? 0 : 1,
}}
/>
</Pressable>
{isAvailableUser &&
<TopNavBarButton
Expand Down
1 change: 1 addition & 0 deletions components/top-nav-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const TopNavBar = (props) => {
width: '100%',
overflow: 'visible',
...(props.shadow === false ? {} : shadow),
...props.containerStyle,
}}
>
<StatusBarSpacer/>
Expand Down

0 comments on commit 6925cfe

Please sign in to comment.