Skip to content

Commit aad13da

Browse files
authored
chore: Upgrade zeego package (#880)
1 parent 0132f32 commit aad13da

File tree

5 files changed

+97
-48
lines changed

5 files changed

+97
-48
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@react-native-community/netinfo": "^11.3.2",
4242
"@react-native-firebase/app": "^21.0.0",
4343
"@react-native-firebase/messaging": "^21.0.0",
44+
"@react-native-menu/menu": "^1.2.0",
4445
"@react-navigation/bottom-tabs": "^6.6.1",
4546
"@react-navigation/native": "^6.1.18",
4647
"@react-navigation/native-stack": "^6.10.1",
@@ -80,6 +81,8 @@
8081
"react-native-file-viewer": "^2.1.5",
8182
"react-native-gesture-handler": "^2.17.1",
8283
"react-native-image-picker": "^7.1.2",
84+
"react-native-ios-context-menu": "^3.1.0",
85+
"react-native-ios-utilities": "^5.1.0",
8386
"react-native-keyboard-controller": "^1.13.4",
8487
"react-native-markdown-display": "^7.0.0-alpha.2",
8588
"react-native-pager-view": "^6.2.1",
@@ -100,7 +103,7 @@
100103
"tailwindcss": "^3.4.12",
101104
"twrnc": "^4.5.1",
102105
"use-deep-compare-effect": "^1.8.1",
103-
"zeego": "^1.10.0"
106+
"zeego": "^2.0.3"
104107
},
105108
"devDependencies": {
106109
"@babel/core": "^7.20.0",

pnpm-lock.yaml

Lines changed: 28 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/screens/chat-screen/components/chat-header/ChatHeader.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { ImageSourcePropType, Keyboard, Pressable } from 'react-native';
2+
import { ImageSourcePropType, Keyboard, Platform, Pressable } from 'react-native';
33
import { BottomSheetModal, useBottomSheetSpringConfigs } from '@gorhom/bottom-sheet';
44
import Animated from 'react-native-reanimated';
55

@@ -80,7 +80,10 @@ export const ChatHeader = ({
8080
</Pressable>
8181
</Animated.View>
8282

83-
<Animated.View style={tailwind.style('flex flex-row flex-1 justify-end')}>
83+
<Animated.View
84+
style={tailwind.style(
85+
`flex flex-row flex-1 justify-end ${Platform.OS === 'ios' ? 'gap-4' : ''}`,
86+
)}>
8487
<Animated.View style={tailwind.style('flex flex-row items-center gap-4')}>
8588
{hasSla && (
8689
<Pressable hitSlop={8} onPress={toggleSlaEventsSheet}>

src/screens/chat-screen/components/chat-header/DropdownMenu.tsx

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { forwardRef, PropsWithChildren, useCallback, useRef } from 'react';
2-
import { Platform, Pressable } from 'react-native';
2+
import { Platform, Pressable, View } from 'react-native';
33
import Animated, { interpolate, useAnimatedStyle } from 'react-native-reanimated';
44
import { useSafeAreaInsets } from 'react-native-safe-area-context';
55
import {
@@ -18,6 +18,33 @@ export type DashboardList = {
1818
onSelect: (url: string | undefined, title: string | undefined) => void;
1919
};
2020

21+
const DropdownMenuTrigger = DropdownMenu.create<React.ComponentProps<typeof DropdownMenu.Trigger>>(
22+
props => (
23+
<DropdownMenu.Trigger {...props} asChild>
24+
<View aria-role="button" style={tailwind.style('ml-4')}>
25+
{props.children}
26+
</View>
27+
</DropdownMenu.Trigger>
28+
),
29+
'Trigger',
30+
);
31+
32+
const DropdownMenuItem = DropdownMenu.create<React.ComponentProps<typeof DropdownMenu.Item>>(
33+
props => (
34+
<DropdownMenu.Item {...props}>
35+
<View style={tailwind.style('flex flex-row items-center')}>
36+
<DropdownMenu.ItemTitle
37+
style={tailwind.style(
38+
'text-base text-gray-950 font-inter-420-20 leading-[21px] tracking-[0.16px] capitalize',
39+
)}>
40+
{props.children}
41+
</DropdownMenu.ItemTitle>
42+
</View>
43+
</DropdownMenu.Item>
44+
),
45+
'Item',
46+
);
47+
2148
// eslint-disable-next-line react/display-name
2249
const DropdownMenuBottomSheetBackdrop = forwardRef<
2350
React.RefObject<BottomSheetModal>,
@@ -136,21 +163,19 @@ export const ChatDropdownMenu = (props: PropsWithChildren<ChatDropdownMenuProps>
136163
</React.Fragment>
137164
);
138165
}
166+
139167
return (
140168
<DropdownMenu.Root>
141-
<DropdownMenu.Trigger style={tailwind.style('ml-4')}>
142-
{/* @ts-ignore */}
143-
{children}
144-
</DropdownMenu.Trigger>
169+
<DropdownMenuTrigger>{children}</DropdownMenuTrigger>
145170
<DropdownMenu.Content>
146171
{dropdownMenuList.map(menuOption => {
147172
const handleOnOptionSelect = () => {
148173
menuOption.onSelect(menuOption.url, menuOption.title);
149174
};
150175
return (
151-
<DropdownMenu.Item onSelect={handleOnOptionSelect} key={menuOption.title}>
152-
<DropdownMenu.ItemTitle>{menuOption.title}</DropdownMenu.ItemTitle>
153-
</DropdownMenu.Item>
176+
<DropdownMenuItem onSelect={handleOnOptionSelect} key={menuOption.title}>
177+
{menuOption.title}
178+
</DropdownMenuItem>
154179
);
155180
})}
156181
</DropdownMenu.Content>

src/screens/chat-screen/components/message-menu/MessageMenu.tsx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { forwardRef, PropsWithChildren, useCallback, useRef } from 'react';
2-
import { Platform, Pressable } from 'react-native';
2+
import { Platform, Pressable, View } from 'react-native';
33
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
44
import Animated, { interpolate, runOnJS, useAnimatedStyle } from 'react-native-reanimated';
55
import { useSafeAreaInsets } from 'react-native-safe-area-context';
@@ -24,6 +24,26 @@ type MessageMenuProps = {
2424
menuOptions: MenuOption[];
2525
};
2626

27+
const ContextMenuTrigger = ContextMenu.create<React.ComponentProps<typeof ContextMenu.Trigger>>(
28+
props => (
29+
<ContextMenu.Trigger {...props} asChild>
30+
<View aria-role="button">{props.children}</View>
31+
</ContextMenu.Trigger>
32+
),
33+
'Trigger',
34+
);
35+
36+
const ContextMenuItem = ContextMenu.create<React.ComponentProps<typeof ContextMenu.Item>>(
37+
props => (
38+
<ContextMenu.Item {...props}>
39+
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
40+
{props.children}
41+
</View>
42+
</ContextMenu.Item>
43+
),
44+
'Item',
45+
);
46+
2747
// eslint-disable-next-line react/display-name
2848
const ContextMenuBottomSheetBackdrop = forwardRef<
2949
React.RefObject<BottomSheetModal>,
@@ -131,27 +151,20 @@ export const MessageMenu = (props: PropsWithChildren<MessageMenuProps>) => {
131151
</React.Fragment>
132152
);
133153
}
154+
134155
return menuOptions?.length > 0 ? (
135156
<ContextMenu.Root>
136-
{/*
137-
The below children is a React Element but is not as per the types
138-
of the library so ignoring the issue
139-
*/}
140-
<ContextMenu.Trigger action="longPress">
141-
{/* @ts-ignore */}
142-
{children}
143-
</ContextMenu.Trigger>
144-
157+
<ContextMenuTrigger>{children}</ContextMenuTrigger>
145158
<ContextMenu.Content>
146159
{menuOptions?.map(option => {
147160
return (
148-
<ContextMenu.Item
149-
onSelect={option.handleOnPressMenuOption}
161+
<ContextMenuItem
150162
key={option.title}
163+
onSelect={option.handleOnPressMenuOption}
151164
destructive={option.destructive}>
152-
<ContextMenu.ItemTitle>{option.title}</ContextMenu.ItemTitle>
153165
{option.icon}
154-
</ContextMenu.Item>
166+
<ContextMenu.ItemTitle>{option.title}</ContextMenu.ItemTitle>
167+
</ContextMenuItem>
155168
);
156169
})}
157170
</ContextMenu.Content>

0 commit comments

Comments
 (0)