Aimport {DeviceEventEmitter} from 'react-native';//注册这个监听事件componentDidMount(){ DeviceEventEmitter.addListener('xxxName’, Function);};//在组件销毁的时候要将其移除componentWillUnmount(){ DeviceEventEmitter.remove();};B
1 import {2 DeviceEventEmitter3 } from 'react-native';4 5 //调用事件通知 param是指传递的相应参数6 DeviceEventEmitter.emit('xxxName’,param);转http://www.cnblogs.com/huangjialin/p/6170009.html
新闻热点
疑难解答