-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ESLint rules, add react-navigation dependencies, and modify Ap…
…p.tsx
- Loading branch information
1 parent
ee613d2
commit 30599f2
Showing
9 changed files
with
19,419 additions
and
6,907 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native', | ||
rules: { | ||
'prettier/prettier': 0, | ||
'react-native/no-inline-styles': 0, | ||
'react-hooks/exhaustive-deps': 0, | ||
'react-hooks/rules-of-hooks': 0, | ||
'react/no-unstable-nested-components': 0, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,64 @@ | ||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
*/ | ||
|
||
import {StyleSheet, Text, View} from 'react-native'; | ||
import React from 'react'; | ||
import type {PropsWithChildren} from 'react'; | ||
import { | ||
SafeAreaView, | ||
ScrollView, | ||
StatusBar, | ||
StyleSheet, | ||
Text, | ||
useColorScheme, | ||
View, | ||
} from 'react-native'; | ||
|
||
import { | ||
Colors, | ||
DebugInstructions, | ||
Header, | ||
LearnMoreLinks, | ||
ReloadInstructions, | ||
} from 'react-native/Libraries/NewAppScreen'; | ||
import Home from './screens/home/Home'; | ||
import Info from './screens/home/Info'; | ||
import Settings from './screens/Settings'; | ||
import {NavigationContainer} from '@react-navigation/native'; | ||
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; | ||
import {createNativeStackNavigator} from '@react-navigation/native-stack'; | ||
import Entypo from 'react-native-vector-icons/Entypo'; | ||
|
||
type SectionProps = PropsWithChildren<{ | ||
title: string; | ||
}>; | ||
const Tab = createBottomTabNavigator(); | ||
|
||
function Section({children, title}: SectionProps): React.JSX.Element { | ||
const isDarkMode = useColorScheme() === 'dark'; | ||
return ( | ||
<View style={styles.sectionContainer}> | ||
<Text | ||
style={[ | ||
styles.sectionTitle, | ||
{ | ||
color: isDarkMode ? Colors.white : Colors.black, | ||
}, | ||
]}> | ||
{title} | ||
</Text> | ||
<Text | ||
style={[ | ||
styles.sectionDescription, | ||
{ | ||
color: isDarkMode ? Colors.light : Colors.dark, | ||
}, | ||
]}> | ||
{children} | ||
</Text> | ||
</View> | ||
); | ||
} | ||
const App = () => { | ||
const HomeStack = createNativeStackNavigator(); | ||
|
||
function App(): React.JSX.Element { | ||
const isDarkMode = useColorScheme() === 'dark'; | ||
|
||
const backgroundStyle = { | ||
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, | ||
}; | ||
function HomeStackScreen() { | ||
return ( | ||
<HomeStack.Navigator | ||
screenOptions={{ | ||
headerBlurEffect: 'light', | ||
headerTintColor: 'tomato', | ||
headerStyle: {backgroundColor: '#171717'}, | ||
}}> | ||
<HomeStack.Screen name="Home" component={Home} /> | ||
<HomeStack.Screen name="Info" component={Info} /> | ||
</HomeStack.Navigator> | ||
); | ||
} | ||
|
||
return ( | ||
<SafeAreaView style={backgroundStyle}> | ||
<StatusBar | ||
barStyle={isDarkMode ? 'light-content' : 'dark-content'} | ||
backgroundColor={backgroundStyle.backgroundColor} | ||
/> | ||
<ScrollView | ||
contentInsetAdjustmentBehavior="automatic" | ||
style={backgroundStyle}> | ||
<Header /> | ||
<View | ||
style={{ | ||
backgroundColor: isDarkMode ? Colors.black : Colors.white, | ||
}}> | ||
<Section title="Step One"> | ||
Edit <Text style={styles.highlight}>App.tsx</Text> to change this | ||
screen and then come back to see your edits. | ||
</Section> | ||
<Section title="See Your Changes"> | ||
<ReloadInstructions /> | ||
</Section> | ||
<Section title="Debug"> | ||
<DebugInstructions /> | ||
</Section> | ||
<Section title="Learn More"> | ||
Read the docs to discover what to do next: | ||
</Section> | ||
<LearnMoreLinks /> | ||
</View> | ||
</ScrollView> | ||
</SafeAreaView> | ||
<NavigationContainer> | ||
<Tab.Navigator | ||
screenOptions={{ | ||
headerShown: false, | ||
tabBarActiveTintColor: 'tomato', | ||
tabBarInactiveTintColor: 'gray', | ||
tabBarStyle: {backgroundColor: 'black'}, | ||
}}> | ||
<Tab.Screen | ||
name="Home" | ||
component={HomeStackScreen} | ||
options={{ | ||
tabBarIcon: ({color, size}) => ( | ||
<Entypo name="home" color={color} size={size} /> | ||
), | ||
}} | ||
/> | ||
<Tab.Screen | ||
name="Settings" | ||
component={Settings} | ||
options={{ | ||
tabBarIcon: ({color, size}) => ( | ||
<Entypo name="cog" color={color} size={size} /> | ||
), | ||
}} | ||
/> | ||
</Tab.Navigator> | ||
</NavigationContainer> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
sectionContainer: { | ||
marginTop: 32, | ||
paddingHorizontal: 24, | ||
}, | ||
sectionTitle: { | ||
fontSize: 24, | ||
fontWeight: '600', | ||
}, | ||
sectionDescription: { | ||
marginTop: 8, | ||
fontSize: 18, | ||
fontWeight: '400', | ||
}, | ||
highlight: { | ||
fontWeight: '700', | ||
}, | ||
}); | ||
}; | ||
|
||
export default App; | ||
|
||
const styles = StyleSheet.create({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.