Skip to content

Commit 392189f

Browse files
author
Richard Hua
authored
Support React Native 0.35.0 (#562)
* Upgrade example app to RN 0.35.0 * Update supported versions in README * Support RN 35 - make a copy of objects queued over the bridge if they are mutable This line was added in React Native 0.35.0: https://github.com/facebook/react-native/blob/v0.35.0/Libraries/Utilities/MessageQueue.js#L194 (facebook/react-native@145109f). It essentially deep freezes (or makes immutable) any object sent from JS to Native over the bridge. This object is already pass-by-value to begin with, so I assume the purpose of this is to avoid any ambiguity or confusion that might occur if the object is modified while it is sitting in the message queue. We do send a localPackage object over the bridge, which we modify afterwards. Because we only care about the value of this object at the moment that it is queued, the fix is to make a copy of it before sending it over the bridge. This is relevant to issue #536 (RN version support).
1 parent 3dce59f commit 392189f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Examples/CodePushDemoApp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dependencies": {
99
"babel-preset-react-native-stage-0": "1.0.1",
1010
"react": "15.3.1",
11-
"react-native": "0.34.1",
11+
"react-native": "0.35.0",
1212
"react-native-code-push": "file:../../"
1313
}
1414
}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ We try our best to maintain backwards compatability of our plugin with previous
5252
| v0.19-v0.28 | v1.7.0+ *(introduced Android asset support)* |
5353
| v0.29-v0.30 | v1.13.0+ *(RN refactored native hosting code)* |
5454
| v0.31-v0.33 | v1.14.6+ *(RN refactored native hosting code)* |
55-
| v0.34 | v1.15.0+ *(RN refactored native hosting code)* |
56-
| v0.35+ | TBD :) We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is.
55+
| v0.34-v0.35 | v1.15.0+ *(RN refactored native hosting code)* |
56+
| v0.36+ | TBD :) We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is.
5757

5858
## Supported Components
5959

package-mixins.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ module.exports = (NativeCodePush) => {
4141
const local = {
4242
async install(installMode = NativeCodePush.codePushInstallModeOnNextRestart, minimumBackgroundDuration = 0, updateInstalledCallback) {
4343
const localPackage = this;
44-
await NativeCodePush.installUpdate(this, installMode, minimumBackgroundDuration);
44+
const localPackageCopy = Object.assign({}, localPackage); // In dev mode, React Native deep freezes any object queued over the bridge
45+
await NativeCodePush.installUpdate(localPackageCopy, installMode, minimumBackgroundDuration);
4546
updateInstalledCallback && updateInstalledCallback();
4647
if (installMode == NativeCodePush.codePushInstallModeImmediate) {
4748
RestartManager.restartApp(false);

0 commit comments

Comments
 (0)