-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
33 lines (30 loc) · 873 Bytes
/
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
import React from 'react'
import { Button, StyleSheet, View } from 'react-native'
import Home from './components/Home'
import ImageCom from './components/ImageCom'
import { useState } from 'react'
import Meal from './components/Meal'
import Feedback from './components/Feedback'
export const ThemeContext = React.createContext()
export default function App() {
const [darkTheme, setDarkTheme] = useState(false)
function toggleTheme() {
setDarkTheme((prevDarkTheme) => !prevDarkTheme)
}
return (
<ThemeContext.Provider value={darkTheme}>
<ImageCom />
<Home />
<Meal />
<View style={styles.buttonContainer}>
<Button title="Theme" color="#777" onPress={toggleTheme} />
</View>
<Feedback />
</ThemeContext.Provider>
)
}
const styles = StyleSheet.create({
buttonContainer: {
alignItems: 'center'
}
})