callstack / react-native-pager-view

React Native wrapper for the Android ViewPager and iOS UIPageViewController.
MIT License
2.72k stars 416 forks source link

`'addView' overrides nothing` error with React Native 0.75 #850

Closed szydlovsky closed 2 months ago

szydlovsky commented 2 months ago

Environment

Description

Hello, Back at Reanimated, we are already bumping everything up for RN 0.75. As of now, the 0.75.0-rc.6 version is what we are working on. However, we have to use patches for react-native-pager-view because of two override keywords in the code. Namely: https://github.com/callstack/react-native-pager-view/blob/5ba9ca03a8e8e3cc0adb6794fdd7aa29e72fbe1a/android/src/paper/java/com/reactnativepagerview/PagerViewViewManager.kt#L72 and https://github.com/callstack/react-native-pager-view/blob/5ba9ca03a8e8e3cc0adb6794fdd7aa29e72fbe1a/android/src/fabric/java/com/reactnativepagerview/PagerViewViewManager.kt#L91 The error we are getting is, as in the title, 'addView' overrides nothing. Our patches just remove the override keywords and everything works fine.

Reproducible Demo

  1. Clone Reanimated repo.
  2. yarn && yarn build in the very root of the project.
  3. Go to either /apps/paper-example or /apps/fabric-example and open their android projects.
  4. Modify node_modules folder in the root, so that these two addView methods get override keywords back (they won't be there as our yarn patch removes them).
  5. Try building either of the apps.
troZee commented 2 months ago

@szydlovsky do you mean this patch https://github.com/software-mansion/react-native-reanimated/pull/6185/files#diff-53d6bfb07ed81b599c7b32d557310fdaf03dce6ca844ce2841d8c4336dda58f6R1 ? If yes, could you prepare a PR?

szydlovsky commented 2 months ago

@troZee yes, precisely. However, I am not sure if it will still work below RN 0.75. It might need some RN-version-specific patch.

VovaManzhula commented 2 months ago

override fun addView(host: NestedScrollableHost, child: View?, index: Int) { PagerViewViewManagerImpl.addView(host, child, index) } generally only works if you remove the question mark after child: View and if you remove the override, then the application crashes when navigating the tabbar, and scrolling between screens does not work, and child components do not appear on the screen either p.s my case is on fabric

szydlovsky commented 2 months ago

@troZee sorry for the delay, but eventually, there's the PR: https://github.com/callstack/react-native-pager-view/pull/857 Not sure what needs to be changed in Readme and typed files though

aokdev06 commented 2 months ago

Hello. When do you plan to publish this change on npm? @szydlovsky

szydlovsky commented 2 months ago

Hello @aokdev06 I am not the library mantainer, but I've heard from @troZee that it won't be long 😄

troZee commented 2 months ago

We are waiting for the other fixes and after that, we will release it

diegocabre commented 2 months ago

a mi aún me da error * What went wrong: Execution failed for task ':react-native-pager-view:compileDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details

MrRefactor commented 2 months ago

Fixed in https://github.com/callstack/react-native-pager-view/releases/tag/v6.4.0