-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
64 lines (56 loc) · 1.36 KB
/
App.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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React, {useRef} from 'react';
import {
SafeAreaView,
StyleSheet,
Text,
TouchableWithoutFeedback,
View,
} from 'react-native';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {Toast, ToastRef} from './Toast';
function App(): React.JSX.Element {
const toastRef = useRef<ToastRef>();
const onShowToast = () => {
toastRef.current?.onShowToast();
};
return (
<GestureHandlerRootView style={styles.gestureContainer}>
<SafeAreaView style={styles.container}>
<Toast toastRef={toastRef} />
<TouchableWithoutFeedback onPress={onShowToast}>
<View style={styles.button}>
<Text style={styles.buttonText}>Show Toast</Text>
</View>
</TouchableWithoutFeedback>
</SafeAreaView>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
gestureContainer: {
flex: 1,
},
container: {
flex: 1,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
},
button: {
width: 300,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#FEC520',
padding: 20,
borderRadius: 15,
marginTop: 20,
},
buttonText: {fontSize: 16, fontWeight: '600', color: 'black'},
});
export default App;