-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: wrap example app in react-navigation stack navigator
- Loading branch information
1 parent
9a4359c
commit 1738013
Showing
5 changed files
with
181 additions
and
44 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
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,49 +1,13 @@ | ||
import * as React from 'react'; | ||
|
||
import { StyleSheet, View, Text } from 'react-native'; | ||
import { TextInput } from './components/TextInput'; | ||
import { ContentCard } from './components/ContentCard'; | ||
import { KeyboardScrollView } from '@rlemasquerier/react-native-keyboard-scrollview'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
|
||
import { MainStackNavigator } from './navigation/MainStackNavigator'; | ||
|
||
export default function App() { | ||
return ( | ||
<View style={styles.appContainer}> | ||
<View style={styles.header}> | ||
<Text style={styles.headerText}>Example app</Text> | ||
</View> | ||
<KeyboardScrollView | ||
contentContainerStyle={styles.container} | ||
additionalScrollHeight={20} | ||
> | ||
<ContentCard /> | ||
<ContentCard /> | ||
<TextInput /> | ||
</KeyboardScrollView> | ||
</View> | ||
<NavigationContainer> | ||
<MainStackNavigator /> | ||
</NavigationContainer> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
appContainer: { | ||
flex: 1, | ||
flexGrow: 1, | ||
}, | ||
header: { | ||
justifyContent: 'center', | ||
padding: 16, | ||
height: 120, | ||
borderBottomWidth: 1, | ||
}, | ||
headerText: { | ||
fontSize: 24, | ||
}, | ||
container: { | ||
padding: 16, | ||
alignItems: 'center', | ||
}, | ||
box: { | ||
width: 60, | ||
height: 60, | ||
marginVertical: 20, | ||
}, | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
|
||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
|
||
import { HomeScreen } from '../screens/Home'; | ||
|
||
const Stack = createNativeStackNavigator(); | ||
|
||
export const MainStackNavigator = () => { | ||
return ( | ||
<Stack.Navigator> | ||
<Stack.Screen name="Home" component={HomeScreen} /> | ||
</Stack.Navigator> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import * as React from 'react'; | ||
|
||
import { StyleSheet, View, Text } from 'react-native'; | ||
import { TextInput } from '../components/TextInput'; | ||
import { ContentCard } from '../components/ContentCard'; | ||
import { KeyboardScrollView } from '@rlemasquerier/react-native-keyboard-scrollview'; | ||
|
||
export const HomeScreen = () => { | ||
return ( | ||
<View style={styles.appContainer}> | ||
<View style={styles.header}> | ||
<Text style={styles.headerText}>Example app</Text> | ||
</View> | ||
<KeyboardScrollView | ||
contentContainerStyle={styles.container} | ||
additionalScrollHeight={20} | ||
> | ||
<ContentCard /> | ||
<ContentCard /> | ||
<TextInput /> | ||
</KeyboardScrollView> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
appContainer: { | ||
flex: 1, | ||
flexGrow: 1, | ||
}, | ||
header: { | ||
justifyContent: 'center', | ||
padding: 16, | ||
height: 120, | ||
borderBottomWidth: 1, | ||
}, | ||
headerText: { | ||
fontSize: 24, | ||
}, | ||
container: { | ||
padding: 16, | ||
alignItems: 'center', | ||
}, | ||
box: { | ||
width: 60, | ||
height: 60, | ||
marginVertical: 20, | ||
}, | ||
}); |
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