「产品更新」jpush-react-native v1.6.6 发布

react-native
标签: #<Tag:0x00007fb82d95fd48>

(KenChoi) #1

jpush-react-native v1.6.6

更新日志

  • Android
    增加一个新的接口:JPushModule.notifyJSDidLoad();
    使用方法:在你想要接收通知类事件之前调用:
componentDidMount() {
		JPushModule.notifyJSDidLoad();
		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.key);
		});
		JPushModule.addGetRegistrationIdListener((registrationId) => {
			console.log("Device register succeed, registrationId " + registrationId);
		});
	}

Change Log

  • Android
    Add new API: JPushModule.notifyJSDidLoad();
    Usage: before you add listeners call this method first:
componentDidMount() {
		JPushModule.notifyJSDidLoad();
		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.key);
		});
		JPushModule.addGetRegistrationIdListener((registrationId) => {
			console.log("Device register succeed, registrationId " + registrationId);
		});
	}

(泡泡oO水流) #2

问下,为什么这个方法是undefined, TypeError: Cannot read property ‘notifyJSDidLoad’ of undefined