Fix FlatList not working properly in ActionSheet

This commit is contained in:
Danish Ahmed Mirza 2022-07-26 02:37:10 +05:30 committed by Danish
parent 7d64b262cf
commit 086b98f8fb
4 changed files with 3 additions and 16 deletions

View File

@ -140,8 +140,7 @@ const ActionSheet = React.memo(
style={{ ...styles.container, ...bottomSheet }}
backgroundStyle={{ backgroundColor: colors.focusedBackground }}
onChange={index => index === -1 && onClose()}
activeOffsetY={[-5, 5]}
failOffsetX={[-5, 5]}
enableContentPanningGesture={false}
{...androidTablet}
>
<BottomSheetContent options={data?.options} hide={hide} children={data?.children} hasCancel={data?.hasCancel} />

View File

@ -1,7 +1,6 @@
import React from 'react';
import { Text, Pressable } from 'react-native';
import { BottomSheetFlatList } from '@gorhom/bottom-sheet';
import { FlatList as GHFlatList } from 'react-native-gesture-handler';
import { FlatList } from 'react-native-gesture-handler';
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
import styles from './styles';
@ -36,18 +35,10 @@ const Emoji = React.memo(({ emoji, size, baseUrl }: IEmojiProps) => {
);
});
const EmojiCategory = ({
baseUrl,
onEmojiSelected,
emojis,
width,
tabsCount,
isBottomSheet
}: IEmojiCategory): React.ReactElement | null => {
const EmojiCategory = ({ baseUrl, onEmojiSelected, emojis, width, tabsCount }: IEmojiCategory): React.ReactElement | null => {
const emojiSize = width ? Math.min(width / tabsCount, MAX_EMOJI_SIZE) : MAX_EMOJI_SIZE;
const numColumns = Math.trunc(width ? width / emojiSize : tabsCount);
const { colors } = useTheme();
const FlatList = isBottomSheet ? BottomSheetFlatList : GHFlatList;
const renderItem = (emoji: IEmoji) => (
<Pressable

View File

@ -137,7 +137,6 @@ const EmojiPicker = ({
baseUrl={baseUrl}
tabLabel={label}
tabsCount={tabsCount}
isBottomSheet={!isEmojiKeyboard}
/>
);
};
@ -159,7 +158,6 @@ const EmojiPicker = ({
baseUrl={baseUrl}
tabLabel={'searching'}
tabsCount={tabsCount}
isBottomSheet={!isEmojiKeyboard}
/>
) : (
<ScrollableTabView

View File

@ -36,7 +36,6 @@ export interface IEmojiCategory {
style: StyleProp<ImageStyle>;
tabLabel: string;
tabsCount: number;
isBottomSheet: boolean;
}
export type TGetCustomEmoji = (name: string) => any;