What is the best practice for <ADLoginView>?
Hi, thanks for the useful plugin but I have a problem with app structure with react-native-azure-ad.
Basically, my problem is I don't know where is the best place to put <ADLoginView>.
My app's structure is like the below :
<Tabs />
HomeScreen, //<- Main page
ListScreen,
MapScreen
As you can see it's a simple structure. 3 screens on top of tabs.
However, in order to see each pages, you need to login.
I thought since user goes always HomeScreen from the beginning, the best place to put <ADLoginView> is in HomeScreen class.
//Home.js
render(){
if(this.state.auth){
return <View> //Show homeScreen
}else{ //Otherwise show login page
return <ADLoginView
context={ReactNativeAD.getContext(CLIENT_ID)}
onSuccess={this.onLoginSuccess.bind(this)}
hideAfterLogin={true}
needLogout={true}
/>
}
}
And once user is logged in onLoginSuccess fires I save token in the AsyncStorage.
But the problem is that the HomeScreen class is already rendered as login page. And I have to re-render the page ( I coundn't fine how to do it yet. ). But I feel this is not a proper way.
I checked example/index.ios.js from the this plugin's repository but couldn't fine any clue.
Can anybody explain me what can be the best solution for the app structure please?
Thank you.