Skip to content

Gesture handler version 2.17.0 showing view error with react-native version 0.75.0 || Type mismatch: inferred type is View? but View was expected #3618

@Shubhendra8449

Description

@Shubhendra8449

Description

react-native-gesture-handler fails to compile on Android with Kotlin DSL using React Native 0.75.5 due to an unsafe use of a nullable View.

exact error:-
e: file:///D:/LPA_New/bsl_lpa/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt:14:45 Type mismatch: inferred type is View? but View was expected

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction

location & code :-

class RNGestureHandlerTouchEvent private constructor() : Event() {
private var extraData: WritableMap? = null
private var coalescingKey: Short = 0
private fun <T : GestureHandler> init(handler: T) {
super.init(UIManagerHelper.getSurfaceId(handler.view), handler.view!!.id)
extraData = createEventData(handler)
coalescingKey = handler.eventCoalescingKey
}

Steps to reproduce

react-native version - "react-native": "^0.75.5",
"react-native-gesture-handler": "^2.17.0",
it will trigger on gradle building.

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

react-native-gesture-handler/packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react

Gesture Handler version

2.17.0

React Native version

0.75.0

Platforms

Android

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

None

Build type

Debug mode

Device

Android emulator

Device model

pixel 6a

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions