-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
48 lines (42 loc) · 1.29 KB
/
App.tsx
File metadata and controls
48 lines (42 loc) · 1.29 KB
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
"use client"
import { useState } from "react"
import { StatusBar } from "expo-status-bar"
import { SafeAreaView, StyleSheet, View } from "react-native"
import { ThemeProvider } from "./context/ThemeContext"
import { ContractProvider } from "./context/ContractContext"
import LandingPage from "./components/LandingPage"
import ContractForm from "./components/ContractForm"
import DeployedContracts from "./components/DeployedContracts"
export default function App() {
const [currentScreen, setCurrentScreen] = useState("landing")
const renderScreen = () => {
switch (currentScreen) {
case "landing":
return <LandingPage onNavigate={setCurrentScreen} />
case "create":
return <ContractForm onBack={() => setCurrentScreen("landing")} />
case "deployed":
return <DeployedContracts onBack={() => setCurrentScreen("landing")} />
default:
return null
}
}
return (
<ThemeProvider defaultTheme="dark">
<ContractProvider>
<StatusBar style="light" />
<SafeAreaView style={styles.container}>
<View style={styles.content}>{renderScreen()}</View>
</SafeAreaView>
</ContractProvider>
</ThemeProvider>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
content: {
flex: 1,
},
})