UNPKG

@devrue/rn-select

Version:

Custom typescript only select component for react native

43 lines 1.4 kB
import React from 'react'; import { Text, View } from 'react-native'; import useStyles from '../hooks/useStyles'; import { Pressable } from 'react-native'; export default function EmptyList({ msg, textStyle, createOption, onCreate }) { const styles = useStyles(({ tokens: { size } }) => ({ container: { flex: 1, justifyContent: !createOption ? 'center' : undefined, alignItems: 'center' }, text: { fontSize: size.md, fontStyle: 'italic', color: '#808080', textAlign: 'center', paddingVertical: size.lg }, create: { padding: size.sm, backgroundColor: '#f9f9f9', width: '100%' } }), []); return /*#__PURE__*/React.createElement(View, { style: [styles.container] }, !createOption && /*#__PURE__*/React.createElement(React.Fragment, null, (typeof msg === 'string' || msg === undefined) && /*#__PURE__*/React.createElement(Text, { style: [styles.text, textStyle] }, msg ?? '"No option matched your search"') || msg), createOption && (typeof createOption === 'string' ? /*#__PURE__*/React.createElement(Pressable, { style: styles.create, onPress: () => onCreate === null || onCreate === void 0 ? void 0 : onCreate(createOption) }, /*#__PURE__*/React.createElement(Text, null, "Create \"", createOption, "\"")) : createOption)); } //# sourceMappingURL=EmptyList.js.map