Skip to content

Commit

Permalink
📦 Native-Base & React Navigation packages added
Browse files Browse the repository at this point in the history
  • Loading branch information
aminmeshk committed Sep 11, 2020
1 parent 49d04f6 commit 49d2dd9
Show file tree
Hide file tree
Showing 8 changed files with 10,272 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
bracketSpacing: false,
bracketSpacing: true,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
Expand Down
113 changes: 6 additions & 107 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,114 +1,13 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/

import React from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';

import {
Header,
LearnMoreLinks,
Colors,
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import { NavigationContainer } from '@react-navigation/native';
import AppNavigator from './navigation/AppNavigator';

const App: () => React$Node = () => {
const App = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
<Header />
{global.HermesInternal == null ? null : (
<View style={styles.engine}>
<Text style={styles.footer}>Engine: Hermes</Text>
</View>
)}
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One</Text>
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>See Your Changes</Text>
<Text style={styles.sectionDescription}>
<ReloadInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Debug</Text>
<Text style={styles.sectionDescription}>
<DebugInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Learn More</Text>
<Text style={styles.sectionDescription}>
Read the docs to discover what to do next:
</Text>
</View>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
</>
<NavigationContainer>
<AppNavigator />
</NavigationContainer>
);
};

const styles = StyleSheet.create({
scrollView: {
backgroundColor: Colors.lighter,
},
engine: {
position: 'absolute',
right: 0,
},
body: {
backgroundColor: Colors.white,
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
color: Colors.black,
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
color: Colors.dark,
},
highlight: {
fontWeight: '700',
},
footer: {
color: Colors.dark,
fontSize: 12,
fontWeight: '600',
padding: 4,
paddingRight: 12,
textAlign: 'right',
},
});

export default App;
4 changes: 4 additions & 0 deletions constants/Colors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default Colors = {
primary: '#03a9f4',
primaryDark: '#0091ea',
};
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* @format
*/

import {AppRegistry} from 'react-native';
import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);
30 changes: 30 additions & 0 deletions navigation/AppNavigator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import HomeScreen from '../screens/HomeScreen';
import { createStackNavigator } from '@react-navigation/stack';
import Colors from '../constants/Colors';

const defaultNavOptions = {
headerStyle: {
backgroundColor: Colors.primary,
},
// headerTitleStyle: {
// fontFamily: 'open-sans-bold'
// },
// headerBackTitleStyle: {
// fontFamily: 'open-sans'
// },
headerTintColor: 'white',
};

const AppStackNavigator = createStackNavigator();

const AppNavigator = (props) => {
return (
<AppStackNavigator.Navigator screenOptions={defaultNavOptions}>
<AppStackNavigator.Screen name="Home" component={HomeScreen} />
</AppStackNavigator.Navigator>
);
};

export default AppNavigator;
Loading

0 comments on commit 49d2dd9

Please sign in to comment.