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

app crashing in react native version 0.75.4 with new architecture #882

Closed
sankar-gp opened this issue Oct 3, 2024 · 16 comments
Closed

app crashing in react native version 0.75.4 with new architecture #882

sankar-gp opened this issue Oct 3, 2024 · 16 comments
Assignees
Labels
Resolution: Needs Repro This issue could be improved with a demo to reproduce the issue.

Comments

@sankar-gp
Copy link

React Native App crashing

FATAL EXCEPTION: main
Process: com.test.app, PID: 11360
java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{1b4b462 VFED..... ......ID 0,0-975,1964 #2}, adapter:com.reactnativepagerview.ViewPagerAdapter@eb2d9f3, layout:androidx.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@58106b0, context:com.facebook.react.uimanager.ThemedReactContext@f0c1813
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:1115)
at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:708)
at android.animation.Animator$AnimatorCaller$$ExternalSyntheticLambda1.call(D8$$SyntheticClass:0)
at android.animation.Animator.callOnList(Animator.java:666)
at android.animation.Animator.notifyListeners(Animator.java:609)
at android.animation.Animator.notifyEndListeners(Animator.java:634)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1306)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1566)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:344)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:87)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1404)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
at android.view.Choreographer.doFrame(Choreographer.java:941)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8705)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)

"react-native": "0.75.4",
"react-native-pager-view": "^6.4.1",

@emifairais
Copy link

emifairais commented Oct 4, 2024

Same issue here.

"react-native": "0.75.3",
"react-native-pager-view": "6.4.0",

@RaduPaun
Copy link

RaduPaun commented Oct 4, 2024

Same here. Please help! 🙏
"react-native": "0.75.3",
"react-native-pager-view": "6.4.0",

@avega99
Copy link

avega99 commented Oct 9, 2024

I am getting the same error

@raphaelobinna
Copy link

I had the same issue with Execution failed for task ':react-native-pager-view:compileDebugKotlin'.
I downgraded to pager view 6.3.0, it didn't fix it. When I finally downgraded my react-native version from 0.75.4 to 0.75.2 .

That fixed it for me

@shovel-kun
Copy link

Where are you folks getting this error?

Try software-mansion/react-native-screens@b67af86.

It fixed navigating with navigation.navigate() for me on new arch and 0.75.4, but this error occurs when I try to navigation.replace()

@LinhLM23496
Copy link

LinhLM23496 commented Oct 17, 2024

  • 1

@kmy-n
Copy link

kmy-n commented Oct 23, 2024

In my case, the error was resolved with the following environment:

// android/app/build.gradle
dependencies {
    // other dependencies
    implementation 'androidx.viewpager2:viewpager2:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.3.2'
}

"react-native": "^0.75.4",
"react-native-pager-view": "^6.4.1",
"react-native-screens": "^4.0.0-beta.14" (I tested with this version)

@troZee troZee added the Resolution: Needs Repro This issue could be improved with a demo to reproduce the issue. label Oct 24, 2024
@MrRefactor MrRefactor self-assigned this Nov 5, 2024
@MrRefactor
Copy link
Collaborator

Just upgraded react-native to 0.75.4 in the example app, everything is working fine. Closing issue #901

@richardbutler
Copy link

Getting this issue with [email protected]. I have a PagerView in a Stack.Screen, which may be causing the issue. This doesn't happen using the old arch.

    "@react-navigation/native": "7.0.0-rc.21",
    "@react-navigation/native-stack": "7.0.0-rc.30",
    "expo": "~52.0.0-preview.19",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-native": "0.76.1",
    "react-native-pager-view": "^6.4.1",
    "react-native-screens": "4.0.0-beta.17",
ERROR  Your app just crashed. See the error below.
java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{9e6e20d VFED..... ......ID 0,0-1124,1426 #2}, adapter:com.reactnativepagerview.ViewPagerAdapter@33c65c2, layout:androidx.viewpager2.widget.ViewPager2$LinearLayoutManagerImpl@dc49fd3, context:com.facebook.react.uimanager.ThemedReactContext@c5c0835
  androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:6433)
  androidx.recyclerview.widget.RecyclerView$Recycler.quickRecycleScrapView(RecyclerView.java:6554)
  androidx.recyclerview.widget.RecyclerView$LayoutManager.removeAndRecycleScrapInt(RecyclerView.java:9249)
  androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4207)
  androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3862)
  androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404)
  android.view.View.layout(View.java:24421)
  android.view.ViewGroup.layout(ViewGroup.java:6440)
  androidx.viewpager2.widget.ViewPager2.onLayout(ViewPager2.java:527)
  android.view.View.layout(View.java:24421)
  android.view.ViewGroup.layout(ViewGroup.java:6440)
  com.reactnativepagerview.PagerViewViewManagerImpl.refreshViewChildrenLayout$lambda$2(PagerViewViewManagerImpl.kt:157)
  com.reactnativepagerview.PagerViewViewManagerImpl.$r8$lambda$GQgd023cnWEAb4sL7PYFpO-lrvQ(Unknown Source:0)
  com.reactnativepagerview.PagerViewViewManagerImpl$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
  android.os.Handler.handleCallback(Handler.java:958)
  android.os.Handler.dispatchMessage(Handler.java:99)
  android.os.Looper.loopOnce(Looper.java:205)
  android.os.Looper.loop(Looper.java:294)
  android.app.ActivityThread.main(ActivityThread.java:8177)
  java.lang.reflect.Method.invoke(Native Method)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

@richardbutler
Copy link

Just tried this with v6.5.0 and the issue persists.

@MrRefactor MrRefactor reopened this Nov 6, 2024
@renyufei8023
Copy link

There are issues with using react-screens native stack

@Melekhin
Copy link

+1, crash in change from PageViewer (that in Stack.Screen) in Nested Stack.Screen

"@react-navigation/bottom-tabs": "^6.6.1",
"@react-navigation/material-top-tabs": "^6.6.14",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.11.0",
"react": "18.3.1",
"react-native": "^0.76.1",

@MrRefactor
Copy link
Collaborator

Please provide a reproduction repo.

@abraaoz
Copy link

abraaoz commented Nov 21, 2024

(NOBRIDGE) ERROR Error: Exception in HostFunction: java.lang.IllegalStateException: ViewPager2 does not support direct child views

"react-native": "0.76.2",
"react-native-screens": "4.2.0",
"@react-navigation/native": "7.0.3",

newArch enabled

looks like it's related to software-mansion/react-native-screens#2529

@MrRefactor
Copy link
Collaborator

this is an error from core/react-native-screens, for now please use patch as in this PR:
software-mansion/react-native-screens#2527, until facebook/react-native#47634 will be merged into core

@sankar-gp
Copy link
Author

sankar-gp commented Nov 21, 2024

Issue fixed in callstack/react-native-pager-view v6.5.1, Now i'm not observing the crash

https://github.com/callstack/react-native-pager-view/releases/tag/v6.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Needs Repro This issue could be improved with a demo to reproduce the issue.
Projects
None yet
Development

No branches or pull requests