Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

getExtOrDefault KotlinVersion #271

Open
FDiskas opened this issue Jul 14, 2022 · 5 comments
Open

getExtOrDefault KotlinVersion #271

FDiskas opened this issue Jul 14, 2022 · 5 comments

Comments

@FDiskas
Copy link

FDiskas commented Jul 14, 2022

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')}"
 }
@hypesol
Copy link

hypesol commented Jul 18, 2022

Not working for me

@FDiskas
Copy link
Author

FDiskas commented Jul 18, 2022

You should try cd ios && rm -rf Pods && pod install

@lucaspmv
Copy link

Thank you! it worked for me, only had to change the classpath 'com.android.tools.build:gradle:4.1.3' to classpath 'com.android.tools.build:gradle:7.1.1' too.

@relez
Copy link

relez commented Aug 16, 2022

Hi guys, I am having the same issue with react-native-text-input-mask plugin, but its the first time I will use patch-package. How can I fix the issue using patch-package? Thanks!

@FDiskas
Copy link
Author

FDiskas commented Aug 16, 2022

I would suggest you first change anything (no matter what) in node modules and then run patch-package "package-name"
This will create a file in the root directory, then open that file and paste the code posted in this issue and then clean node modules and install it again.

For sure read a documentation in patch-package repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants