react-native-navigators
Advanced tools
Comparing version 0.3.0-13 to 0.3.0-14
import React from 'react'; | ||
import { NavigationRoute, NavigationParams } from 'react-navigation'; | ||
import { NativeNavigationDescriptor, NativeNavigationOptions, NativeNavigatorHeaderModes, NativeNavigatorModes } from './types'; | ||
import { NativeNavigationDescriptor, NativeNavigatorHeaderModes, NativeNavigatorModes } from './types'; | ||
export interface NativeSceneProps { | ||
@@ -14,6 +14,4 @@ closing: boolean; | ||
} | ||
export declare const NativeNavigationDescriptorContext: React.Context<{ | ||
options: NativeNavigationOptions; | ||
} | null>; | ||
export declare const NativeNavigationClosingStateContext: React.Context<boolean>; | ||
declare const _default: React.NamedExoticComponent<NativeSceneProps>; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
import React, { memo, createContext } from 'react'; | ||
import React, { memo, createContext, useContext } from 'react'; | ||
import { NativeNavigatorTransitions, NativeNavigatorHeaderModes, NativeNavigatorModes } from './types'; | ||
@@ -7,3 +7,5 @@ import NativeSceneView from './NativeSceneView'; | ||
import NativeStackSceneContainer from './NativeStackSceneContainer'; | ||
export const NativeNavigationDescriptorContext = createContext(null); | ||
// 'willBlur' event won't emit during the closing transition. | ||
// NativeNavigationClosingStateContext is convenient for some cases when you want to get the closing state for a scene. | ||
export const NativeNavigationClosingStateContext = createContext(false); | ||
export default memo(function NativeScene(props) { | ||
@@ -13,2 +15,3 @@ var _a, _b; | ||
const { key } = route; | ||
const closingContextState = useContext(NativeNavigationClosingStateContext); | ||
if (!descriptor) { | ||
@@ -33,3 +36,6 @@ return null; | ||
<NativeStackSceneContainer> | ||
<NativeSceneView screenProps={screenProps} navigation={navigation} component={descriptor.getComponent()}/> | ||
<NativeNavigationClosingStateContext.Provider value={closing || closingContextState}> | ||
<NativeSceneView screenProps={screenProps} navigation={navigation} component={descriptor.getComponent()}/> | ||
</NativeNavigationClosingStateContext.Provider> | ||
{headerMode === NativeNavigatorHeaderModes.Auto ? (<NativeHeader options={options} route={route}/>) : null} | ||
@@ -36,0 +42,0 @@ </NativeStackSceneContainer> |
{ | ||
"version": "0.3.0-13", | ||
"version": "0.3.0-14", | ||
"name": "react-native-navigators", | ||
@@ -52,3 +52,3 @@ "repository": { | ||
"prettier": "^1.18.2", | ||
"react-navigation": "^4.0.10", | ||
"react-navigation": "^4.4.3", | ||
"typescript": "^3.7.3" | ||
@@ -55,0 +55,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
353780
3390