Relay: error on react native 45 and react 16-alpha.12

Created on 7 Jun 2017  路  13Comments  路  Source: facebook/relay

I'm using react-relay 1.0.0
I've upgraded my react native code to RN 45, and it is throwing the following error:

image

in this line: require('./relayUnstableBatchedUpdates')

var mounted = _this3.mounted;
        if (mounted) {
          var updateProfiler = require('./RelayProfiler').profile('RelayContainer.update');
          require('./relayUnstableBatchedUpdates')(function () {
            _this3.setState(partialState, function () {
              updateProfiler.stop();
              if (isComplete) {
                completeProfiler.stop();
              }
            });
            if (callback) {
              callback.call(
              // eslint-disable-next-line react/no-string-refs
              _this3.refs.component || null, (0, _extends3['default'])({}, readyState, { mounted: mounted }));
            }
          });
        } else {

Most helpful comment

I am still using react-relay/classic, and I just upgraded react-native to v0.45.1 and I started getting the following error:

this._batchUpdate is not a function.

The same error occurs both on [email protected] and [email protected].

simulator screen shot jun 9 2017 8 55 17 pm

All 13 comments

I am still using react-relay/classic, and I just upgraded react-native to v0.45.1 and I started getting the following error:

this._batchUpdate is not a function.

The same error occurs both on [email protected] and [email protected].

simulator screen shot jun 9 2017 8 55 17 pm

Seeing this too - have you found any work-arounds?

@joonhocho I'm also getting this error, did you resolve it?

@lprhodes @juhaelee Not yet. For now, I just downgraded my react-native.

I have fixes for this in a branch that I鈥檓 updating as I go through upgrading our app. I鈥檒l move extract these to a PR later today.

Please give #1889 a try (I鈥檓 not yet done with the conversion of our app)

@spicyj helped me debug this. So relayUnstableBatchedUpdates.native.js does the following:

const ReactNative = require('ReactNative');

module.exports = ReactNative.unstable_batchedUpdates;

However, ReactNative gets mapped to react-native which, according to the react-native/package.json, is actually (and confusingly) react-native-implementation.js.

Notice that react-native-implementation.js does not currently export unstable_batchedUpdates, which means that relayUnstableBatchedUpdates is likely coming up as undefined.

@sibelius or @alloy, can you try modifying react-native-implementation.js to export unstable_batchedUpdates and see if this resolves the bug? If so, either you can send a pull request or I can make the change to export it.

Separately, we really need to rename ReactNative.js to something else (e.g. ReactNativeRenderer.js) and rename react-native-implementation.js to ReactNative.js. But that's a separate issue.

and rename react-native-implementation.js to ReactNative.js. But that's a separate issue.

To be fair, I suggested ReactNativeEverythingBagel.js.

@yungsters https://github.com/facebook/react-native/commit/5550a25628fe04899b737597fa06d9bb979b499d worked for me so far. I'm in the middle of a big upgrade, so possible I'll run into something else, but so far so good!

facebook/react-native@5550a25 works great

@yungsters Been a while, our migration was on hold. I can confirm that that patch fixes the issue 馃憤

Perfect.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johntran picture johntran  路  3Comments

rayronvictor picture rayronvictor  路  3Comments

amccloud picture amccloud  路  3Comments

MartinDawson picture MartinDawson  路  3Comments

staylor picture staylor  路  3Comments