Realm-js: RN 0.46 - Realm has no setter or ivar for it's bridge

Created on 6 Jul 2017  路  9Comments  路  Source: realm/realm-js

When I am using non remote js debug mode, I am getting

image

Version of Realm and Tooling

  • Realm JS SDK Version: 1.8.3
  • Node or React Native: 0.46.0
  • Client OS & Version: iOS

There was similar error but for 0.45 https://github.com/realm/realm-js/issues/1049

T-Bug

Most helpful comment

If you're going to be using private API's (which is not supported, and will likely break again in future releases), use dispatchBlock:block queue:RCTJSThread, which is implemented in both the old and the new bridge (and works on older releases too)

All 9 comments

JS Exception after calling executeBlockOnJavaScriptThread on bridge

image

I have the same error with disabled JS debug. When js debug is on - the error is not there. (in my case it is 0.46.0rc2

+1

Yeap, It's exception

image

image

So, I started to use ensureOnJavaScriptThread, going to prepare PR

@javache Hey bro! You introduced changes inside react-native repository https://github.com/facebook/react-native/commit/8525aac769a08ca63fd932ac19c6bbbee81d39fb#diff-a2a67635fffd7b690d14dc17ae563a71

So, main question can you give a good advice how to check method exists compatiblity for RN 0.46+

Currently, inside https://github.com/ovr/realm-js/commit/71614726c110512499a4244eef0b14f7b439afb6

I am using

        Class RCTCxxBridgeClass = NSClassFromString(@"RCTCxxBridge");
        if ([RCTCxxBridgeClass instancesRespondToSelector:@selector(ensureOnJavaScriptThread:)]) {
            [bridge ensureOnJavaScriptThread:bridgeInitializer];
        } else {
            [bridge executeBlockOnJavaScriptThread:bridgeInitializer];
        }

Thank you 馃嵑 馃嵒

If you're going to be using private API's (which is not supported, and will likely break again in future releases), use dispatchBlock:block queue:RCTJSThread, which is implemented in both the old and the new bridge (and works on older releases too)

@javache Thank you

Fixed in #1122

Was this page helpful?
0 / 5 - 0 ratings