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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type mismatch: inferred type is StateWrapper #7916

Open
1 task done
HuZinnia opened this issue Sep 19, 2024 · 5 comments
Open
1 task done

Type mismatch: inferred type is StateWrapper #7916

HuZinnia opened this issue Sep 19, 2024 · 5 comments

Comments

@HuZinnia
Copy link

HuZinnia commented Sep 19, 2024

What happened?

info A dev server is already running for this project on port 8081.
info Installing the app...

> Task :react-native-screens:compileDebugKotlin FAILED

> Task :react-native-navigation:compileReactNative71DebugKotlin FAILED
135 actionable tasks: 17 executed, 118 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 

e: file:///Users/HuZinnia/projectX/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt:47:58 Type mismatch: inferred type is StateWrapper? but StateWrapper was expected
e: file:///Users/HuZinnia/projectX/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt:7:59 Unresolved reference: fullBorderRadius
e: file:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-screens:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-navigation:compileReactNative71DebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 2s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
e: file:///Users/HuZinnia/projectX/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt:47:58 Type mismatch: inferred type is StateWrapper? but StateWrapper was expected
e: file:///Users/HuZinnia/projectX/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt:7:59 Unresolved reference: fullBorderRadius
e: file:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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:///Users/HuZinnia/projectX/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 FAILURE: Build completed with 2 failures. 1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-screens:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
============================================================================== 2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-navigation:compileReactNative71DebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

What was the expected behaviour?

No response

Was it tested on latest react-native-navigation?

  • I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

I'm using the example code provided on the official website, as shown below:

function HomeScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
    </View>
  );
}

const Stack = createNativeStackNavigator();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default App;

In what environment did this happen?

React Native Navigation version: "^7.40.1"
React Native version: "^0.75.3",
Has Fabric (React Native's new rendering system) enabled: (yes/no)
Node version: v22.8.0
Device model:
Android version:

@ertugruldogan
Copy link

ertugruldogan commented Sep 19, 2024

It seems that the library used is not React-Native-Navigation.

function HomeScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
    </View>
  );
}
const Stack = createNativeStackNavigator();
function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}
export default App;

because your code sample also belongs to the React-Navigation library that you are using :)

If it's React-Native-Navigation, look here. #7905

@Hao-yiwen
Copy link

same question.how to resolve?

@BogdanRad
Copy link

@Hao-yiwen did you find the solution? I have same problem :(

@WKampel
Copy link

WKampel commented Oct 8, 2024

Same issue

@prodevuk
Copy link

Upgrade to the latest version of react native screens. This resolved my issue.

"react-native-screens": "^3.34.0"

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

No branches or pull requests

6 participants