Last active
April 27, 2020 13:49
-
-
Save xxRockOnxx/5bed9bac44d867e7ffabdbdb223b95a1 to your computer and use it in GitHub Desktop.
React Native Navigation with react-native-vector-icons
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
interface Layouts { | |
[name: string]: LayoutRoot; | |
} | |
const layouts: Promise<Layouts> = new Promise(resolve => { | |
Promise.all([ | |
Icon.getImageSource("people"), | |
Icon.getImageSource("message") | |
]).then(icons => { | |
resolve({ | |
auth: { | |
root: { | |
component: { | |
name: "auth.LoginScreen" | |
} | |
} | |
}, | |
home: { | |
root: { | |
bottomTabs: { | |
id: "BottomTabs", | |
children: [ | |
{ | |
stack: { | |
children: [ | |
{ | |
component: { | |
name: "collab.CollabScreen" | |
} | |
} | |
], | |
options: { | |
bottomTab: { | |
text: "Collab", | |
icon: icons[0] | |
} | |
} | |
} | |
}, | |
{ | |
stack: { | |
children: [ | |
{ | |
component: { | |
name: "messages.MessagesScreen" | |
} | |
} | |
], | |
options: { | |
bottomTab: { | |
text: "Messages", | |
icon: icons[1] | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
}); | |
}); | |
}); | |
export function goToAuthScreen() { | |
layouts.then(({ auth }) => { | |
Navigation.setRoot(auth); | |
}); | |
} | |
export function goToHomeScreen() { | |
layouts.then(({ home }) => { | |
Navigation.setRoot(home); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, it helps me.
P.S. I have integrated it together with
react-native-dark-theme
andreact-native-navigation
works pretty bad with style changing on the fly.