-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
App.js
46 lines (40 loc) · 877 Bytes
/
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
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import firebase from 'react-native-firebase';
class App extends Component {
constructor(props) {
super(props);
this.state = {
token: '',
};
}
componentDidMount() {
firebase
.messaging()
.getToken()
.then((token) => {
console.log('Device FCM Token: ', token);
this.setState({ token });
});
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text selectable>{this.state.token}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
justifyContent: 'center',
alignItems: 'center',
flex: 1,
},
welcome: {
fontSize: 22,
color: 'red',
},
});
export default App;