I have a TabNavigator component being used to nav between a private and public view within my app, with the logout method being implemented in a button on my tab bar. Since I've implemented my firebase auth, the navigator is sticking to the top of my private screen. The test views I've coded (colored background & text) to see where the views are rendering tell me they're displaying below the TabNavigator now.
My 'Welcome' view (what a successfully signed in user should see):
import React, { Component } from 'react';
import { View } from 'react-native';
// my components
import { Header, Card } from './common';
import Tabs from './TabNavigator';
class Welcome extends Component {
render() {
return (
<View>
<Tabs />
</View>
)
};
}
export default Welcome;
And finally, my App.js:
import React, { Component } from 'react';
import { View, Text, ScrollView } from 'react-native';
import { Header, Button, Spinner } from './components/common';
import firebase from 'firebase';
import Tabs from './components/TabNavigator';
// switch views
import LoginForm from './components/Login';
import Welcome from './components/Welcome';
class App extends Component {
state = {
loggedIn: null
};
// best time to initialize firebase is before the App.js renders
componentWillMount() {
firebase.initializeApp({
apiKey: "AIzaSyCx92Sr3Ap736MpsjDHPFeyH0pF3OMdOfk",
authDomain: "dont-forget-it-45fc1.firebaseapp.com",
databaseURL: "https://dont-forget-it-45fc1.firebaseio.com",
projectId: "dont-forget-it-45fc1",
storageBucket: "dont-forget-it-45fc1.appspot.com",
messagingSenderId: "145638025239"
});
// figuring out whether or not the user has just signed in or out
// decide which screen to display to a user dependent on auth
firebase.auth().onAuthStateChanged( (user) => {
if (user) {
this.setState({ loggedIn: true });
} else {
this.setState({ loggedIn: false });
}
});
}
// should handle the 3 different cases: null, true, false
// switch between
renderContent() {
switch( this.state.loggedIn ) {
case true:
return (
<View>
<Header headerText="inside"/>
<Tabs />
</View>
);
case false:
return (
<View>
<ScrollView>
<Header headerText="Welcome!" />
<LoginForm />
</ScrollView>
</View>
);
default: // case null: just keep spinning
return <View style={{ padding: 150 }}><Spinner size="large" /></View>;
};
}
render() {
return(
<View>
{ this.renderContent() }
</View>
)
}
};
export default App;
adding a position: 'absolute' style has changed nothing. Please advise...
I have a TabNavigator component being used to nav between a private and public view within my app, with the logout method being implemented in a button on my tab bar. Since I've implemented my firebase auth, the navigator is sticking to the top of my private screen. The test views I've coded (colored background & text) to see where the views are rendering tell me they're displaying below the TabNavigator now.
My TabNav component:
My 'Welcome' view (what a successfully signed in user should see):
And finally, my App.js:
adding a position: 'absolute' style has changed nothing. Please advise...