-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
index.android.tsx
26 lines (23 loc) · 1.09 KB
/
index.android.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React from 'react';
import {View} from 'react-native';
import DraggableFlatList from 'react-native-draggable-flatlist';
import type {FlatList} from 'react-native-gesture-handler';
import useThemeStyles from '@hooks/useThemeStyles';
import type {DraggableListProps} from './types';
function DraggableList<T>({renderClone, shouldUsePortal, ListFooterComponent, ...viewProps}: DraggableListProps<T>, ref: React.ForwardedRef<FlatList<T>>) {
const styles = useThemeStyles();
return (
<View style={styles.flex1}>
<DraggableFlatList
ref={ref}
containerStyle={ListFooterComponent ? undefined : styles.flex1}
contentContainerStyle={ListFooterComponent ? undefined : styles.flexGrow1}
// eslint-disable-next-line react/jsx-props-no-spreading
{...viewProps}
/>
{React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
</View>
);
}
DraggableList.displayName = 'DraggableList';
export default React.forwardRef(DraggableList);