简体   繁体   中英

React Native Android / iOS call function on app start

I am new to React Native.

I am trying to call a react native method from native code without having any UI components from RN.

The idea is to add a DeviceEmitter listener at application start and later on post events from Native code.

The question is where should I put JS code to add DeviceEmitter listener at app start?

https://facebook.github.io/react-native/docs/0.44/appregistry#registerheadlesstask

AppRegistry.registerHeadlessTask is probably where you should start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM