MainScreen.js 2.28 KB
import React, { Component, Notifications } from 'react';
import { StyleSheet, Text, View, TextInput, Image, } from 'react-native';

export default class Login extends Component {

    constructor(props) {
        super(props);
        this.state = {
            ID: this.props.navigation.getParam('ID'),
        };
    }
    static navigationOptions = {
        title: 'MainScreen',
    };

    render() {
        return (
            <View style={styles.container}>
                <View style={styles.header}>
                    <Text>{this.state.ID}</Text>
                </View>
            </View>
        );
    }
}

var PushNotification = require('react-native-push-notification');

PushNotification.configure({

    // (optional) Called when Token is generated (iOS and Android)
    onRegister: function(token) {
        console.log( 'TOKEN:', token );
    },

    // (required) Called when a remote or local notification is opened or received
    onNotification: function(notification) {
        console.log( 'NOTIFICATION:', notification );
    },

    // ANDROID ONLY: GCM Sender ID (optional - not required for local notifications, but is need to receive remote push notifications) 
    senderID: "YOUR GCM SENDER ID",

    // IOS ONLY (optional): default: all - Permissions to register.
    permissions: {
        alert: true,
        badge: true,
        sound: true
    },

    // Should the initial notification be popped automatically
    // default: true
    popInitialNotification: true,

    /**
      * (optional) default: true
      * - Specified if permissions (ios) and token (android and ios) will requested or not,
      * - if not, you must call PushNotificationsHandler.requestPermissions() later
      */
    requestPermissions: true,
});

const styles = StyleSheet.create({
    input: {
        height: 50,
        width: 250,
        fontSize: 0,
        alignSelf: 'center',
        borderRadius: 1,
        borderStyle: 'dotted',
        borderBottomColor: "#0066cc",
        borderBottomWidth: 2,
    },
    container: {
        flex: 1,
        backgroundColor: 'white',
    },
    header: {
        flex: 2,
        backgroundColor: 'white',
    },
    logo: {
        flex: 4,
        backgroundColor: 'white',
    },
    inputPart: {
        flex: 4,
        backgroundColor: 'white',
    },
});