Я интегрировал React Native Navigation с моим приложением React Native.Я обновил React Native Navigation до последней версии.Здесь мне нужно проверить условие перед
registerAppLaunchedListener
Как мне сделать это с помощью этого кода, код, который я написал, приведен ниже: *
async startApp() {
let currentUser = null;
let user = await AsyncStorage.getItem("CURRENT_USER");
if (user) {
this.startSingleScreenAppHandler(NavigationConstants.LOGIN, strings.login);
} else {
this.startSingleScreenAppHandler(NavigationConstants.INITIAL, strings.Text);
}
}
startSingleScreenAppHandler(screenId, screenTitle) {
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setDefaultOptions({
layout: {
componentBackgroundColor: colors.lightGrayishBlue,
orientation: ['portrait']
}
});
console.log(screenId);
Navigation.setRoot({
root: {
stack: {
id: 'TEST',
children: [
{
component: {
name: screenId,
options: {
topBar: {
title: {
text: screenTitle
}
}
}
}
}
]
}
}
});
});
}