wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.05k stars 2.67k forks source link

fix(Android): Kotlin build issues with RN 0.75.3 #7913

Open siddarthkay opened 2 months ago

siddarthkay commented 2 months ago

Summary

This PR fixes the following Kotlin build issues which were discovered after I upgraded react-native to 0.75.3 and react-native-navigation to 7.40.1

> Task :react-native-navigation:compileReactNative71DebugKotlin FAILED
e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/
utils/ReactViewGroup.kt:7:59 Unresolved reference: fullBorderRadius

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/
viewcontrollers/viewcontroller/LayoutDirectionApplier.kt:11:45 Smart cast to 'ReactContext' is impossible, 
because 'instanceManager.currentReactContext' is a property that has open or custom getter

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/
viewcontrollers/viewcontroller/LayoutDirectionApplier.kt:12:45 Smart cast to 'ReactContext' is impossible, 
because 'instanceManager.currentReactContext' is a property that has open or custom getter

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:53:56 Type mismatch: inferred type is MotionEvent? 
but MotionEvent was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:53:70 Type mismatch: inferred type is EventDispatcher? 
but EventDispatcher was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:56:56 Type mismatch: inferred type is MotionEvent? 
but MotionEvent was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:56:70 Type mismatch: inferred type is EventDispatcher? 
but EventDispatcher was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:59:54 Type mismatch: inferred type is MotionEvent? 
but MotionEvent was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:59:68 Type mismatch: inferred type is EventDispatcher? 
but EventDispatcher was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:77:45 Type mismatch: inferred type is MotionEvent? 
but MotionEvent was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:77:52 Type mismatch: inferred type is EventDispatcher? 
but EventDispatcher was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:82:45 Type mismatch: inferred type is MotionEvent? 
but MotionEvent was expected

e: file:///private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/
react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/
react/modal/ModalContentLayout.kt:82:52 Type mismatch: inferred type is EventDispatcher? 
but EventDispatcher was expected

fixes: https://github.com/wix/react-native-navigation/issues/7905, https://github.com/wix/react-native-navigation/issues/7911

siddarthkay commented 2 months ago

I found 2 new errors :

> Task :react-native-navigation:compileReactNative71DebugJavaWithJavac
/private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/react-native-navigation/lib/
android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java:99: 
error: cannot find symbol
        || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {
                                                                            ^
  symbol:   variable UNSET
  location: class ReactTextShadowNode
/private/tmp/nix-build-status-mobile-build-debug-android.drv-3/node_modules/react-native-navigation/lib/
android/app/src/main/java/com/reactnativenavigation/
utils/ReactTypefaceUtils.java:104: error: cannot find symbol
        || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) {
                                                                             ^
  symbol:   variable UNSET
  location: class ReactTextShadowNode
zabojad commented 2 months ago

I've just tested it and got:

e: file:///Users/thomasfetiveau/wksp_olap/OlapRN75/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt:16:2 Missing '}
siddarthkay commented 2 months ago

@zabojad : probably you missed a } while applying this patch. I could see builds passing here without any syntax errors -> https://github.com/status-im/status-mobile/pull/21268

zabojad commented 2 months ago

hey @siddarthkay ! I've applyied the fix directly from this PR (I did not change any file manually before testing it). Also, when double checking the files of this PR, we see the missing '}' there:

Screenshot 2024-09-24 at 09 56 53

Anyway... It's not a big deal, I just wanted to tell you so that you fix your PR...

Luanluu96 commented 1 month ago

in react-native-reanimated resolved like this as border Radius is not the same with fullBorderWidth

val ReactViewGroup.borderRadius: Float
    get(){
        val uniform: LengthPercentage = (background as? CSSBackgroundDrawable)?.borderRadius?.uniform
            ?: return 0f

        return uniform.resolve(
            width.toFloat(), height.toFloat()
        )
    }
MaxMaesLW commented 1 month ago

Any chance this can get verified and merged? I've ran into this issue in a project I'm working on and am kind of blocked until this is resolved.