/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow * @providesModule PushNotificationIOSExample */ 'use strict'; var React = require('react'); var ReactNative = require('react-native'); var { AlertIOS, PushNotificationIOS, StyleSheet, Text, TouchableHighlight, View, } = ReactNative; class Button extends React.Component { render() { return ( {this.props.label} ); } } class NotificationExample extends React.Component { componentWillMount() { PushNotificationIOS.addEventListener('register', this._onRegistered); PushNotificationIOS.addEventListener('registrationError', this._onRegistrationError); PushNotificationIOS.addEventListener('notification', this._onRemoteNotification); PushNotificationIOS.addEventListener('localNotification', this._onLocalNotification); PushNotificationIOS.requestPermissions(); } componentWillUnmount() { PushNotificationIOS.removeEventListener('register', this._onRegistered); PushNotificationIOS.removeEventListener('registrationError', this._onRegistrationError); PushNotificationIOS.removeEventListener('notification', this._onRemoteNotification); PushNotificationIOS.removeEventListener('localNotification', this._onLocalNotification); } render() { return (