-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathApp.js
60 lines (56 loc) · 1.52 KB
/
App.js
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
import React, { useState } from "react";
import { StyleSheet, View } from "react-native";
import { BottomNavigation, Button } from "react-native-paper/lib/module";
import NativeForms, { NativeFormsModal } from "native-forms";
const App = () => {
const [index, setIndex] = useState(0);
const [routes] = useState([
{
key: "normal",
title: "Fullscreen",
icon: "fullscreen",
},
{
key: "modal",
title: "Modal",
icon: "eye",
},
]);
return (
<BottomNavigation
navigationState={{ index, routes }}
onIndexChange={setIndex}
renderScene={BottomNavigation.SceneMap({
normal: () => (
<NativeForms form="https://form.nativeforms.com/I2Z5xWPmZic4JlRvpmNy0Db" />
),
modal: () => {
const [hasForm, showForm] = useState(false);
return (
<View style={styles.container}>
<Button onPress={() => showForm(true)} color="#20f">
Show Form
</Button>
<NativeFormsModal
visible={hasForm}
form="https://form.nativeforms.com/I2Z5xWPmZic4JlRvpmNy0Db"
onClose={() => showForm(false)}
/>
</View>
);
},
})}
barStyle={{ backgroundColor: "#2200ff" }}
style={{ paddingTop: 32 }}
/>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
export default App;