mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-25 13:05:26 +08:00
Android fix for invisible stack views after navigating back (#341)
After fragment library upgrade we observed a regression caused by the screens that we navigate back to being invisible. This turned out to be a problem with view restore mechanism that we don't rely on. On native android the detached view state is dumped and then view's visibility is change to GONE after screen animated away. However, since we don't rely on view state restore and instead just reuse the whole view object, when navigating back we'd move to a view with visibility set to GONE. This change workarounds this problem in the method responsible for recycling views where we reset visibility flag back to VISIBLE.
This commit is contained in:
committed by
GitHub
parent
823d11e691
commit
cce8373a20
@@ -23,6 +23,10 @@ public class ScreenFragment extends Fragment {
|
||||
((ViewGroup) parent).endViewTransition(view);
|
||||
((ViewGroup) parent).removeView(view);
|
||||
}
|
||||
// view detached from fragment manager get their visibility changed to GONE after their state is
|
||||
// dumped. Since we don't restore the state but want to reuse the view we need to change visibility
|
||||
// back to VISIBLE in order for the fragment manager to animate in the view.
|
||||
view.setVisibility(View.VISIBLE);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,6 @@ public class ScreenStackFragment extends ScreenFragment {
|
||||
mFragment = fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAnimation(Animation animation) {
|
||||
super.startAnimation(animation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAnimationEnd() {
|
||||
super.onAnimationEnd();
|
||||
|
||||
Reference in New Issue
Block a user