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

Scrapped or attached views may not be recycled. isScrap:false isAttached:true #173

Closed
AlexSmirnov9107 opened this issue May 14, 2020 · 38 comments · Fixed by #271 or #552
Closed

Scrapped or attached views may not be recycled. isScrap:false isAttached:true #173

AlexSmirnov9107 opened this issue May 14, 2020 · 38 comments · Fixed by #271 or #552

Comments

@AlexSmirnov9107
Copy link

Bug report

Summary

java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true com.reactnative.community.viewpager2.widget.ViewPager2$RecyclerViewImpl{a137042 VFED..... ......ID 0,0-1080,1369 #1}, adapter:com.reactnativecommunity.viewpager.FragmentAdapter@b871853, layout:com.reactnative.community.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@520d590, context:com.facebook.react.uimanager.ThemedReactContext@7113f48
        at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:6433)
        at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1456)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:12699)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:13199)
        at androidx.recyclerview.widget.SimpleItemAnimator.dispatchRemoveFinished(SimpleItemAnimator.java:277)
        at androidx.recyclerview.widget.DefaultItemAnimator$4.onAnimationEnd(DefaultItemAnimator.java:213)
        at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1111)
        at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
        at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1242)
        at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1484)
        at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
        at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
        at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:964)
        at android.view.Choreographer.doCallbacks(Choreographer.java:790)
        at android.view.Choreographer.doFrame(Choreographer.java:721)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Environment info

react-native info output:

System:
    OS: macOS 10.15.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 24.62 GB / 64.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.11.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.8.4 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  Languages:
    Java: 13.0.1 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.0 => 16.13.0 
    react-native: ^0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

Library version: x.x.x

Steps to reproduce

  1. Home -> OrganizationsList
    2.Going back from OrganizationsList -> Home
export default createNativeStackNavigator(
  {
    Home: HomeScreen,
    OrganizationsList: OrganizationsListScreen,
    OrganizationDetail: OrganizationDetailScreen,
    Rating: RatingScreen,
    Feedbacks: FeedBacksScreen,
    Provider: ProviderScreen,
    WebBrowser: WebBrowserScreen,
    SplashScreens: SplashScreens,
  },
  {
    initialRouteName: 'Home',
    headerMode: 'none',
  },
);

@troZee
Copy link
Member

troZee commented May 19, 2020

I assume, this issue does not exist on 3.3.0, so as workaround you can use this version.

I found some solutions here: https://code.briarproject.org/briar/briar/issues/1363
But I would like to test those solutions. Could you provide a reproducible repository ?

@troZee troZee added android Resolution: Needs Repro This issue could be improved with a demo to reproduce the issue. bug Something isn't working labels May 19, 2020
@ice-chillios
Copy link

Hi @troZee :) I'm not sure if it's related but I was able to reproduce it with native-stack from react-native-screens.

@troZee
Copy link
Member

troZee commented May 19, 2020

Hi @troZee :) I'm not sure if it's related but I was able to reproduce it with native-stack from react-native-screens.

Hey, could you provide a reproducible code ? React navigation uses react native screen under the hood, so probably it is somehow related :D

@chirag04
Copy link

chirag04 commented May 27, 2020

seeing this in our app as well on v4. will try and gather more information soon. cc @SRandazzo

@jong-hui
Copy link

jong-hui commented Jun 9, 2020

I have same problem in react-navigation v5 (native-stack)

@radko93
Copy link

radko93 commented Jul 26, 2020

If you can manage navigation yourself then you can unmount the view pager before navigating. Unfortunately, it's not possible to do it like this always. Do you still need repro for that?

@troZee
Copy link
Member

troZee commented Aug 15, 2020

Do you still need repro for that?

Yes, please

@fadiquader
Copy link

fadiquader commented Aug 17, 2020

same here, it happens when pressing back. I'm using react-navigation + react-native-screens.

Screen Shot 2020-08-17 at 2 43 34 PM

@osdnk
Copy link
Contributor

osdnk commented Aug 19, 2020

I think this bug is quite urgent. It happens when we have viewpager inside native-stack i.e. creatweNativeStackNavigator

@LRNZ09
Copy link

LRNZ09 commented Aug 20, 2020

I also have this problem with ViewPager v4.1.6 and react-native-screens v2.10.1 using a native stack

@thanhdevapp
Copy link

same problem Android when user viewpager and creatweNativeStackNavigator

@jdconley
Copy link

jdconley commented Oct 16, 2020

I also have this issue with a new app on Android as well. I see it when I render a different set of screens inside a createNativeStackNavigator, where the screen that has the ViewPager as a child is no longer in the native stack navigator. I'm on 4.1.6, react-native-screens 2.11.0, react-native 0.63.x...

Anyone have a workaround?

Edit: As others have said downgrading to 3.x does work, but was hoping someone figured it out on 4.x. 😄

@troZee troZee added next and removed Resolution: Needs Repro This issue could be improved with a demo to reproduce the issue. labels Oct 28, 2020
@troZee
Copy link
Member

troZee commented Jan 12, 2021

Fix has been applied #271

@troZee troZee closed this as completed Jan 12, 2021
@domasn
Copy link

domasn commented Aug 18, 2021

Seems that the issue is still there when using v6.0.0-rc.0 with lazy page loading 😕

App crashes after navigating back or going forward from a screen with a LazyPagerView inside a native stack with the following log:

java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{fb07b3f VFED..... ......ID 0,0-1080,2142 #1}, adapter:com.reactnativepagerview.FragmentAdapter@56bdc0c, layout:androidx.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@9408955, context:com.facebook.react.uimanager.ThemedReactContext@692ceaf
        at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:6614)
        at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1525)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:13109)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:13611)
        at androidx.recyclerview.widget.SimpleItemAnimator.dispatchRemoveFinished(SimpleItemAnimator.java:277)
        at androidx.recyclerview.widget.DefaultItemAnimator$4.onAnimationEnd(DefaultItemAnimator.java:213)
        at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1111)
        at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
        at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1250)
        at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1492)
        at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
        at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
        at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
        at android.view.Choreographer.doCallbacks(Choreographer.java:796)
        at android.view.Choreographer.doFrame(Choreographer.java:727)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@troZee troZee reopened this Aug 19, 2021
@troZee troZee added next and removed bug Something isn't working android labels Aug 19, 2021
@pedrolopes10
Copy link

This issue also occurs using 5.4.0 with react navigation native stack 6.1.0, react native screens 3.5.0 and RN 0.64.2.

Hope it helps find out. Tks

@alexco2
Copy link

alexco2 commented Aug 29, 2021

Also happens to me (gorhom/react-native-bottom-sheet#427 (comment))
Was able to solve the issue by changing from nativeStackNavigator to StackNavigator, which of course is not an ideal solution regarding the performance.

@LaGregance
Copy link

LaGregance commented Nov 15, 2021

Seems that the issue is still there when using v6.0.0-rc.0 with lazy page loading 😕

App crashes after navigating back or going forward from a screen with a LazyPagerView inside a native stack with the following log:

java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{fb07b3f VFED..... ......ID 0,0-1080,2142 #1}, adapter:com.reactnativepagerview.FragmentAdapter@56bdc0c, layout:androidx.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@9408955, context:com.facebook.react.uimanager.ThemedReactContext@692ceaf
        at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:6614)
        at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1525)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:13109)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:13611)
        at androidx.recyclerview.widget.SimpleItemAnimator.dispatchRemoveFinished(SimpleItemAnimator.java:277)
        at androidx.recyclerview.widget.DefaultItemAnimator$4.onAnimationEnd(DefaultItemAnimator.java:213)
        at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1111)
        at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
        at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1250)
        at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1492)
        at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
        at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
        at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
        at android.view.Choreographer.doCallbacks(Choreographer.java:796)
        at android.view.Choreographer.doFrame(Choreographer.java:727)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Is there some news about this ?

I've temporary fix this by doing bad things :

// setFixAndroidUnmount(true) instead of direct doing navigation.goBack()
const [fixAndroidUnmount, setFixAndroidUnmount] = useState(false);
useEffect(() => {
  if (fixAndroidUnmount) {
    setTimeout(() => navigation.goBack(), 100);
  }
}, [fixAndroidUnmount, navigation]);

// ....
{!fixAndroidUnmount && <LazyPagerView />}

@Kailash23
Copy link

androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal
RecyclerView.java, line 6614

java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{e0ac578 VFED..... ......ID 0,0-1080,1012 #3f}, adapter:com.reactnativepagerview.ViewPagerAdapter@590d451, layout:androidx.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@70144b6, context:com.facebook.react.uimanager.ThemedReactContext@b68408
androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal RecyclerView.java:6614
androidx.recyclerview.widget.RecyclerView.removeAnimatingView RecyclerView.java:1525
androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished RecyclerView.java:13109
androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished RecyclerView.java:13611
androidx.recyclerview.widget.SimpleItemAnimator.dispatchRemoveFinished SimpleItemAnimator.java:277
androidx.recyclerview.widget.DefaultItemAnimator$4.onAnimationEnd DefaultItemAnimator.java:213
android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd ViewPropertyAnimator.java:1111
android.animation.Animator$AnimatorListener.onAnimationEnd Animator.java:554
android.animation.ValueAnimator.endAnimation ValueAnimator.java:1242
android.animation.ValueAnimator.doAnimationFrame ValueAnimator.java:1484
android.animation.AnimationHandler.doAnimationFrame AnimationHandler.java:146
android.animation.AnimationHandler.access$100 AnimationHandler.java:37
android.animation.AnimationHandler$1.doFrame AnimationHandler.java:54
android.view.Choreographer$CallbackRecord.run Choreographer.java:994
android.view.Choreographer.doCallbacks Choreographer.java:794
android.view.Choreographer.doFrame Choreographer.java:725
android.view.Choreographer$FrameDisplayEventReceiver.run Choreographer.java:981
android.os.Handler.handleCallback Handler.java:883
android.os.Handler.dispatchMessage Handler.java:100
android.os.Looper.loop Looper.java:237
android.app.ActivityThread.main ActivityThread.java:7948
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:493
com.android.internal.os.ZygoteInit.main ZygoteInit.java:1075

Most affected device : Redmi 9 Prime, Galaxy S7 Edge, Galaxy A50

@chr4ss12
Copy link

same, needs fixing, right now as comment above mentioned, hackish workaround:

  exit () {
    this.setState({unmount: true}, () => {
      setTimeout(() => this.props.navigation.goBack(), 100)
    })
  }

and

      {!this.state.unmount &&
        <PagerView
          scrollEnabled={false}
          ref={(ref) => { this.pagerViewRef = ref }}
          onPageSelected={({ nativeEvent }) => { this.setState({ page: nativeEvent.position }) }}
          style={{ flex: 1, padding: padding }} initialPage={this.state.page} orientation="horizontal">

@hubciorz
Copy link

hubciorz commented Jan 5, 2022

The problem occurs extremely often. We have about 6000 reports from 1.6k users.

image
image

@radko93
Copy link

radko93 commented Jan 5, 2022

It happens for me on 6.0.0-rc but on 5.4.x. (not on lazy loading, regular).

@ArturoTorresMartinez
Copy link

Still happening on RN 67, React navigation 6 when used in a view that then unmounts

@ArturoTorresMartinez
Copy link

same, needs fixing, right now as comment above mentioned, hackish workaround:

  exit () {
    this.setState({unmount: true}, () => {
      setTimeout(() => this.props.navigation.goBack(), 100)
    })
  }

and

      {!this.state.unmount &&
        <PagerView
          scrollEnabled={false}
          ref={(ref) => { this.pagerViewRef = ref }}
          onPageSelected={({ nativeEvent }) => { this.setState({ page: nativeEvent.position }) }}
          style={{ flex: 1, padding: padding }} initialPage={this.state.page} orientation="horizontal">

Seems that the issue is still there when using v6.0.0-rc.0 with lazy page loading 😕
App crashes after navigating back or going forward from a screen with a LazyPagerView inside a native stack with the following log:

java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{fb07b3f VFED..... ......ID 0,0-1080,2142 #1}, adapter:com.reactnativepagerview.FragmentAdapter@56bdc0c, layout:androidx.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@9408955, context:com.facebook.react.uimanager.ThemedReactContext@692ceaf
        at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:6614)
        at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1525)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:13109)
        at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:13611)
        at androidx.recyclerview.widget.SimpleItemAnimator.dispatchRemoveFinished(SimpleItemAnimator.java:277)
        at androidx.recyclerview.widget.DefaultItemAnimator$4.onAnimationEnd(DefaultItemAnimator.java:213)
        at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1111)
        at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
        at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1250)
        at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1492)
        at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
        at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
        at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
        at android.view.Choreographer.doCallbacks(Choreographer.java:796)
        at android.view.Choreographer.doFrame(Choreographer.java:727)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Is there some news about this ?

I've temporary fix this by doing bad things :

// setFixAndroidUnmount(true) instead of direct doing navigation.goBack()
const [fixAndroidUnmount, setFixAndroidUnmount] = useState(false);
useEffect(() => {
  if (fixAndroidUnmount) {
    setTimeout(() => navigation.goBack(), 100);
  }
}, [fixAndroidUnmount, navigation]);

// ....
{!fixAndroidUnmount && <LazyPagerView />}

These methods do work, so anyone still having the issue try one of these.

@hubciorz
Copy link

@ArturoTorresMartinez These methods do not work in our app, so it's not a universal solution :(

@ArturoTorresMartinez
Copy link

Do you know when the error happens exactly?

Seems to be when unmounting and the pagerview is on the active screen on your navigation stack.

The real test is for you to remove the react-native-pager-view completely from the screens you're having issues at and if that solves the issue, the conditional rendering should do the same, just make sure you first update some state to not render the pager view and then, only then do your navigation/unmounting etc.

@hubciorz
Copy link

@ArturoTorresMartinez Perhaps when users go back to the previous screen. I don't know why, but unmounting the pageview (by replacing it with null) does not work.

@yepMad
Copy link

yepMad commented Feb 16, 2022

This error happens when I use PagerView and on the same screen I allow the user to click on a button with "navigation.replace". If I use "navigation.navigate", it doesn't happen.

This is urgent, I'm on version: ^6.0.0-rc.0

@ArturoTorresMartinez
Copy link

@ArturoTorresMartinez Perhaps when users go back to the previous screen. I don't know why, but unmounting the pageview (by replacing it with null) does not work.

If removing the pager entirely from the screen doesn't resolve the issue perhaps the pager isn't the library causing it?

If removing it entirely does fix the issue, then the condition for replacing it with a null object isn't triggering at the expected time.

@ArturoTorresMartinez
Copy link

Does the conditional render workaround help in your scenario?

@lxp-git
Copy link
Contributor

lxp-git commented Apr 6, 2022

maybe we need remove removeAllViews in PagerViewViewManager?

@yepMad
Copy link

yepMad commented Apr 6, 2022

maybe we need remove removeAllViews in PagerViewViewManager?

This still occurs on most recent next version? In the thruth, "removeAllViews" should fix it. See #516

@lxp-git
Copy link
Contributor

lxp-git commented Apr 6, 2022

maybe we need remove removeAllViews in PagerViewViewManager?

This still occurs on most recent next version? In the thruth, "removeAllViews" should fix it. See #516

Wow! Thank you for your work. I am not migrating to Pre-Release right now. I am just left removeAllViews empty. Not sure if it will cause other issues.

@lxp-git
Copy link
Contributor

lxp-git commented May 6, 2022

@yepMad Hi. I have tried 6.0.0-rc.2. It crashed if pages goBack quickly. Add this code in example.

// use NativeStack
const Stack = createNativeStackNavigator();

export function Navigation() {
  const navigationContainerRef = useNavigationContainerRef();
  React.useEffect(() => {
    const timer = setInterval(async () => {
      navigationContainerRef.navigate(examples[Math.floor(Math.random() * examples.length)].name, {

      });
      await new Promise(resolve => setTimeout(resolve, 100));
      navigationContainerRef.goBack();
    }, 1000);
    return () => {
      clearInterval(timer);
    }
  }, []);
  return (
    <NavigationContainer ref={navigationContainerRef}>
......

lxp-git added a commit to Flickering-AI/react-native-pager-view that referenced this issue May 6, 2022
@lxp-git lxp-git mentioned this issue May 6, 2022
1 task
@troZee
Copy link
Member

troZee commented May 20, 2022

@hixus
Copy link

hixus commented Aug 4, 2022

@troZee is it possible to add the fix also to next branch, we are using6.0.0-rc.2 and seems this is still happening there. I'm able to crash the app if almost same time changing tab and pressing back.

@SimpleCreations
Copy link

Second this. 6.0.0 has great performance when having a large amount of pages, but falls behind the main branch too much to be usable on Android :(
I ended up installing both 6.0.0 and 5.x and use the former on iOS and the latter on Android.

chuece added a commit to chuece/react-native-pager-view that referenced this issue Sep 1, 2022
* Update ReactNativePageView.m

* chore: add docs for attaching onPageScroll handler with reanimated (callstack#491)

* add docs for attaching handler with reanimated

* feat: add reanimated onpagescroll example

* feat: add reanimated onpagescroll example

* chore(docs): fix typos (callstack#497)

* fix(ios): Crash when rapidly switching pages callstack#510

* Release 5.4.10

* chore(deps): bump nanoid from 3.1.22 to 3.2.0 in /example (callstack#506)

Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.22 to 3.2.0.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](ai/nanoid@3.1.22...3.2.0)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump trim-off-newlines from 1.0.1 to 1.0.3 (callstack#513)

Bumps [trim-off-newlines](https://github.com/stevemao/trim-off-newlines) from 1.0.1 to 1.0.3.
- [Release notes](https://github.com/stevemao/trim-off-newlines/releases)
- [Commits](stevemao/trim-off-newlines@v1.0.1...v1.0.3)

---
updated-dependencies:
- dependency-name: trim-off-newlines
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump tmpl from 1.0.4 to 1.0.5 in /example (callstack#452)

Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump tmpl from 1.0.4 to 1.0.5 (callstack#451)

Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump semver-regex from 3.1.2 to 3.1.3 (callstack#449)

Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/commits)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(ios): wrong variable usage that causes crash related to callstack#458 (callstack#502)

Introduced in callstack#455 this should have been `i` instead of `index` all along.

* bump example

* Release 5.4.11

* chore(deps): bump plist from 3.0.1 to 3.0.4 (callstack#525)

Bumps [plist](https://github.com/TooTallNate/node-plist) from 3.0.1 to 3.0.4.
- [Release notes](https://github.com/TooTallNate/node-plist/releases)
- [Changelog](https://github.com/TooTallNate/plist.js/blob/master/History.md)
- [Commits](https://github.com/TooTallNate/node-plist/commits)

---
updated-dependencies:
- dependency-name: plist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump plist from 3.0.2 to 3.0.4 in /example (callstack#526)

Bumps [plist](https://github.com/TooTallNate/node-plist) from 3.0.2 to 3.0.4.
- [Release notes](https://github.com/TooTallNate/node-plist/releases)
- [Changelog](https://github.com/TooTallNate/plist.js/blob/master/History.md)
- [Commits](https://github.com/TooTallNate/node-plist/commits)

---
updated-dependencies:
- dependency-name: plist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(ios): rapid taps on the navigation tabs (callstack#529)

* bump example

* Release 5.4.12

* fix(android): initialPage for dynamic content

* Release 5.4.13

* Revert "fix(ios): rapid taps on the navigation tabs (callstack#529)"

This reverts commit 27e8003.

* fix(ios): switching between the pages for rapid tabs

* Release 5.4.14

* fix(ios): crash with `NSInternalInconsistencyException` on iOS (callstack#530)

* Release 5.4.15

* chore(docs): fix PagerView import (callstack#533)

* chore: fix android example

* chore: add native stack navigator

* fix lint

* chore: update pods

* fix(ios): set delaysContentTouches to YES (callstack#563)

* Release 5.4.16

* fix(ios): NSInternalInconsistencyException crash (callstack#564)

Added additional checks to scroll without animation if already an animation is in progress to fix `NSInternalInconsistencyException` crash in iOS

* Release 5.4.17

* fix(android): scrapped or attached views may not be recycled callstack#173 (callstack#552)

* Release 5.4.18

* fix(ios): disable pager scroll gesture on swipe to go back (callstack#500)

* fix: disable pager scroll gesture on swipe to go back

* fix: navigation controller nil

* Release 5.4.19

* fix(ios): pager sometimes does not fill full height (callstack#565)

Fixes callstack#523
Fixes callstack#543

See callstack#518 (comment) for more info.

* Release 5.4.21

* fix(android): only remove child if it exists (callstack#560)

* Release 5.4.22

* fix(ios): keyboard auto dismisses (callstack#567)

Fixes callstack#566

* Release 5.4.23

* fix(ios): restore animated param check (callstack#569)

* chore: bump example

* Release 5.4.24

* fix(ios): incorrect pager height (callstack#580)

Co-authored-by: Andrei Alecu <[email protected]>

* Release 5.4.25

* fix(android): assign an id to host view (callstack#585) (callstack#587)

Co-authored-by: Nishan <[email protected]>
Co-authored-by: Vojtech Novak <[email protected]>
Co-authored-by: doug-lessen <[email protected]>
Co-authored-by: Piotr Trocki <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Danilo Bürger <[email protected]>
Co-authored-by: Jan-Rixt Van Hoye <[email protected]>
Co-authored-by: Rishat Shamsutdinov <[email protected]>
Co-authored-by: Numan <[email protected]>
Co-authored-by: Hirbod <[email protected]>
Co-authored-by: Rupesh Chaudhari <[email protected]>
Co-authored-by: lxp <[email protected]>
Co-authored-by: Andrei Alecu <[email protected]>
Co-authored-by: Levi W <[email protected]>
Co-authored-by: mateusz-ramski <[email protected]>
Co-authored-by: Andrei Alecu <[email protected]>
Co-authored-by: Luis Fernandez <[email protected]>
@laurenzcodes
Copy link

This issue is closed and yet the crash still persists in the latest next version. (6.0.0-rc.2 to use LazyPagerView)

We mainly see it happening on older Android phones running Android 10 and 11. It's really hard to implement a workaround in our codebase so it would be great if we could get an official fix from the maintainers.

@troZee
Copy link
Member

troZee commented Dec 20, 2022

#673

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