Issue
I used the createBottomTabNavigator, but I can't hide the bottom app bar on a specific screen
const StackHome = createStackNavigator(
{
Home: Home,
Autor: Autor,
Publicacion: Publicacion,
Comentarios: {
screen: Comentarios,
navigationOptions:{
// this should do the work, but it doesn't
tabBarVisible: false
}
}
}
);
Solution
Finally I got a solution that works, the component would be like this
import { createStackNavigator } from "react-navigation";
import Home from "./Home";
import Autor from "./Profile";
import Publicacion from "./Publicacion";
import Comentarios from "./Comentarios";
const StackHome = createStackNavigator({
Home: Home,
Autor: Autor,
Publicacion: Publicacion,
Comentarios: Comentarios
});
// This does the trick
StackHome.navigationOptions = ({ navigation }) => {
let tabBarVisible;
if (navigation.state.routes.length > 1) {
navigation.state.routes.map(route => {
if (route.routeName === "Comentarios") {
tabBarVisible = false;
} else {
tabBarVisible = true;
}
});
}
return {
tabBarVisible
};
};
export default StackHome;
Answered By - Rocco
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.