Salve galera, o meu grande problema está nessa v2 do React Navigation, dá tela branca, se eu tento fazer algo parecido com o video:
Eu não tenho acesso daquele ''component'' dentro da função ''registerAppLaunchedListener"
Se eu dou um console ali, não consigo acessar o dado ''component" então logicamente não consigo fazer a transição dos components.
Segue o código:
/**
* @format
*/
import { Navigation } from 'react-native-navigation';
import AsyncStorage from '@react-native-community/async-storage';
import Login from './src/components/Login';
import App from './App';
Navigation.registerComponent('Login', () => Login);
Navigation.registerComponent('Feed', () => App);
AsyncStorage.getItem('token')
.then(token => {
if (token !== null) {
return {
name: 'Feed',
options: {
topBar: {
title: {
text: 'Feed'
}
}
}
};
} else {
return {
name: 'Login',
options: {
topBar: {
title: {
text: 'Login'
}
}
}
};
}
})
.then(component => {
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
stack: {
children: [
{
component: component
}
]
}
}
});
});
});