try to initialize JSContexts
This commit is contained in:
parent
8965aa80f7
commit
4270bc2b0f
|
@ -17,6 +17,7 @@ public class RealmReactAndroid extends ReactContextBaseJavaModule {
|
|||
public RealmReactAndroid(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
ReLinker.loadLibrary(reactContext, "realmreact");
|
||||
getDefaultRealmFileDirectory();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,17 +32,23 @@ LOCAL_SRC_FILES := \
|
|||
src/object-store/impl/transact_log_handler.cpp \
|
||||
vendor/base64.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := src/object-store
|
||||
LOCAL_C_INCLUDES := src
|
||||
LOCAL_C_INCLUDES += src/object-store
|
||||
LOCAL_C_INCLUDES += src/object-store/parser
|
||||
LOCAL_C_INCLUDES += vendor
|
||||
LOCAL_C_INCLUDES += vendor/PEGTL
|
||||
LOCAL_C_INCLUDES += ../../../../../../../../react-native/ReactAndroid/src/main/jni/react
|
||||
LOCAL_C_INCLUDES += ../../../../../../../../react-native/ReactAndroid/src/main/jni/first-party
|
||||
LOCAL_C_INCLUDES += ../../../../../../../../react-native/ReactAndroid/src/main/jni/first-party/fb/include
|
||||
LOCAL_C_INCLUDES += $(JAVA_HOME)/include
|
||||
LOCAL_C_INCLUDES += $(JAVA_HOME)/include/darwin
|
||||
LOCAL_C_INCLUDES += core/include
|
||||
|
||||
CXX11_FLAGS := -std=c++14
|
||||
LOCAL_CFLAGS += -fexceptions $(CXX11_FLAGS) -frtti
|
||||
LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS)
|
||||
|
||||
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
|
||||
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog /Users/ari/src/realm/realm-js/react-native/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.16.1/jni/$(TARGET_ARCH_ABI)/libreactnativejni.so
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := realm-android-$(TARGET_ARCH_ABI)
|
||||
LOCAL_SHARED_LIBRARIES := libjsc
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
|
||||
#include "com_reacttests_RealmReactAndroid.h"
|
||||
#include "JSCExecutor.h"
|
||||
#include "js_init.h"
|
||||
#include <unordered_map>
|
||||
|
||||
extern std::unordered_map<JSContextRef, facebook::react::JSCExecutor*> s_globalContextRefToJSCExecutor;
|
||||
|
||||
/*
|
||||
* Class: com_reacttests_RealmReactAndroid
|
||||
* Method: getDefaultRealmFileDirectory
|
||||
|
@ -12,7 +18,9 @@
|
|||
JNIEXPORT jstring JNICALL Java_com_reacttests_RealmReactAndroid_getDefaultRealmFileDirectory
|
||||
(JNIEnv *env, jclass)
|
||||
{
|
||||
|
||||
return env->NewStringUTF("Hello from JNI ! ");
|
||||
for (auto pair : s_globalContextRefToJSCExecutor) {
|
||||
RJSInitializeInContext(pair.first);
|
||||
}
|
||||
return env->NewStringUTF("Hello from JNI ! ");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue