react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

android: Scrapped or attached views may not be recycled

Open rifad4u opened this issue 1 year ago • 8 comments

Environment

"@react-navigation/material-top-tabs": "^6.6.14", "@react-navigation/native": "^6.1.18", "@react-navigation/native-stack": "^6.11.0", "react": "18.3.1", "react-native": "0.75.2", "react-native-pager-view": "^6.3.4", "react-native-safe-area-context": "^4.10.9", "react-native-screens": "^3.34.0", "react-native-tab-view": "^3.5.2"

Description

I have a tab navigator in a post login stack, one of the tabs visibility is based on the value of a state variable. When i do logout, first i'm setting the value of the state variable to false, then switching the stack to pre login stack. at this time app is getting crashed.

Getting logs in Android studio like below java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{7d03f4b VFED..... .......D 0,0-1080,1736 #2}, adapter:com.reactnativepagerview.ViewPagerAdapter@5f5fd28, layout:androidx.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@1cf2a41, context:com.facebook.react.uimanager.ThemedReactContext@c1e63c

Reproducible Demo

https://github.com/rifad4u/pagerviewcrash.git

rifad4u avatar Aug 20 '24 15:08 rifad4u

+ 1

jingp-ofload avatar Aug 26 '24 01:08 jingp-ofload

Hi @rifad4u

Just a quick reminder to please avoid pinging other contributors unnecessarily. Let's ensure we're not disturbing others unless it's critical to the discussion. Thanks for your understanding and cooperation! PRs and other investigations are welcome 🙏

Best regards, Piotr Trocki

troZee avatar Aug 29 '24 07:08 troZee

@kamill90, please check this issue in your free time 🙏

troZee avatar Sep 02 '24 11:09 troZee

The same problem

ShaoGongBra avatar Sep 07 '24 03:09 ShaoGongBra

Any update on this issue? Im facing this issue on react native 0.75.4 with "react-native-pager-view": "^6.4.1",

sankar-gp avatar Oct 03 '24 03:10 sankar-gp

  • 1

LinhLM23496 avatar Oct 17 '24 10:10 LinhLM23496

Looking into this

MrRefactor avatar Oct 17 '24 10:10 MrRefactor

enabled new arch. same error

hengkx avatar Oct 27 '24 11:10 hengkx

Thank you @MrRefactor

parsable-osiel avatar Oct 29 '24 16:10 parsable-osiel

Similar issue: https://github.com/callstack/react-native-pager-view/issues/891#issuecomment-2447236943

troZee avatar Oct 31 '24 11:10 troZee

enabled new arch. same error

When new arch type is disabled error is resolved.

brisote avatar Oct 31 '24 22:10 brisote

Any update? I just saw this package and I installed it in my RN app that uses version 0.76, after I implemented the PagerView whenever I try to use anything related to navigation the app crashes.

Doom2layer avatar Nov 02 '24 21:11 Doom2layer

Getting the same issue in RN 0.73.9, do we have any update?

iampankajver avatar Nov 07 '24 05:11 iampankajver

As I messaged previously, looking into that issue. Feel free to contribute and open PR.

MrRefactor avatar Nov 07 '24 10:11 MrRefactor

I got this because I was following the example with reanimated library, I don't have this error after I get rid of reanimated from react-native-pager-view.

jingp-ofload avatar Nov 08 '24 01:11 jingp-ofload

Getting the same issue in RN 0.76.1 when newArchEnabled=true, do we have any update?

duongnguyen17 avatar Nov 11 '24 07:11 duongnguyen17

I am facing same issue on react-native 0.76.1 and react-native-pagerview - 6.5.0

abhayagrawal-fareye avatar Nov 13 '24 07:11 abhayagrawal-fareye

+1

NetPumi2 avatar Nov 14 '24 20:11 NetPumi2

Getting the same issue in RN 0.76.1 when newArchEnabled=true, do we have any update?

I am even getting this issue when newArchEnabled=false

iampankajver avatar Nov 14 '24 21:11 iampankajver

+1 getting the same issue

lashidalgo avatar Nov 18 '24 15:11 lashidalgo

+1

dinosmajovic avatar Nov 18 '24 17:11 dinosmajovic

Same issue here +1

fgagneten avatar Nov 18 '24 17:11 fgagneten

+1 on new arch with expo 52

mlukasik-dev avatar Nov 18 '24 20:11 mlukasik-dev

+1, RN 0.76.2 with newArchEnabled

khoerulrizal avatar Nov 21 '24 06:11 khoerulrizal

It's fixed now in the latest release, thank you @MrRefactor!!!

dinosmajovic avatar Nov 21 '24 10:11 dinosmajovic

Closing as fixed

MrRefactor avatar Nov 29 '24 10:11 MrRefactor

@MrRefactor this issue is back in 6.6.0 on Fabric, probably due to #929

radko93 avatar Dec 02 '24 15:12 radko93

@MrRefactor this issue is back in 6.6.0 on Fabric, probably due to #929

checking

MrRefactor avatar Dec 02 '24 17:12 MrRefactor

https://github.com/callstack/react-native-pager-view/releases/tag/v6.6.1 @radko93

MrRefactor avatar Dec 03 '24 11:12 MrRefactor

This error / crash still occurs when you do:

pageMargin={24}

fendyk avatar Dec 29 '24 11:12 fendyk