-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
57 lines (52 loc) · 1.43 KB
/
App.js
File metadata and controls
57 lines (52 loc) · 1.43 KB
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
import React, {useEffect} from 'react';
import {View, TouchableOpacity, StyleSheet, Text, Image} from 'react-native';
import codePush from 'react-native-code-push';
import {useSelector, useDispatch} from 'react-redux';
import {increment} from './src/CounterSlice';
let codePushOptions = {checkFrequency: codePush.CheckFrequency.MANUAL};
const App = () => {
const dispatch = useDispatch();
const count = useSelector(state => state.counter.value);
console.log(count);
useEffect(() => {
codePush.sync({
updateDialog: true,
installMode: codePush.InstallMode.IMMEDIATE,
});
}, []);
const onPress = () => dispatch(increment());
return (
<View
style={{
justifyContent: 'center',
alignItems: 'center',
}}>
<Image
style={{height: '100%', width: '100%'}}
resizeMode={'contain'}
source={require('./assets/owl.jpeg')}
/>
<Text style={{color: 'black', fontSize: 30}}>{count}</Text>
<TouchableOpacity style={styles.button} onPress={onPress}>
<Text>Press Here</Text>
</TouchableOpacity>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
paddingHorizontal: 10,
},
button: {
alignItems: 'center',
backgroundColor: '#DDDDDD',
padding: 10,
},
countContainer: {
alignItems: 'center',
padding: 10,
},
});
export default codePush(codePushOptions)(App);