Main App.js <View> render at last on top of whole application which has to render first
Hello @ericvicenti @jmurzy @satya164
I'm working on an app with React Native 0.30.0 and React 15.2.1. [NavigationExperimental] Migrate NavigationCardStack to NavigationTransitioner In first application i use NavigationCardStack it works well it cover whole screen with Animated.View Style. Below is the inspector screenshot.

It contain the whole screen before and it works well for both platform iOS and Android.
But now i am working on another app in which i used directly NavigationTransitioner but what happens is like it won't contain the whole screen and it just render everything but SceneView contain only the thing which screen has. Here is the screenshot.


And if i run same thing is android output is below.

I am using redux for handle navigation state.
Here is the code :
'use strict';
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
NavigationExperimental,
TouchableOpacity,
Platform,
BackAndroid
} from 'react-native'
import Button from '../Components/Button'
import Icon from 'react-native-vector-icons/FontAwesome'
import Metrics from '../Themes/Metrics'
import { connect } from 'react-redux';
import { actions } from 'react-native-navigation-redux-helpers';
import Home from './Home';
import About from './About';
// import Login from './Login';
const {
popRoute,
pushRoute
} = actions;
const {
Transitioner: NavigationTransitioner,
Header: NavigationHeader,
Card: NavigationCard,
AnimatedView: NavigationAnimatedView
} = NavigationExperimental;
const APPBAR_HEIGHT = Platform.OS === 'ios' ? 44 : 56;
const STATUSBAR_HEIGHT = Platform.OS === 'ios' ? 20 : 10;
class First extends Component {
constructor(props) {
super(props);
this._renderHeader = this._renderHeader.bind(this)
}
render() {
return (
<NavigationTransitioner
style={{flex: 1}}
onNavigate= { () => {} }
direction={'horizontal'}
navigationState={this.props.navigation}
render={props => (
<View style={{flex: 1}}>
<NavigationCard
{...props}
style={styles.main}
panHandlers={null}
renderScene={this._renderScene.bind(this)}
key={props.scene.route.key}
/>
{this._renderHeader(props)}
</View>
)}
/>
);
}
_renderScene(props) {
const { route } = props.scene;
if (route.key === 'home') {
return (
<Home gotoLogin={this._gotoLogin.bind(this)} gotoAbout={this._gotoAbout.bind(this)} />
)
}
if (route.key === 'about') {
return (
<About gotoBack={this._gotoback.bind(this)}/>
)
}
if (route.key === 'tab') {
return (
<TabView gotoBack={this._gotoback.bind(this)} />
)
}
// if (route.key === 'login') {
// return (
// <Login />
// )
// }
}
_renderHeader(props) {
const { route } = props.scene;
const showHeader = route.title
if (showHeader) {
return (
<NavigationHeader
{...props}
style={styles.appbar}
renderTitleComponent={this._renderTitleComponent.bind(this)}
renderLeftComponent={this._renderLeftComponent.bind(this)}
renderRightComponent={this._renderRightComponent.bind(this)}
/>
);
}
return null;
}
_renderTitleComponent(props) {
const { route } = props.scene;
return (
<NavigationHeader.Title style={styles.title} textStyle={styles.titleText}>
{route.title}
</NavigationHeader.Title>
)
}
_renderLeftComponent(props) {
const { dispatch, navigation } = this.props;
const { route } = props.scene
if (route.key === 'about') {
return (
<View style={styles.titleWrapper}>
<TouchableOpacity onPress={this._gotoback.bind(this)}>
<Icon name='angle-left'
size={25}
color={"#FFFFFF"}
style={styles.navButtonLeft}
/>
</TouchableOpacity>
</View>
);
}
return null;
}
_renderRightComponent(props) {
return null;
}
_gotoAbout() {
const { dispatch } = this.props;
dispatch(pushRoute({
key: 'about',
title: 'About',
showBackButton: true
}, 'first'))
}
_gotoLogin() {
const { dispatch } = this.props;
dispatch(pushRoute({
key: 'login'
}, 'first'))
}
_gotoback() {
const { dispatch, navigation } = this.props;
dispatch(popRoute(navigation.key))
}
}
const styles = StyleSheet.create({
main: {
backgroundColor: '#E9E9EF',
bottom: 0,
left: 0,
position: 'absolute',
right: 0,
shadowColor: 'black',
shadowOffset: {width: 0, height: 0},
shadowOpacity: 0.4,
shadowRadius: 10,
top: 0,
},
navButtonLeft: {
margin: Metrics.baseMargin,
marginLeft: 10,
marginTop: Platform.OS === 'ios' ? 15 : 10,
color:'#FFFFFF',
marginBottom: Platform.OS === 'ios' ? 10 : 0
},
titleWrapper: {
bottom: Platform.OS === 'ios' ? 10 : 10,
top: Platform.OS === 'ios' ? 0 : 20,
justifyContent: 'center',
alignItems: 'center'
},
appbar: {
alignItems: 'center',
backgroundColor: Platform.OS === 'ios' ? '#03A9F4' : '#03A9F4',
borderBottomColor: 'rgba(0, 0, 0, .15)',
borderBottomWidth: Platform.OS === 'ios' ? StyleSheet.hairlineWidth : 0,
elevation: 4,
flexDirection: 'row',
height: APPBAR_HEIGHT + STATUSBAR_HEIGHT,
justifyContent: 'flex-start',
left: 0,
marginBottom: 15, // This is needed for elevation shadow
position: 'absolute',
right: 0,
top: 0,
},
title: {
bottom: Platform.OS === 'ios' ? 10 : 10,
left: APPBAR_HEIGHT,
marginTop: STATUSBAR_HEIGHT,
position: 'absolute',
right: APPBAR_HEIGHT,
top: Platform.OS === 'ios' ? 0 : 20
},
titleText: {
color: 'white',
textAlign: 'center'
}
})
function mapDispatchToProps(dispatch) {
return {
dispatch,
onNavigate() {
console.log('@@ onNavigate', arguments);
}
};
}
function mapStateToProps(state) {
return {
navigation: state.firstNavigation
}
}
export default connect(mapStateToProps, mapDispatchToProps)(First)
I found that it's not issue with NavigationCard it's an issue with StatusBar Container.
e.g
F8App.js
<View style={styles.container}>
<StatusBar
translucent={true}
backgroundColor="rgba(0, 0, 0, 0.2)"
barStyle="light-content"
/>
<F8Navigator /> // This is my appNavigator which render inside Main View Container
<PushNotificationsController />
</View>
In my case everything render first and on top of everything it renders above
cc @janicduplessis who might have an idea about the StatusBar component
Thanks @satya164 i appreciate that you noticed i have not resolve that issue yet but i just apply
https://github.com/thebakeryio/react-native-navigation-redux-helpers
this for handling navigation state in different reducer so i have main global navigation in which i used NavigationCardStack and in that i have just one route so i add StatusBar before that component and it works but still that's not the best approach so still i am looking for a way to work. And also i show your blog about NavigationExperimental
https://medium.com/@satya164/react-natives-navigationexperimental-with-redux-467acee02756#.k38hveq5y
so i was bit confuse here that if i go with https://github.com/thebakeryio/react-native-navigation-redux-helpers his approach or not ?
Because in my application i have Startup screen, login, TabBar and much more so if you can direct me to the best approach!!
Thank you @satya164
By mistake i closed it. It's not resolve yet
@satya164 can you please give your view on my approach?
@facebook-github-bot label Icebox
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/main-appjs-view-render-at-last-on-top-of-whole-application-which-has-to-render-first
ProductPains helps the community prioritize the most important issues thanks to its voting feature. It is easy to use - just login with GitHub.
Also, if this issue is a bug, please consider sending a PR with a fix. We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.
@facebook-github-bot close
@charpeni tells me to close this issue. If you think it should still be opened let us know why.