forked from appcircleio/appcircle-sample-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
69 lines (61 loc) · 1.88 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// In App.js in a new project
import * as React from 'react';
import { View, Text, Button, StatusBar, Image, StyleSheet } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import DeviceInfo from 'react-native-device-info';
const appcircleLogo = require('./images/app_circle_icon.png');
const Stack = createStackNavigator();
const appVersion = DeviceInfo.getVersion();
function HomeScreen({ navigation }) {
return (
<View style={styles.container}>
<StatusBar barStyle="light-content" hidden={false} backgroundColor="#FF8E34" />
<Image style={styles.tinyLogo} source={appcircleLogo} />
<Text style={{ fontWeight: 'bold', fontSize: 24, paddingBottom: 20 }}> Appcircle.io</Text>
<Button
onPress={() => navigation.navigate('Details')}
title="Next Page"
color="#FF8E34"
/>
</View>
);
}
function DetailsScreen() {
return (
<View style={styles.container}>
<Image style={styles.tinyLogo} source={appcircleLogo} />
<Text style={{ fontWeight: 'bold', fontSize: 26 }}> Appcircle.io</Text>
<Text style={{ fontWeight: 'bold', fontSize: 16 }}> v{appVersion}</Text>
</View>
);
}
function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} options={headerbarOptions} />
<Stack.Screen name="Details" component={DetailsScreen} options={headerbarOptions} />
</Stack.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
tinyLogo: {
width: 50,
height: 50,
}
});
const headerbarOptions = {
title: 'React Native Sample',
headerStyle: {
backgroundColor: '#FF8E34',
},
headerTintColor: '#fff'
}
export default App;