发送
DeviceEventEmitter.emit(‘updatePlantList‘, ‘创建工厂成功‘);//通知刷新工厂列表
接受
componentDidMount() { this.fetch(); this.subscription = DeviceEventEmitter.addListener(‘userNameDidChange‘, (userName) => { // alert(‘通知‘); this.fetch(); }); }; componentWillUnmount() { this.subscription.remove(); }; componentWillMount() { this.fetch(); };
原文:https://www.cnblogs.com/gloryhope/p/12712924.html