react-native: 0.61.5
Library version: 3.2.0
See the issue:

Repro: https://github.com/ferrannp/react-native-viewpager-detach-example
When navigating to another screen with react-navigation (e.g to another tab), onDetachedFromWindow is called. When we come back to the view that has the ViewPager, this code is called:
However, it seems to be called too late and the Pager gets broken. I tried the following solution:
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
// The viewpager reset an internal flag on this method so we need to run another layout pass
// after attaching to window.
this.requestLayout();
// CODE CHANGES BELOW
measure(
MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
layout(getLeft(), getTop(), getRight(), getBottom());
}
And it works. However, I am not sure this is the best solution. I know @kmagiera did something similar before with Pager so I am just CCing you here. Maybe @satya164 @NoemiRozpara you found this before when working with react-navigation and ViewPager? I'll also CC @ruiaraujo which implemented this piece of code 2 years ago 馃槃 .
FYI I will not be able to help. This was one of the last bug fixes I did and I recall nothing. :man_shrugging:
Using this for now, can't comment on whether or not it's the best solution but can confirm it works! Thanks @ferrannp
@sparsityc I think this is the same bug right?
@troZee this is a really strange bug do you know how to fix this?