-
Notifications
You must be signed in to change notification settings - Fork 4
/
App.js
42 lines (37 loc) · 1.07 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from 'react';
import { Text, View, Platform } from 'react-native';
import PushService from './services/PushService';
const MessageBarAlert = require('react-native-message-bar').MessageBar;
const MessageBarManager = require('react-native-message-bar').MessageBarManager;
type Props = {};
export default class App extends Component<Props> {
componentDidMount() {
if (Platform.OS === 'ios') {
PushService._iOS_initPush();
} else {
PushService._an_initPush();
}
MessageBarManager.registerMessageBar(this.refs.alert);
}
componentWillUnmount() {
if (Platform.OS === 'ios') {
PushNotificationIOS.removeEventListener('register');
}
MessageBarManager.unregisterMessageBar();
}
render() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ fontSize: 24 }}>Leancloud Push Demo</Text>
<MessageBarAlert ref="alert" />
</View>
);
}
}