Skip to content

Commit

Permalink
Navio section with all nav actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kanzitelli committed Feb 15, 2023
1 parent b79011d commit 03c3b13
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions src/components/sections/NavioSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React from 'react';
import {Text} from 'react-native-ui-lib';
import {useServices} from '../../services';
import {BButton} from '../button';
import {Section} from '../section';

type Props = {};

export const NavioSection: React.FC<Props> = ({}) => {
const {t, navio} = useServices();

// Methods
const pushScreen = () => navio.push('Example', {type: 'push'});
const goBack = () => navio.goBack();
const globalSetRoot = () => navio.setRoot('tabs', 'AppTabs');
const stacksPush = () => navio.stacks.push('ProductPageStack');
const stacksSetRoot = () => navio.stacks.setRoot('MainStack');
const tabsJumpTo = () => navio.tabs.jumpTo('PlaygroundTab');
const tabsSetRoot = () => navio.tabs.setRoot('AppTabs');
const drawersToggle = () => navio.drawers.toggle();
const drawersJumpTo = () => navio.drawers.jumpTo('Playground');
const drawersSetRoot = () => navio.drawers.setRoot('MainDrawer');
const modalsShow = () => navio.modals.show('ExampleModal');

return (
<Section title={t.do('section.navio.title')}>
<Text text60R textColor>
Common
</Text>
<BButton marginV-s1 label={t.do('section.navio.button.common.push')} onPress={pushScreen} />
<BButton marginV-s1 label={t.do('section.navio.button.common.go_back')} onPress={goBack} />
<BButton
marginV-s1
label={t.do('section.navio.button.common.set_root')}
onPress={globalSetRoot}
/>

<Text marginT-s4 text60R textColor>
Stacks
</Text>
<BButton marginV-s1 label={t.do('section.navio.button.stacks.push')} onPress={stacksPush} />
<BButton
marginV-s1
label={t.do('section.navio.button.stacks.set_root')}
onPress={stacksSetRoot}
/>

<Text marginT-s4 text60R textColor>
Tabs
</Text>
<BButton marginV-s1 label={t.do('section.navio.button.tabs.jump_to')} onPress={tabsJumpTo} />
<BButton
marginV-s1
label={t.do('section.navio.button.tabs.set_root')}
onPress={tabsSetRoot}
/>

<Text marginT-s4 text60R textColor>
Drawers
</Text>
<BButton
marginV-s1
label={t.do('section.navio.button.drawers.toggle')}
onPress={drawersToggle}
/>
<BButton
marginV-s1
label={t.do('section.navio.button.drawers.jump_to')}
onPress={drawersJumpTo}
/>
<BButton
marginV-s1
label={t.do('section.navio.button.drawers.set_root')}
onPress={drawersSetRoot}
/>

<Text marginT-s4 text60R textColor>
Modals
</Text>
<BButton marginV-s1 label={t.do('section.navio.button.modals.show')} onPress={modalsShow} />
</Section>
);
};

0 comments on commit 03c3b13

Please sign in to comment.