mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-08 22:44:14 +08:00
Fix header transition on Android. (#284)
This change prevents toolbar from updating when there is a transition happening to the view. This fixes the issue where header subviews would disappear when going back from a given screen. The root cause was that the config view manager would trigger subviews removal and re-layout itself. As aresult if we had a custom back button that back button would get removed and the title would move into its place while the screen animation is running. In order to prevent that we hook into View Manager's onDropViewInstance to notify header config that it is about to be destroyed. This in turn prevents any updates to be made to the toolbar config.
This commit is contained in:
committed by
GitHub
parent
27ef6dc900
commit
f21ec66cb4
@@ -4,11 +4,12 @@ import android.view.View;
|
||||
|
||||
import com.facebook.react.bridge.JSApplicationCausedNativeException;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.ViewGroupManager;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ReactModule(name = ScreenStackHeaderConfigViewManager.REACT_CLASS)
|
||||
public class ScreenStackHeaderConfigViewManager extends ViewGroupManager<ScreenStackHeaderConfig> {
|
||||
|
||||
@@ -32,6 +33,11 @@ public class ScreenStackHeaderConfigViewManager extends ViewGroupManager<ScreenS
|
||||
parent.addConfigSubview((ScreenStackHeaderSubview) child, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDropViewInstance(@Nonnull ScreenStackHeaderConfig view) {
|
||||
view.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllViews(ScreenStackHeaderConfig parent) {
|
||||
parent.removeAllConfigSubviews();
|
||||
|
||||
Reference in New Issue
Block a user