react-native-unistyles 2.0.0-beta.5 → 2.0.0-beta.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,11 +22,20 @@ def resolveBuildType() {
22
22
  return tskReqStr.contains('Release') ? 'release' : 'debug'
23
23
  }
24
24
 
25
+ def isNewArchitectureEnabled() {
26
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
27
+ }
28
+
29
+ if (isNewArchitectureEnabled()) {
30
+ apply plugin: 'com.facebook.react'
31
+ }
32
+
25
33
  android {
26
34
  compileSdkVersion safeExtGet('compileSdkVersion', 33)
27
35
  namespace "com.unistyles"
28
36
 
29
37
  defaultConfig {
38
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
30
39
  minSdkVersion safeExtGet('minSdkVersion', 21)
31
40
  externalNativeBuild {
32
41
  cmake {
@@ -88,7 +88,7 @@ extern "C"
88
88
  JNIEXPORT void JNICALL
89
89
  Java_com_unistyles_UnistylesModule_nativeDestroy(JNIEnv *env, jobject thiz) {
90
90
  unistylesRuntime.reset();
91
- env->DeleteGlobalRef(unistylesModule);
91
+ unistylesModule = nullptr;
92
92
  }
93
93
 
94
94
  extern "C"
@@ -80,16 +80,20 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
80
80
  System.loadLibrary("unistyles")
81
81
  val config = this.getConfig()
82
82
 
83
- this.nativeInstall(
84
- this.reactApplicationContext.javaScriptContextHolder.get(),
85
- config["width"] as Int,
86
- config["height"] as Int,
87
- config["colorScheme"] as String
88
- )
83
+ this.reactApplicationContext.javaScriptContextHolder?.let {
84
+ this.nativeInstall(
85
+ it.get(),
86
+ config["width"] as Int,
87
+ config["height"] as Int,
88
+ config["colorScheme"] as String
89
+ )
89
90
 
90
- Log.i(NAME, "Installed Unistyles \uD83E\uDD84!")
91
+ Log.i(NAME, "Installed Unistyles \uD83E\uDD84!")
91
92
 
92
- true
93
+ return true
94
+ }
95
+
96
+ false
93
97
  } catch (e: Exception) {
94
98
  false
95
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -18,5 +18,5 @@ Pod::Spec.new do |s|
18
18
  "cxx/*.{h,cpp}"
19
19
  ]
20
20
 
21
- s.dependency "React-Core"
21
+ install_modules_dependencies(s)
22
22
  end