react-native
react-native copied to clipboard
Type mismatch: inferred type is ScalingUtils.ScaleType? but ScalingUtils.ScaleType was expected
Description
Hey,
Trying to build my android project into an APK but getting this error: Type mismatch: inferred type is ScalingUtils.ScaleType? but ScalingUtils.ScaleType was expected
Version
18.0.0
Output of npx react-native info
System:
OS: macOS 12.3.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 37.08 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.9.0 - /usr/local/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 8.5.5 - /usr/local/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.3/13E113 - /usr/bin/xcodebuild
Languages:
Java: 11.0.14 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
None so far.
Snack, code example, screenshot, or link to a repository
override fun create(options: SharedElementTransitionOptions): Animator {
with(to as ReactImageView) {
hierarchy.actualImageScaleType = InterpolatingScaleType(
getScaleType(from),
getScaleType(to),
calculateBounds(from),
calculateBounds(to)
)
return ObjectAnimator.ofObject(TypeEvaluator<Float> { fraction: Float, _: Any, _: Any ->
hierarchy.actualImageScaleType?.let {
(hierarchy.actualImageScaleType as InterpolatingScaleType?)!!.value = fraction
to.invalidate()
}
null
}, 0, 1).setDuration(options.getDuration())
}
}
18.0.0
This is not a react-native version. Please update your issue description
I also have the same problem
Please help me!!
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 e: D:\dev\ReactNative\app_mobile_eu-source_new_110522\node_modules\react-native-navigation\lib\android\app\src\main\java\com\reactnativenavigation\views\element\animators\MatrixAnimator.kt: (21, 21): Type mismatch: inferred type is ScalingUtils.ScaleType? but ScalingUtils.ScaleType was expected e: D:\dev\ReactNative\app_mobile_eu-source_new_110522\node_modules\react-native-navigation\lib\android\app\src\main\java\com\reactnativenavigation\views\element\animators\MatrixAnimator.kt: (22, 21): Type mismatch: inferred type is ScalingUtils.ScaleType? but ScalingUtils.ScaleType was expected
react-native info
System: OS: Windows 10 10.0.19043 CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400 @ 2.60GHz
Memory: 2.60 GB / 15.81 GB Binaries: Node: 17.9.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 8.5.5 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8309675 Visual Studio: Not Found Languages: Java: 1.8.0_211 - C:\Program Files\Java\jdk1.8.0_211\bin\javac.EXE npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: ^0.68.2 => 0.68.2 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found
Thanks!!!
As a temporary workaround, you can delete the question mark at line 53 and 57 of the "node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageMatrixAnimator.kt"
Any body fix it?
I am facing the same issue here.
same issue on react 0.63.3
same issue on 0.64.1
Hey. I've got the same issue.
Nothing changed in the project before the last successful build. After few weeks when I tried to build the app, During building I've got error that I had to change kotlinVersion. After upgrade from 1.3.72 to 1.6.21 in build.gradle I have this issue.
react-native 0.63.
Okay, I found the solution for me, maybe it will also fix your issues.
The problem was related to issue fixed here https://github.com/facebook/react-native/issues/35210#issue-1436785719
Just try to install patch for your version. I reverted everything to the state I left the app when it worked and successfully build. So no changes with kotlinVersion and minSdkVersion were required with that fix.
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.
This issue was closed because the author hasn't provided the requested feedback after 7 days.