You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exported methods from a native module will reuse the same instance of RCTPromiseResolveBlock for every method defined in the module. Calling asynchronous methods at the same time will fail because RN only allows callbacks to be called once.
RCT_EXPORT_METHOD(foo:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter) {
// resolver to be called later on.
}
RCT_EXPORT_METHOD(bar:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter) {
// resolver to be called later on.
}
Illegal callback invocation from native module.
This callback type only permits a single invocation from native code.
Debugging the app show the same instance of RCTPromiseResolveBlock is used in both calls. Is this expected?
Expected Behavior
Sequential async methods calls from a react native module should work. A new RCTPromiseResolveBlock instance should be created for every function call.
Actual Behavior
RCTPromiseResolveBlock instance is reused, not allowing more than one async function call at a time.
The text was updated successfully, but these errors were encountered:
Is this a bug report?
yes
Have you read the Contributing Guidelines?
yes
Environment
react-native -v
: 0.41node -v
: v6.9.5npm -v
: 4.6.1Steps to Reproduce
Exported methods from a native module will reuse the same instance of RCTPromiseResolveBlock for every method defined in the module. Calling asynchronous methods at the same time will fail because RN only allows callbacks to be called once.
If we call those methods at the same time:
We then get this RN error:
Debugging the app show the same instance of RCTPromiseResolveBlock is used in both calls. Is this expected?
Expected Behavior
Sequential async methods calls from a react native module should work. A new RCTPromiseResolveBlock instance should be created for every function call.
Actual Behavior
RCTPromiseResolveBlock instance is reused, not allowing more than one async function call at a time.
The text was updated successfully, but these errors were encountered: