-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
93 lines (88 loc) · 1.94 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
*
* Home screen for Screeb demo react native app
*
* @author [email protected]
*/
import React from 'react';
import type {Node} from 'react';
import {
SafeAreaView,
StatusBar,
StyleSheet,
Text,
Button,
View,
NativeModules
} from 'react-native';
const { ScreebModule } = NativeModules;
const App: () => Node = () => {
const onSetIdentity = () => {
ScreebModule.setIdentity('ReactNativeUserId', null);
};
const onTrackEvent = () => {
ScreebModule.trackEvent('ReactNativeEventId', null);
};
const onTrackScreen = () => {
ScreebModule.trackScreen('ReactNativeScreen', null);
};
const onSetVisitorProperties = () => {
ScreebModule.setProperties(
{
'age': 10,
'isReactNative': true,
'name': 'React name',
'price': 65.7
}
);
};
return (
<SafeAreaView style={styles.sectionContainer}>
<StatusBar />
<Text style={styles.sectionTitle}>Screeb demo app</Text>
<Button
style={styles.sectionButton}
title="Set identity"
onPress={onSetIdentity}
/>
<View style={styles.space} />
<Button
style={styles.sectionButton}
title="Track event"
onPress={onTrackEvent}
/>
<View style={styles.space} />
<Button
style={styles.sectionButton}
title="Track screen"
onPress={onTrackScreen}
/>
<View style={styles.space} />
<Button
style={styles.sectionButton}
title="Set visitor properties"
onPress={onSetVisitorProperties}
/>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
sectionContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
sectionButton: {
padding: 30,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
marginBottom: 32,
},
space: {
width: 20,
height: 20,
},
});
export default App;