Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

getExtOrDefault KotlinVersionΒ #271

@FDiskas

Description

@FDiskas

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.

Related issues: #249 #268

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-text-input-mask/android/build.gradle b/node_modules/react-native-text-input-mask/android/build.gradle
index c94f33f..ff67cac 100644
--- a/node_modules/react-native-text-input-mask/android/build.gradle
+++ b/node_modules/react-native-text-input-mask/android/build.gradle
@@ -26,8 +26,8 @@ android {
 }
 
 buildscript {
-    ext {
-        kotlinVersion = '1.4.31'
+    ext.safeExtGet = {prop, fallback ->
+        rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
     }
     repositories {
         jcenter()
@@ -36,7 +36,7 @@ buildscript {
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:4.1.3'
-        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.kotlinVersion}"
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.6.10')}"
     }
 }
 
@@ -53,5 +53,5 @@ repositories {
 dependencies {
     implementation 'com.facebook.react:react-native:+'
     implementation 'com.redmadrobot:input-mask-android:6.0.0'
-    implementation "org.jetbrains.kotlin:kotlin-stdlib:${project.ext.kotlinVersion}"
+    implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion', '1.6.10')}"
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions