callstack / callstack/react-native-pager-view
Scrapped or attached views may not be recycled. isScrap:false isAttached:true
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.4k
- Forks
- 476
- Ø Merge
- 10 T. 21 Std.
- Gemergte PRs (30 T.)
- 2
Beschreibung
# Bug report
## Summary
```bash
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:
```bash
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',
},
);
```
Beitragsleitfaden
Rechercherichtung
Beginnen Sie damit, die in diesem Issue beschriebene Navigation Home → OrganizationsList → Home zu reproduzieren, und vergleichen Sie den Fehler mit dem bereitgestellten RecyclerView-Stacktrace. Untersuchen Sie den an diesem Stacktrace beteiligten ViewPager2 RecyclerViewImpl und FragmentAdapter. Als erledigt gilt die Aufgabe, wenn die Navigation nicht mehr die Ausnahme „Scrapped or attached views may not be recycled“ auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, java, react-native
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100