星技传阅
  • 49W+

    人气

  • 104

    文章

  • 2

    评论

  • 15

    点赞

  • 原创 56
  • 翻译 0
  • 转载 48

分享:

独孤环宇 

分享到朋友圈

这个家伙比较懒,还没有个人介绍

  • 入住博客:2017-05-22 3.7年
最新评论
winning14:通俗易懂,赞!
风云坤:import React, { Component } from 'react';|@|import {|@| AppRegistry,|@| BackAndroid,|@| StyleSheet,|@| Text,|@| View|@|} from 'react-native';|@|import JPushModule from 'jpush-react-native';|@||@|export default class xuexi6 extends Component {|@||@| constructor(props) {|@|   super(props);|@||@|   this.state = {|@|     bg: '#ffffff',|@|     appkey: 'AppKey',|@|     imei: 'IMEI',|@|     package: 'PackageName',|@|     deviceId: 'DeviceId',|@|     version: 'Version',|@|     pushMsg: 'PushMessage',|@|     registrationId: 'registrationId',|@|   };|@|   |@| }|@||@| componentDidMount() {|@|   JPushModule.getInfo((map) => {|@|     this.setState({|@|     appkey: map.myAppKey,|@|     imei: map.myImei,|@|     package: map.myPackageName,|@|     deviceId: map.myDeviceId,|@|     version: map.myVersion|@|     });|@|   });|@|   JPushModule.notifyJSDidLoad((resultCode) => {|@|     if (resultCode === 0) {|@|     }|@|   });|@|   JPushModule.addReceiveCustomMsgListener((map) => {|@|     this.setState({|@|     pushMsg: map.message|@|     });|@|     console.log("extras: " + map.extras);|@|   });|@|   JPushModule.addReceiveNotificationListener((map) => {|@|     console.log("alertContent: " + map.alertContent);|@|     console.log("extras: " + map.extras);|@|     // var extra = JSON.parse(map.extras);|@|     // console.log(extra.key + ": " + extra.value);|@|   });|@|   JPushModule.addReceiveOpenNotificationListener((map) => {|@|     console.log("Opening notification!");|@|     console.log("map.extra: " + map.extras);|@|     //JPushModule.jumpToPushActivity("SecondActivity");|@|   });|@|   JPushModule.addGetRegistrationIdListener((registrationId) => {|@|     console.log("Device register succeed, registrationId " + registrationId);|@|   });|@| }|@||@| componentWillUnmount() {|@|   JPushModule.removeReceiveCustomMsgListener(receiveCustomMsgEvent);|@|   JPushModule.removeReceiveNotificationListener(receiveNotificationEvent);|@|   JPushModule.removeReceiveOpenNotificationListener(openNotificationEvent);|@|   JPushModule.removeGetRegistrationIdListener(getRegistrationIdEvent);|@|   console.log("Will clear all notifications");|@|   JPushModule.clearAllNotifications();|@| }|@||@| render() {|@|   return (|@|     <View style={styles.container}>|@|     <Text style={styles.welcome}>|@|       Welcome to React Native!dddddddddddddddd|@|     </Text>|@|     <Text style={styles.instructions}>|@|       To get started, edit index.android.js|@|     </Text>|@|     <Text style={styles.instructions}>|@|       Double tap R on your keyboard to reload,{'\n'}|@|       Shake or press menu button for dev menu|@|     </Text>|@|     </View>|@|   );|@| }|@|}|@||@|const styles = StyleSheet.create({|@| container: {|@|   flex: 1,|@|   justifyContent: 'center',|@|   alignItems: 'center',|@|   backgroundColor: '#F5FCFF',|@| },|@| welcome: {|@|   fontSize: 20,|@|   textAlign: 'center',|@|   margin: 10,|@| },|@| instructions: {|@|   textAlign: 'center',|@|   color: '#333333',|@|   marginBottom: 5,|@| },|@|});|@||@|AppRegistry.registerComponent('xuexi6', () => xuexi6);
写文章