I have my main view with my views and my toolbar. What I would like to do is when I click on a tab, it will reset the view as it was before navigating inside.
Example:
I click on the lower Categories tab
I click on a specific category
I click again on the lower Categories tab
My routes are in a routes.js file.
I would like the view to return to the list of categories
I want the same behavior on the other tabs
How can I do that ?
Thanks
render() {
const mainViewProps = { main: true, tabActive: true };
const defaultLinkProps = { tabLinkActive: true, ref: this.mainPageLink };
return (
<TabContext.Provider value={this.state}>
<Views tabs>
<View
id="tab-today"
name="today"
onTabShow={() => this.setState({ currentTab: 'today' })}
tab
{...(mainTab === 'today' ? mainViewProps : {})}
>
<TodayPage onReady={this.closeSplashScreen} />
</View>
<View
id="tab-categories"
name="categories"
onTabShow={() => this.setState({ currentTab: 'categories' })}
tab
{...(mainTab === 'categories' ? mainViewProps : {})}
>
<CategoriesPage />
</View>
<View
id="tab-community"
name="community"
onTabShow={() => this.setState({ currentTab: 'community' })}
tab
{...(mainTab === 'community' ? mainViewProps : {})}
>
<CommunityPage />
</View>
<View
id="tab-search"
name="search"
onTabShow={() => this.setState({ currentTab: 'search' })}
tab
{...(mainTab === 'search' ? mainViewProps : {})}
>
<SearchPage />
</View>
<View
id="tab-settings"
name="settings"
onTabShow={() => this.setState({ currentTab: 'settings' })}
tab
{...(mainTab === 'settings' ? mainViewProps : {})}
>
<SettingsPage />
</View>
<Toolbar tabbar labels position="bottom">
<Link
tabLink="#tab-today"
style={{ order: tabOrder.indexOf('today') }}
{...(mainTab === 'today' ? defaultLinkProps : {})}
>
<i className="icon ion-ios-today" />
<span className="tabbar-label">
<FormattedMessage id="press_yui_tabs_today" />
</span>
</Link>
<Link
tabLink="#tab-categories"
style={{ order: tabOrder.indexOf('categories') }}
{...(mainTab === 'categories' ? defaultLinkProps : {})}
>
<i className="icon ion-ios-apps" />
<span className="tabbar-label">
<FormattedMessage id="press_yui_tabs_categories" />
</span>
</Link>
<Link
tabLink="#tab-community"
style={{ order: tabOrder.indexOf('community') }}
{...(mainTab === 'community' ? defaultLinkProps : {})}
>
<i className="icon ion-ios-people" />
<span className="tabbar-label">
<FormattedMessage id="press_yui_tabs_community" />
</span>
</Link>
<Link
tabLink="#tab-search"
style={{ order: tabOrder.indexOf('search') }}
{...(mainTab === 'search' ? defaultLinkProps : {})}
>
<i className="icon ion-ios-search" />
<span className="tabbar-label">
<FormattedMessage id="press_yui_tabs_search" />
</span>
</Link>
<Link
tabLink="#tab-settings"
style={{ order: tabOrder.indexOf('settings') }}
{...(mainTab === 'settings' ? defaultLinkProps : {})}
>
<i className="icon ion-ios-cog" />
<span className="tabbar-label">
<FormattedMessage id="press_yui_tabs_settings" />
</span>
</Link>
</Toolbar>
</Views>
</TabContext.Provider>