-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from kanzitelli/navio
`rn-navio` integration
- Loading branch information
Showing
20 changed files
with
328 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ web-build/ | |
.DS_Store | ||
|
||
*.env | ||
.eas.json | ||
eas.json | ||
_scripts/ | ||
.expo | ||
media/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,65 @@ | ||
import React from 'react'; | ||
import React, {useEffect} from 'react'; | ||
import {ScrollView} from 'react-native'; | ||
import {View} from 'react-native-ui-lib'; | ||
import {observer} from 'mobx-react'; | ||
import {useNavigation} from '@react-navigation/native'; | ||
import {NavioScreen} from 'rn-navio'; | ||
|
||
import {useServices} from '../services'; | ||
import {services, useServices} from '../services'; | ||
// import {useStores} from '../stores'; | ||
import {Section} from '../components/section'; | ||
import {BButton} from '../components/button'; | ||
import {useAppearance} from '../utils/hooks'; | ||
|
||
export type Props = { | ||
type?: 'push' | 'show'; | ||
type?: 'push'; | ||
}; | ||
export const Example: React.FC<Props> = observer(({type = 'push'}) => { | ||
|
||
export const Example: NavioScreen<Props> = observer(({type = 'push'}) => { | ||
useAppearance(); // for Dark Mode | ||
const {nav, t} = useServices(); | ||
const navigation = useNavigation(); | ||
const {t, navio} = useServices(); | ||
// const {ui} = useStores(); | ||
|
||
// State | ||
|
||
// Methods | ||
const push = () => nav.push('Example'); | ||
const show = () => nav.show('ExampleModal'); | ||
const goBack = async () => { | ||
nav.pop(); | ||
const push = () => navio.push('Example', {type: 'push'}); | ||
const pushStack = () => navio.pushStack('ExampleStack'); | ||
const jumpTo = () => navio.jumpTo('PlaygroundTab'); | ||
const show = () => navio.show('ExampleModal'); | ||
const setRoot = () => navio.setRoot('Tabs'); | ||
const goBack = () => navio.pop(); | ||
|
||
// Start | ||
useEffect(() => { | ||
configureUI(); | ||
}, []); | ||
|
||
// UI Methods | ||
const configureUI = () => { | ||
navigation.setOptions({}); | ||
}; | ||
|
||
// UI Methods | ||
|
||
return ( | ||
<View flex bg-bgColor> | ||
<ScrollView contentInsetAdjustmentBehavior="always"> | ||
<Section title={t.do('section.navigation.title')}> | ||
<BButton marginV-s1 label={t.do('section.navigation.button.push')} onPress={push} /> | ||
<BButton marginV-s1 label={t.do('section.navigation.button.show')} onPress={show} /> | ||
<BButton marginV-s1 label={t.do('section.navigation.button.back')} onPress={goBack} /> | ||
<Section title={t.do('section.navio.title')}> | ||
<BButton marginV-s1 label={t.do('section.navio.button.push')} onPress={push} /> | ||
<BButton marginV-s1 label={t.do('section.navio.button.push_stack')} onPress={pushStack} /> | ||
<BButton marginV-s1 label={t.do('section.navio.button.jump_to')} onPress={jumpTo} /> | ||
<BButton marginV-s1 label={t.do('section.navio.button.show')} onPress={show} /> | ||
<BButton marginV-s1 label={t.do('section.navio.button.back')} onPress={goBack} /> | ||
<BButton marginV-s1 label={'Set Root - Tabs'} onPress={setRoot} /> | ||
</Section> | ||
</ScrollView> | ||
</View> | ||
); | ||
}); | ||
|
||
Example.options = props => ({ | ||
headerBackTitleStyle: false, | ||
title: `${services.t.do('example.title')} ${(props?.route?.params as Props)?.type ?? ''}`, | ||
}); |
Oops, something went wrong.