-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
37 lines (33 loc) · 974 Bytes
/
App.tsx
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
import { useEffect, useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import MParticle from 'react-native-mparticle';
export default function App() {
const [session, setSession] = useState<any>({});
const [attributes, setAttributes] = useState<any>({
value: 'no attributionResults',
});
useEffect(() => {
MParticle.getSession(sessionId => {
setSession(sessionId);
});
MParticle.getAttributions(attr => {
setAttributes(attr);
});
}, []);
return (
<View style={styles.container}>
<Text style={{ fontWeight: "bold" }}>Session ID</Text>
<Text>{JSON.stringify(session, null, 2)}</Text>
<Text style={{ fontWeight: "bold" }}>User Attributes</Text>
<Text>{JSON.stringify(attributes, null, 2)}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});