@eslam-elmeniawy/react-native-common-components
Version:
Common `ReactNative` components packed in library for usage in projects.
52 lines (49 loc) • 1.81 kB
JavaScript
;
// External imports.
import * as React from 'react';
import { FlatList as NativeFlatList, RefreshControl, StyleSheet } from 'react-native';
import { withTheme } from 'react-native-paper';
// Types imports.
// Internal imports.
import styles from "./FlatList.styles.js";
import { jsx as _jsx } from "react/jsx-runtime";
const FlatList = /*#__PURE__*/React.memo(props => {
const {
refreshing,
onRefresh,
refreshColor,
showsHorizontalScrollIndicator,
showsVerticalScrollIndicator,
horizontal,
keyboardShouldPersistTaps,
keyboardDismissMode,
keyExtractor,
onEndReachedThreshold,
style,
contentContainerStyle,
refreshControl,
theme,
...other
} = props;
return /*#__PURE__*/_jsx(NativeFlatList, {
showsHorizontalScrollIndicator: showsHorizontalScrollIndicator ?? false,
showsVerticalScrollIndicator: showsVerticalScrollIndicator ?? false,
horizontal: horizontal,
keyboardShouldPersistTaps: keyboardShouldPersistTaps ?? 'handled',
keyboardDismissMode: keyboardDismissMode ?? 'none',
keyExtractor: keyExtractor ?? (item => item.key),
onEndReachedThreshold: onEndReachedThreshold ?? 0.01,
style: StyleSheet.compose(styles.list, style),
contentContainerStyle: horizontal ? StyleSheet.compose(styles.horizontalContainerStyle, contentContainerStyle) : contentContainerStyle,
refreshing: refreshing,
refreshControl: refreshControl ?? onRefresh ? /*#__PURE__*/_jsx(RefreshControl, {
colors: refreshColor ? [refreshColor] : [theme.colors.primary],
tintColor: refreshColor ?? theme.colors.primary,
refreshing: refreshing ?? false,
onRefresh: onRefresh ?? undefined
}) : undefined,
...other
});
});
export default withTheme(FlatList);
//# sourceMappingURL=FlatList.js.map