react-native-orientation
react-native-orientation copied to clipboard
Fix compileSdkVersion and buildToolsVersion
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-orientation/android/build.gradle b/node_modules/react-native-orientation/android/build.gradle
index e09fb27..cd346bd 100644
--- a/node_modules/react-native-orientation/android/build.gradle
+++ b/node_modules/react-native-orientation/android/build.gradle
@@ -1,8 +1,12 @@
+def safeExtGet(prop, fallback) {
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
+}
+
apply plugin: 'com.android.library'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ compileSdkVersion safeExtGet('compileSdkVersion', 23)
+ buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1")
defaultConfig {
minSdkVersion 16
I have a better solution
rootProject/android/build.gradle
subprojects {
afterEvaluate {subProject ->
if (subProject.hasProperty("android")) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}