-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
W/unknown:ReactNative: Calling JS function after bridge has been destroyed #18
Comments
Why do you need to restart app? Try to close serial port and open a new one.
|
Thanks for the Comments. The reason why we restart the app is that there is some critical parameters that allowed for the user to config and save to local storage, not only including the baudrate, parity but also some other User Business logic related paramters that we need to make sure these parameters are saved correctly. |
Try reinstall with
|
Unfortunately, same behavior as before using this fix-eventEmitter-cache branch code. |
The react-native-serial-port-api works well from start of the react native app, but when restart the app from RNRestart Libiary or DevSettings.reload() method, the react-native-serial-port-api seems have some issues, see below scenario:
1 Start APP--react-native-serial-port-api, send and receive OK, the "dataReceived" event is triggered on the java script side
2 Reload the APP using RNRestart Libiary(https://github.com/avishayil/react-native-restart) or using DevSetting.reload() or just "r" from the console. the first time when react-native-serial-port-api can send out the Data out, and from Physical Layer there is data response back, but the "dataReceived" event is not triggered on the java script side, from the second time send out the data, the react-native-serial-port-api works normal on send and receive.
3 see below logs from Android Studio:
2021-08-29 19:59:25.537 30148-30362/com.inst.hct802h I/serialport: send: 550500000002aa
2021-08-29 19:59:26.045 30148-30326/com.inst.hct802h W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTDeviceEventEmitter.emit(["dataReceived",{"data":"FFFFFFFFFFFF0600180042FE174005070108009B0837050401260200101701"}])
4 by Search the google, seems above behavior might be the context is destroyed when RNRestart or DevSetting.reload, and the react-native-serial-port-api is using the old old react context before restart or reload.
5 see reference saying it might be triggered by the the RCTDeviceEventEmitter module trying to send a message to javascript.
https://stackoverflow.com/questions/45972220/react-calling-js-function-after-bridge-has-been-destroyed-how-to-find-which
Help Needed: are there any thoughts that we can workaroud of this behavior from the react-native-serial-port-api libiary or the RN side?
The text was updated successfully, but these errors were encountered: