Search in sources :

Example 1 with FabMenu

use of com.reactnativenavigation.views.stack.fab.FabMenu in project react-native-navigation by wix.

the class FabPresenter method createFab.

private void createFab(ViewController<?> component, FabOptions options) {
    ViewExtensionsKt.removeFromParent(fabMenu);
    ViewExtensionsKt.removeFromParent(fab);
    if (options.actionsArray.size() > 0) {
        fabMenu = new FabMenu(viewGroup.getContext(), options.id.get());
        setParams(component, fabMenu, options);
        applyFabMenuOptions(component, fabMenu, options);
        viewGroup.addView(fabMenu);
    } else {
        fab = new Fab(viewGroup.getContext(), options.id.get());
        setParams(component, fab, options);
        applyFabOptions(component, fab, options);
        viewGroup.addView(fab);
        fab.setOnClickListener(v -> component.sendOnNavigationButtonPressed(options.id.get()));
        UiUtils.doOnLayout(fab, () -> {
            fab.setPivotX(fab.getWidth() / 2f);
            fab.setPivotY(fab.getHeight() / 2f);
        });
    }
}
Also used : FabMenu(com.reactnativenavigation.views.stack.fab.FabMenu) Fab(com.reactnativenavigation.views.stack.fab.Fab)

Aggregations

Fab (com.reactnativenavigation.views.stack.fab.Fab)1 FabMenu (com.reactnativenavigation.views.stack.fab.FabMenu)1