I’ve been working with React Native’s new architecture in combination with the Salesforce Mobile SDK and noticed an interesting behavior in the development branch,
The React Native index file initialises before the Salesforce login flow completes.
Since index.js is already initialised, it executes the following call:
oauth.getAuthCredentials(
(data) => {
console.log("getAuthCredentials data", data);
},
(error) => {
console.log("getAuthCredentials error", error);
}
);
At this point, because the login flow hasn’t finished yet, the call falls into the error block. If I proceed with login afterward, the index file is not triggered again, so React Native is unaware that the login completed successfully.
When investigating further, I noticed a difference between the development branch and the master branch of the SDK:
In the development branch, createReactActivityDelegate uses the default React Native delegate with Fabric enabled:
override fun createReactActivityDelegate() =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
In the master branch, createReactActivityDelegate uses SalesforceReactActivityDelegate, which prevents the index file from being re-triggered after login.
I’ve been working with React Native’s new architecture in combination with the Salesforce Mobile SDK and noticed an interesting behavior in the development branch,
The React Native index file initialises before the Salesforce login flow completes.
Since index.js is already initialised, it executes the following call:
At this point, because the login flow hasn’t finished yet, the call falls into the error block. If I proceed with login afterward, the index file is not triggered again, so React Native is unaware that the login completed successfully.
When investigating further, I noticed a difference between the development branch and the master branch of the SDK:
In the development branch, createReactActivityDelegate uses the default React Native delegate with Fabric enabled:
In the master branch, createReactActivityDelegate uses SalesforceReactActivityDelegate, which prevents the index file from being re-triggered after login.