-
Notifications
You must be signed in to change notification settings - Fork 31
/
App.js
65 lines (60 loc) · 1.44 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
61
62
63
64
65
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View, Button } from "react-native";
import Login from "./Login";
import MorphSlider from "./MorphSlider";
import Curve from "./Curve";
import Menu from "./MenuThree";
import BalloonSlider from "./BalloonSlider";
import { useState, Fragment } from "react";
import { getTopInset } from "rn-iphone-helper";
const divider = <View style={{ height: 10 }} />;
const screens = [
{
name: "Temperature Control",
Component: MorphSlider,
},
{
name: "Login page",
Component: Login,
},
{
name: "Curved add to cart",
Component: Curve,
},
{
name: "3D Burger Menu",
Component: Menu,
},
{
name: "Balloon Slider",
Component: BalloonSlider,
},
];
export default function App() {
const [selectedScreen, setSelectedScreen] = useState(-1);
let Screen;
if (selectedScreen >= 0) {
Screen = screens[selectedScreen].Component;
}
return (
<View style={styles.container}>
{selectedScreen === -1 && (
<View style={{ paddingTop: getTopInset() + 20 }}>
{screens.map(({ name }, i) => (
<Fragment key={name}>
<Button title={name} onPress={() => setSelectedScreen(i)} />
{divider}
</Fragment>
))}
</View>
)}
{Screen && <Screen />}
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
});