@eslam-elmeniawy/react-native-common-components
Version:
Common `ReactNative` components packed in library for usage in projects.
56 lines (52 loc) • 1.94 kB
JavaScript
;
// External imports.
import * as React from 'react';
import { RefreshControl } from 'react-native';
import { withTheme } from 'react-native-paper';
// Types imports.
// Internal imports.
import ResponsiveDimensions from "../../utils/ResponsiveDimensions.js";
/**
* ScrollViewComponent (unwrapped, for testing)
* @internal For testing purposes only. Do not use in production code.
*/
import { jsx as _jsx } from "react/jsx-runtime";
const ScrollViewComponent = /*#__PURE__*/React.memo(props => {
try {
const KeyboardAwareScrollView = require('react-native-keyboard-controller').KeyboardAwareScrollView;
const {
refreshing,
onRefresh,
refreshColor,
showsHorizontalScrollIndicator,
showsVerticalScrollIndicator,
keyboardShouldPersistTaps,
keyboardDismissMode,
refreshControl,
extraKeyboardSpace,
theme,
...other
} = props;
return /*#__PURE__*/_jsx(KeyboardAwareScrollView, {
showsHorizontalScrollIndicator: showsHorizontalScrollIndicator ?? false,
showsVerticalScrollIndicator: showsVerticalScrollIndicator ?? false,
keyboardShouldPersistTaps: keyboardShouldPersistTaps ?? 'handled',
keyboardDismissMode: keyboardDismissMode ?? 'none',
refreshControl: refreshControl ?? onRefresh ? /*#__PURE__*/_jsx(RefreshControl, {
colors: refreshColor ? [refreshColor] : [theme.colors.primary],
tintColor: refreshColor ?? theme.colors.primary,
refreshing: refreshing ?? false,
onRefresh: onRefresh
}) : undefined,
extraKeyboardSpace: extraKeyboardSpace ?? ResponsiveDimensions.vs(8),
...other
});
} catch (error) {
console.warn('Error loading `react-native-keyboard-controller`:', error);
return null;
}
});
const ScrollView = withTheme(ScrollViewComponent);
export { ScrollViewComponent };
export default ScrollView;
//# sourceMappingURL=ScrollView.js.map