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

Expecting View State but received class androidx.recyclerview.widget.RecyclerView$SavedState instead

Open cojj90 opened this issue 4 years ago • 4 comments

Environment

image

Description

I think the app is crashing on start but its not easily replicable. I believe the problem is happening because ViewPager inflate views and assign dynamically-generated ids to them. (ref: https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-collection-release/viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java?source=post_page---------------------------#146)

Is there anything we can do to mitigate this crash?

cojj90 avatar Apr 21 '21 23:04 cojj90

@cojj90 do you know, how to reproduce it ? Pager does not save the view state:
https://github.com/callstack/react-native-pager-view/blob/master/android/src/main/java/com/reactnativepagerview/PagerViewViewManager.kt#L53

troZee avatar Jul 22 '21 12:07 troZee

@cojj90 could you check https://github.com/callstack/react-native-pager-view/releases/tag/v5.4.0, if this version fixes your issue ? I am closing it right now. In case of any problems, I will reopen this issue

troZee avatar Jul 26 '21 15:07 troZee

Hi @troZee Screenshot 2021-07-27 at 1 52 24 PM

We tried to update to v5.4.0 which release today, but problem still exist To reproduce this issue, we will use below steps

  1. Find some lower end android device (We can reproduce using Samsung C9)
  2. Open the app
  3. Put the app to background
  4. Open Android Developer mode
  5. Inactive apps
  6. Select the app and inactive it
  7. Reopen from background
  8. App crash

conradchenghk01 avatar Jul 27 '21 02:07 conradchenghk01

@troZee any updates on this please ? Got the same crash in 5.4.15, happens when backgrounding the app on a screen using the pager-view & relogging in after timeout

distributedinfinity avatar May 17 '22 14:05 distributedinfinity