Merge pull request #523 from realm/al-rn-29

Support latest react-native version
This commit is contained in:
Ari Lazier 2016-08-02 09:59:57 -07:00 committed by GitHub
commit 1522fb3689
10 changed files with 64 additions and 52 deletions

View File

@ -1,13 +1,15 @@
x.x.x Release notes (yyyy-MM-dd)
0.14.2 Release notes (2016-7-11)
=============================================================
### Breaking changes
* Please use `rnpm 1.9.0` or later to link your project. Older versions are no longer supported.
* ReactNative versions older than v0.14.0 are no longer supported
### Enhancements
* Support for ReactNative versions v0.28.0+
* Added support for debugging in Visual Studio Code.
### Bugfixes
* None
* Fix linker error when building for minimum target version of iOS 7.
0.14.1 Release notes (2016-6-28)
=============================================================

View File

@ -6,8 +6,8 @@
"start": "react-native start"
},
"dependencies": {
"react": "15.1.0",
"react-native": "^0.27.1",
"react": "~15.2.0",
"react-native": "^0.29.0",
"realm": "file:../.."
}
}

View File

@ -1,7 +1,7 @@
{
"name": "realm",
"description": "Realm is a mobile database: an alternative to SQLite and key-value stores",
"version": "0.14.1",
"version": "0.14.2",
"license": "Apache-2.0",
"homepage": "https://realm.io",
"keywords": [

View File

@ -12,6 +12,7 @@ APP_CPPFLAGS := -std=c++14
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DREALM_HAVE_CONFIG
APP_CPPFLAGS += -fomit-frame-pointer
# Make sure every shared lib includes a .note.gnu.build-id header
APP_LDFLAGS := -Wl,--build-id

View File

@ -42,7 +42,8 @@ using namespace realm::rpc;
#endif
@interface NSObject ()
- (instancetype)initWithJSContext:(void *)context;
- (instancetype)initWithJSContext:(JSContext *)context;
- (instancetype)initWithJSContext:(JSContext *)context onThread:(NSThread *)thread;
- (JSGlobalContextRef)ctx;
@end
@ -55,17 +56,14 @@ extern "C" JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executo
id rctJSContext = object_getIvar(executor, contextIvar);
if (!rctJSContext && create) {
Class RCTJavaScriptContext = NSClassFromString(@"RCTJavaScriptContext");
NSMethodSignature *signature = [RCTJavaScriptContext instanceMethodSignatureForSelector:@selector(initWithJSContext:)];
assert(signature);
// React Native 0.14+ expects a JSContext here, but we also support 0.13.x, which takes a JSGlobalContextRef.
if (!strcmp([signature getArgumentTypeAtIndex:2], "@")) {
JSContext *context = [[JSContext alloc] init];
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:(void *)context];
if ([RCTJavaScriptContext instancesRespondToSelector:@selector(initWithJSContext:onThread:)]) {
// for RN 0.28.0+
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new] onThread:[NSThread currentThread]];
}
else {
JSGlobalContextRef ctx = JSGlobalContextCreate(NULL);
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:ctx];
// for RN < 0.28.0
assert([RCTJavaScriptContext instancesRespondToSelector:@selector(initWithJSContext:)]);
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new]];
}
object_setIvar(executor, contextIvar, rctJSContext);
@ -301,7 +299,7 @@ RCT_REMAP_METHOD(emit, emitEvent:(NSString *)eventName withObject:(id)object) {
// Close all cached Realms from the previous JS thread.
realm::_impl::RealmCoordinator::clear_all_caches();
JSGlobalContextRef ctx = RealmReactGetJSGlobalContextForExecutor(executor, true);
RJSInitializeInContext(ctx);
}];

View File

@ -924,7 +924,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.14.1;
CURRENT_PROJECT_VERSION = 0.14.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -985,7 +985,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.14.1;
CURRENT_PROJECT_VERSION = 0.14.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -1059,7 +1059,7 @@
buildSettings = {
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 0.14.1;
DYLIB_CURRENT_VERSION = 0.14.2;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"REALM_PLATFORM_NODE=1",
@ -1093,7 +1093,7 @@
isa = XCBuildConfiguration;
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 0.14.1;
DYLIB_CURRENT_VERSION = 0.14.2;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"REALM_PLATFORM_NODE=1",

View File

@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"

View File

@ -1,14 +1,6 @@
package io.realm.react.testapp;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
import com.rnfs.RNFSPackage;
import io.realm.react.RealmReactPackage;
public class MainActivity extends ReactActivity {
@ -20,26 +12,4 @@ public class MainActivity extends ReactActivity {
protected String getMainComponentName() {
return "ReactTests";
}
/**
* Returns whether dev mode should be enabled.
* This enables e.g. the dev menu.
*/
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNFSPackage(),
new RealmReactPackage()
);
}
}

View File

@ -0,0 +1,40 @@
package io.realm.react.testapp;
import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
import com.rnfs.RNFSPackage;
import io.realm.react.RealmReactPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNFSPackage(),
new RealmReactPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}

View File

@ -6,8 +6,8 @@
"start": "react-native start"
},
"dependencies": {
"react": "15.1.0",
"react-native": "^0.27.1",
"react": "~15.2.0",
"react-native": "^0.29.0",
"react-native-fs": "^1.1.0",
"xmlbuilder": "^4.2.1",
"realm": "file:../..",