Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
private PermissionListener mPermissionListener;

protected Navigator navigator;
protected RootPresenter rootPresenter;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -39,11 +40,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
return;
}
addDefaultSplashLayout();
rootPresenter = new RootPresenter();
navigator = new Navigator(this,
new ChildControllersRegistry(),
new ModalStack(this),
new OverlayManager(),
new RootPresenter()
rootPresenter
);
navigator.bindViews();
getReactGateway().onActivityCreated(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class RootPresenter {
private final RootAnimator animator;
private CoordinatorLayout rootLayout;
private final LayoutDirectionApplier layoutDirectionApplier;
private boolean setRootCalled = false;

public void setRootContainer(CoordinatorLayout rootLayout) {
this.rootLayout = rootLayout;
Expand All @@ -28,13 +29,18 @@ public RootPresenter() {
this(new RootAnimator(), new LayoutDirectionApplier());
}

public boolean setRootCalled() {
return setRootCalled;
}

@VisibleForTesting
public RootPresenter(RootAnimator animator, LayoutDirectionApplier layoutDirectionApplier) {
this.animator = animator;
this.layoutDirectionApplier = layoutDirectionApplier;
}

public void setRoot(ViewController appearingRoot, ViewController<?> disappearingRoot, Options defaultOptions, CommandListener listener, ReactInstanceManager reactInstanceManager) {
setRootCalled = true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to move this into animateSetRootAndReportSuccess, right before the listener.onSuccess calls. And you'll need 2 lines of it, one in each block.

layoutDirectionApplier.apply(appearingRoot, defaultOptions, reactInstanceManager);
rootLayout.addView(appearingRoot.getView(), matchParentWithBehaviour(new BehaviourDelegate(appearingRoot)));
Options options = appearingRoot.resolveCurrentOptions(defaultOptions);
Expand Down