Skip to content

Commit 92f0b01

Browse files
authored
fix: change flatlist inside the bottom sheet modal and fix gesture in bottom sheet (#2953)
* fix: change flatlist inside the bottom sheet modal and fix gesture in bottom sheet * fix: lint issues * fix:bottom sheet transparent click area * fix:theme
1 parent f420e08 commit 92f0b01

File tree

4 files changed

+39
-17
lines changed

4 files changed

+39
-17
lines changed

package/src/components/MessageMenu/MessageActionList.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
2-
import { StyleSheet, View } from 'react-native';
2+
import { StyleSheet } from 'react-native';
3+
4+
import { ScrollView } from 'react-native-gesture-handler';
35

46
import { MessageActionType } from './MessageActionListItem';
57

@@ -23,27 +25,32 @@ export const MessageActionList = (props: MessageActionListProps) => {
2325
const {
2426
theme: {
2527
messageMenu: {
26-
actionList: { container },
28+
actionList: { container, contentContainer },
2729
},
2830
},
2931
} = useTheme();
3032

3133
if (messageActions?.length === 0) return null;
3234

3335
return (
34-
<View accessibilityLabel='Message action list' style={[styles.container, container]}>
36+
<ScrollView
37+
accessibilityLabel='Message action list'
38+
contentContainerStyle={[styles.contentContainer, contentContainer]}
39+
style={[styles.container, container]}
40+
>
3541
{messageActions?.map((messageAction, index) => (
3642
<MessageActionListItem
3743
key={messageAction.title}
3844
{...{ ...messageAction, index, length: messageActions.length }}
3945
/>
4046
))}
41-
</View>
47+
</ScrollView>
4248
);
4349
};
4450

4551
const styles = StyleSheet.create({
46-
container: {
52+
container: {},
53+
contentContainer: {
4754
paddingHorizontal: 16,
4855
},
4956
});

package/src/components/MessageMenu/MessageUserReactions.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useMemo } from 'react';
2-
import { FlatList, StyleSheet, Text, View } from 'react-native';
2+
import { StyleSheet, Text, View } from 'react-native';
3+
import { FlatList } from 'react-native-gesture-handler';
34

45
import { ReactionSortBase } from 'stream-chat';
56

@@ -179,7 +180,9 @@ export const MessageUserReactions = (props: MessageUserReactionsProps) => {
179180
};
180181

181182
const styles = StyleSheet.create({
182-
container: {},
183+
container: {
184+
flex: 1,
185+
},
183186
contentContainer: {
184187
flexGrow: 1,
185188
justifyContent: 'space-around',

package/src/components/UIComponents/BottomSheetModal.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
4545
const { children, height = windowHeight / 2, onClose, visible } = props;
4646
const {
4747
theme: {
48-
bottomSheetModal: { container, contentContainer, handle, overlay: overlayTheme },
48+
bottomSheetModal: { container, contentContainer, handle, overlay: overlayTheme, wrapper },
4949
colors: { grey, overlay, white_snow },
5050
},
5151
} = useTheme();
@@ -119,11 +119,14 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
119119
});
120120

121121
return (
122-
<GestureHandlerRootView style={{ flex: 1 }}>
123-
<Modal animationType='fade' onRequestClose={handleDismiss} transparent visible={visible}>
124-
<TouchableWithoutFeedback onPress={handleDismiss}>
125-
<View style={[styles.overlay, { backgroundColor: overlay }, overlayTheme]}>
126-
<GestureDetector gesture={gesture}>
122+
<View style={[styles.wrapper, wrapper]}>
123+
<Modal onRequestClose={onClose} transparent visible={visible}>
124+
<GestureHandlerRootView style={{ flex: 1 }}>
125+
<GestureDetector gesture={gesture}>
126+
<View style={[styles.overlay, { backgroundColor: overlay }, overlayTheme]}>
127+
<TouchableWithoutFeedback onPress={onClose} style={{ flex: 1 }}>
128+
<View style={{ flex: 1 }} />
129+
</TouchableWithoutFeedback>
127130
<Animated.View
128131
style={[
129132
styles.container,
@@ -140,11 +143,11 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
140143
/>
141144
<View style={[styles.contentContainer, contentContainer]}>{children}</View>
142145
</Animated.View>
143-
</GestureDetector>
144-
</View>
145-
</TouchableWithoutFeedback>
146+
</View>
147+
</GestureDetector>
148+
</GestureHandlerRootView>
146149
</Modal>
147-
</GestureHandlerRootView>
150+
</View>
148151
);
149152
};
150153

@@ -171,4 +174,9 @@ const styles = StyleSheet.create({
171174
flex: 1,
172175
justifyContent: 'flex-end',
173176
},
177+
wrapper: {
178+
alignItems: 'center',
179+
flex: 1,
180+
justifyContent: 'center',
181+
},
174182
});

package/src/contexts/themeContext/utils/theme.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export type Theme = {
132132
contentContainer: ViewStyle;
133133
handle: ViewStyle;
134134
overlay: ViewStyle;
135+
wrapper: ViewStyle;
135136
};
136137
channel: {
137138
selectChannel: TextStyle;
@@ -442,6 +443,7 @@ export type Theme = {
442443
messageMenu: {
443444
actionList: {
444445
container: ViewStyle;
446+
contentContainer: ViewStyle;
445447
};
446448
actionListItem: {
447449
container: ViewStyle;
@@ -892,6 +894,7 @@ export const defaultTheme: Theme = {
892894
contentContainer: {},
893895
handle: {},
894896
overlay: {},
897+
wrapper: {},
895898
},
896899
channel: {
897900
selectChannel: {},
@@ -1197,6 +1200,7 @@ export const defaultTheme: Theme = {
11971200
messageMenu: {
11981201
actionList: {
11991202
container: {},
1203+
contentContainer: {},
12001204
},
12011205
actionListItem: {
12021206
container: {},

0 commit comments

Comments
 (0)