feat(context): refactor passing navigation context (#3668)

* feat(context): refactor passing navigation context

* remove commented code in example

* adjust src/views/withNavigationFocus.js

* refactor stuff

* extract scene to variable

* Add test

* Apply CR comments

* remove junk

* bring back screen mode header
This commit is contained in:
Michał Pierzchała
2018-03-15 18:55:00 +01:00
committed by Brent Vatne
parent fd75e9c14c
commit fcbf78e658
9 changed files with 108 additions and 45 deletions

View File

@@ -15,6 +15,7 @@ import Card from './StackViewCard';
import Header from '../Header/Header';
import NavigationActions from '../../NavigationActions';
import SceneView from '../SceneView';
import { NavigationProvider } from '../NavigationContext';
import TransitionConfigs from './StackViewTransitionConfigs';
import * as ReactNativeFeatures from '../../utils/ReactNativeFeatures';
@@ -194,9 +195,11 @@ class StackViewLayout extends React.Component {
let floatingHeader = null;
const headerMode = this._getHeaderMode();
if (headerMode === 'float') {
floatingHeader = this._renderHeader(
this.props.transitionProps.scene,
headerMode
const { scene } = this.props.transitionProps;
floatingHeader = (
<NavigationProvider value={scene.descriptor.navigation}>
{this._renderHeader(scene, headerMode)}
</NavigationProvider>
);
}
const {