UNPKG

react-native-navigation

Version:

React Native Navigation - truly native navigation for iOS and Android

30 lines (29 loc) 1.04 kB
"use strict"; import _ from 'lodash'; import { switchTabByIndex } from "../actions/layoutActions.js"; import ParentNode from "./ParentNode.js"; export default class BottomTabsNode extends ParentNode { constructor(layout, parentNode) { super(layout, 'BottomTabs', parentNode); this.selectedIndex = layout.data?.options?.bottomTabs?.currentTabIndex || 0; } mergeOptions(_options) { super.mergeOptions(_options); const { options } = this.data; if (options.bottomTabs?.currentTabIndex) { this.selectedIndex = options.bottomTabs?.currentTabIndex; switchTabByIndex(this, this.selectedIndex); } if (options.bottomTabs?.currentTabId) { const index = _.findIndex(this.children, child => child.nodeId === options?.bottomTabs?.currentTabId); if (index !== -1) this.selectedIndex = index; switchTabByIndex(this, this.selectedIndex); } } getVisibleLayout() { return this.children[this.selectedIndex].getVisibleLayout(); } } //# sourceMappingURL=BottomTabsNode.js.map