diff --git a/Libraries/NavigationExperimental/NavigationView.js b/Libraries/NavigationExperimental/NavigationView.js index 91fea56cf..157e1d36d 100644 --- a/Libraries/NavigationExperimental/NavigationView.js +++ b/Libraries/NavigationExperimental/NavigationView.js @@ -37,6 +37,7 @@ type Props = { }; type State = { + layout: NavigationLayout, scenes: Array, }; @@ -47,7 +48,6 @@ const {PropTypes} = React; * The most common use-case is for tabs, where no transition is needed */ class NavigationView extends React.Component { - _layout: NavigationLayout; _onLayout: (event: any) => void; _position: NavigationAnimatedValue; @@ -63,9 +63,10 @@ class NavigationView extends React.Component { constructor(props: Props, context: any) { super(props, context); - this._layout = { + const layout = { initWidth: 0, initHeight: 0, + isMeasured: false, width: new Animated.Value(0), height: new Animated.Value(0), }; @@ -75,6 +76,7 @@ class NavigationView extends React.Component { this._position = new Animated.Value(navigationState.index); this.state = { + layout, scenes: NavigationScenesReducer([], navigationState), }; } @@ -116,11 +118,12 @@ class NavigationView extends React.Component { } = this.props; const { + layout, scenes, } = this.state; const sceneProps = { - layout: this._layout, + layout, navigationState: navigationState, onNavigate: onNavigate, position: this._position, @@ -150,14 +153,16 @@ class NavigationView extends React.Component { const {height, width} = event.nativeEvent.layout; const layout = { - ...this._layout, + ...this.state.layout, initHeight: height, initWidth: width, + isMeasured: true, }; - this._layout = layout; layout.height.setValue(height); layout.width.setValue(width); + + this.setState({ layout }); } }