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

android: Scrapped or attached views may not be recycled #859

Closed
rifad4u opened this issue Aug 20, 2024 · 30 comments
Closed

android: Scrapped or attached views may not be recycled #859

rifad4u opened this issue Aug 20, 2024 · 30 comments
Assignees

Comments

@rifad4u
Copy link

rifad4u commented Aug 20, 2024

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 rifad4u changed the title App is getting crashed when switching the navigator, java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true App is getting crashed when switching the navigator after disabling one of the tabs, java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true Aug 20, 2024
@jingp-ofload
Copy link

jingp-ofload commented Aug 26, 2024

+ 1

@troZee
Copy link
Member

troZee commented Aug 29, 2024

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
Copy link
Member

troZee commented Sep 2, 2024

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

@troZee troZee assigned troZee and unassigned troZee Sep 2, 2024
@troZee troZee changed the title App is getting crashed when switching the navigator after disabling one of the tabs, java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true android: Scrapped or attached views may not be recycled Sep 2, 2024
@ShaoGongBra
Copy link

The same problem

@sankar-gp
Copy link

sankar-gp commented Oct 3, 2024

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

@LinhLM23496
Copy link

  • 1

@MrRefactor
Copy link
Collaborator

Looking into this

@MrRefactor MrRefactor self-assigned this Oct 17, 2024
@hengkx
Copy link

hengkx commented Oct 27, 2024

enabled new arch. same error

@parsable-osiel
Copy link

Thank you @MrRefactor

@troZee
Copy link
Member

troZee commented Oct 31, 2024

Similar issue: #891 (comment)

@gstaykov
Copy link

enabled new arch. same error

When new arch type is disabled error is resolved.

@Doom2layer
Copy link

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.

@iampankajver
Copy link

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

@MrRefactor
Copy link
Collaborator

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

@jingp-ofload
Copy link

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.

@duongnguyen17
Copy link

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

@abhayagrawal-fareye
Copy link

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

@NetPumi2
Copy link

+1

@iampankajver
Copy link

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

@lashidalgo
Copy link

+1 getting the same issue

@dinosmajovic
Copy link

+1

@fgagneten
Copy link

Same issue here +1

@mlukasik-dev
Copy link

+1 on new arch with expo 52

@khoerulrizal
Copy link

+1, RN 0.76.2 with newArchEnabled

@dinosmajovic
Copy link

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

@MrRefactor
Copy link
Collaborator

Closing as fixed

@radko93
Copy link

radko93 commented Dec 2, 2024

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

@MrRefactor
Copy link
Collaborator

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

checking

@MrRefactor
Copy link
Collaborator

@fendyk
Copy link

fendyk commented Dec 29, 2024

This error / crash still occurs when you do:

pageMargin={24}

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

No branches or pull requests