UNPKG

@gechiui/components

Version:
79 lines (71 loc) 2.33 kB
import { createElement, Fragment } from "@gechiui/element"; /** * External dependencies */ import { TextInput } from 'react-native'; import { useNavigation } from '@react-navigation/native'; /** * GeChiUI dependencies */ import { useState } from '@gechiui/element'; import { Icon, chevronRight } from '@gechiui/icons'; import { usePreferredColorSchemeStyle } from '@gechiui/compose'; import { BottomSheet, PanelBody, FooterMessageControl } from '@gechiui/components'; /** * Internal dependencies */ import styles from './styles.scss'; const BottomSheetTextControl = _ref => { let { initialValue, onChange, placeholder, label, icon, footerNote } = _ref; const [showSubSheet, setShowSubSheet] = useState(false); const navigation = useNavigation(); const goBack = () => { setShowSubSheet(false); navigation.goBack(); }; const openSubSheet = () => { navigation.navigate(BottomSheet.SubSheet.screenName); setShowSubSheet(true); }; const horizontalBorderStyle = usePreferredColorSchemeStyle(styles.horizontalBorder, styles.horizontalBorderDark); const textEditorStyle = usePreferredColorSchemeStyle(styles.textEditor, styles.textEditorDark); return createElement(BottomSheet.SubSheet, { navigationButton: createElement(BottomSheet.Cell, { icon: icon, placeholder: placeholder, label: label, onPress: openSubSheet, value: initialValue || '' }, createElement(Icon, { icon: chevronRight })), showSheet: showSubSheet }, createElement(Fragment, null, createElement(BottomSheet.NavBar, null, createElement(BottomSheet.NavBar.BackButton, { onPress: goBack }), createElement(BottomSheet.NavBar.Heading, null, label)), createElement(PanelBody, { style: horizontalBorderStyle }, createElement(TextInput, { label: label, onChangeText: text => onChange(text), defaultValue: initialValue, multiline: true, placeholder: placeholder, placeholderTextColor: '#87a6bc', style: textEditorStyle, textAlignVertical: 'top' }))), footerNote && createElement(PanelBody, { style: styles.textFooternote }, createElement(FooterMessageControl, { label: footerNote, textAlign: "left" }))); }; export default BottomSheetTextControl; //# sourceMappingURL=index.native.js.map