-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInputSheet.tsx
65 lines (60 loc) · 1.37 KB
/
InputSheet.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as React from 'react';
import { StyleSheet } from 'react-native';
import {
useSheet,
BottomSheet,
type SheetProps,
} from 'react-native-bottom-sheet-manager';
import { Button } from '../components';
const InputSheet: React.FC<SheetProps<'input'>> = ({ id }) => {
const sheet = useSheet(id);
const [value, setValue] = React.useState('');
return (
<BottomSheet id={id} style={styles.container}>
<BottomSheet.View style={styles.contentContainer}>
<BottomSheet.TextInput
style={styles.input}
value={value}
onChangeText={setValue}
/>
<Button
title="Close"
style={styles.closeButton}
onPress={() => {
sheet?.close({ value });
}}
/>
</BottomSheet.View>
</BottomSheet>
);
};
const styles = StyleSheet.create({
input: {
padding: 10,
minHeight: 50,
borderWidth: StyleSheet.hairlineWidth,
borderRadius: 20,
borderColor: '#555555',
},
container: {
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 12,
},
shadowOpacity: 0.58,
shadowRadius: 16.0,
elevation: 24,
backgroundColor: '#ffffff',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
},
contentContainer: {
flex: 1,
padding: 20,
},
closeButton: {
marginTop: 20,
},
});
export default InputSheet;