diff --git a/Modules/@babylonjs/react-native/package.json b/Modules/@babylonjs/react-native/package.json index 71d6c584f..7db725bf9 100644 --- a/Modules/@babylonjs/react-native/package.json +++ b/Modules/@babylonjs/react-native/package.json @@ -29,8 +29,8 @@ }, "peerDependencies": { "@babylonjs/core": "^5.0.0-alpha.34", - "react": "^16.13.1", - "react-native": "^0.63.1", + "react": ">=16.13.1", + "react-native": ">=0.63.1", "react-native-permissions": "^2.1.4" }, "devDependencies": { diff --git a/Package/Android/build.gradle b/Package/Android/build.gradle index 3c0efffdd..5cecb9427 100644 --- a/Package/Android/build.gradle +++ b/Package/Android/build.gradle @@ -19,6 +19,10 @@ def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } +def reactProperties = new Properties() +file("$projectDir/../../../react-native/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) } +def REACT_VERSION = reactProperties.getProperty("VERSION_NAME").split("\\.")[1].toInteger() + apply plugin: 'com.android.library' apply plugin: 'maven' @@ -59,6 +63,14 @@ android { } } +// The full/real version of libturbomodulejsijni.so will be built and included in apps using React Native 0.64 or newer, +// so exclude Babylon React Native's minimal version of these libs in this case. +if (REACT_VERSION >= 64) { + android.packagingOptions.excludes += 'lib/armeabi-v7a/libturbomodulejsijni.so' + android.packagingOptions.excludes += 'lib/arm64-v8a/libturbomodulejsijni.so' + android.packagingOptions.excludes += 'lib/x86/libturbomodulejsijni.so' +} + repositories { // ref: https://www.baeldung.com/maven-local-repository mavenLocal()