Mobile SDK Native Modules for React Native Apps
Mobile SDK provides native modules for React Native that serve as JavaScript bridges to native Mobile SDK functionality.
The OAuth bridge is similar to the OAuth plugin for Cordova.
See react.force.oauth.ts in the SalesforceMobileSDK-ReactNative GitHub repo.
The Network bridge is similar to the force.js library for hybrid apps.
See react.force.net.ts in the SalesforceMobileSDK-ReactNative GitHub repo.
The net module (also exported as forceClient) adds five methods that wrap the Salesforce Collections API and operate on up to 2,000 records per call:
| Method | Description |
|---|---|
collectionCreate(objectType, records, successCB, errorCB) | Create up to 2,000 records in a single request. |
collectionUpdate(objectType, records, successCB, errorCB) | Update up to 2,000 records in a single request. |
collectionUpsert(objectType, records, successCB, errorCB) | Upsert up to 2,000 records in a single request. |
collectionRetrieve(objectType, ids, fields, successCB, errorCB) | Retrieve up to 2,000 records by ID, optionally limiting to specific fields. |
collectionDelete(objectType, ids, successCB, errorCB) | Delete up to 2,000 records in a single request. |
The SmartStore bridge is similar to the SmartStore plugin for Cordova. Unlike the plugin, however, first arguments aren’t optional in React Native.
See react.force.smartstore.ts in the SalesforceMobileSDK-ReactNative GitHub repo.
The Mobile Sync bridge is similar to the Mobile Sync plugin for Cordova. Unlike the plugin, however, first arguments aren’t optional in React Native.
See react.force.mobilesync.ts in the SalesforceMobileSDK-ReactNative GitHub repo.
| Method | Description |
|---|---|
resetSyncManager(storeConfig, successCB, errorCB) | Reset the sync manager by removing all shared instances. Useful for test isolation between test cases. |