react-native-navigators
Advanced tools
Comparing version 0.1.2 to 0.1.4
export * from './createNavigators'; | ||
export * from './types'; | ||
export { NativeNavigationClosingStateContext } from './NativeScene'; |
export * from './createNavigators'; | ||
export * from './types'; | ||
export { NativeNavigationClosingStateContext } from './NativeScene'; | ||
//# sourceMappingURL=index.js.map |
@@ -47,3 +47,2 @@ import React, { PureComponent } from 'react'; | ||
static getDerivedStateFromProps(props, state) { | ||
var _a; | ||
const { navigation, screenProps } = props; | ||
@@ -62,3 +61,3 @@ if (navigation.state.routes === state.propRoutes && screenProps === state.screenProps && state.routes.length) { | ||
const nextFocusedRoute = routes[routes.length - 1]; | ||
if (closingRouteKey === ((_a = previousFocusedRoute) === null || _a === void 0 ? void 0 : _a.key)) { | ||
if (closingRouteKey === (previousFocusedRoute === null || previousFocusedRoute === void 0 ? void 0 : previousFocusedRoute.key)) { | ||
// During a closing transition, just update the routes state. | ||
@@ -65,0 +64,0 @@ routes = [...routes, previousFocusedRoute]; |
@@ -9,3 +9,3 @@ import { PureComponent } from 'react'; | ||
descriptors: NativeNavigationDescriptorMap; | ||
screenProps?: any; | ||
screenProps?: unknown; | ||
onOpenRoute: (route: NavigationRoute) => void; | ||
@@ -12,0 +12,0 @@ onCloseRoute: (route: NavigationRoute) => void; |
import React, { PureComponent } from 'react'; | ||
import { NativeNavigatorTransitions, NativeNavigatorHeaderModes, NativeNavigatorModes } from './types'; | ||
import NativeSceneView from './NativeSceneView'; | ||
import NativeStackScene from './NativeStackScene'; | ||
import NativeHeader from './NativeHeader'; | ||
import NativeStackSceneContainer from './NativeStackSceneContainer'; | ||
import NativeScene from './NativeScene'; | ||
export default class NativeScenes extends PureComponent { | ||
@@ -28,29 +24,7 @@ constructor() { | ||
render() { | ||
const { routes, descriptors, screenProps, mode, closingRouteKey } = this.props; | ||
const { routes, descriptors, screenProps, mode, closingRouteKey, headerMode } = this.props; | ||
return (<> | ||
{routes.map(route => { | ||
var _a, _b; | ||
const { key } = route; | ||
const descriptor = descriptors[key]; | ||
if (!descriptor) { | ||
return null; | ||
} | ||
const { options, navigation } = descriptor; | ||
let headerMode = options.headerHidden | ||
? NativeNavigatorHeaderModes.None | ||
: this.props.headerMode; | ||
if (mode === NativeNavigatorModes.Stack) { | ||
headerMode = headerMode || NativeNavigatorHeaderModes.Auto; | ||
} | ||
else { | ||
headerMode = headerMode || NativeNavigatorHeaderModes.None; | ||
} | ||
const SceneComponent = descriptor.getComponent(); | ||
return (<NativeStackScene key={key} transition={((_b = (_a = navigation.dangerouslyGetParent()) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.isTransitioning) ? | ||
(options.transition || NativeNavigatorTransitions.Default) : NativeNavigatorTransitions.None} closing={closingRouteKey === route.key} gestureEnabled={options.gestureEnabled !== false} translucent={options.translucent === true} transparent={options.transparent === true} onDidFocus={this.handleDidFocus} onDidBlur={this.handleDidBlur} route={route} style={options.cardStyle} statusBarStyle={options.statusBarStyle} statusBarHidden={options.statusBarHidden}> | ||
<NativeStackSceneContainer> | ||
<NativeSceneView screenProps={screenProps} navigation={navigation} component={SceneComponent}/> | ||
{headerMode === NativeNavigatorHeaderModes.Auto ? (<NativeHeader descriptor={descriptor} route={route}/>) : null} | ||
</NativeStackSceneContainer> | ||
</NativeStackScene>); | ||
const descriptor = descriptors[route.key]; | ||
return (<NativeScene key={route.key} closing={closingRouteKey === route.key} descriptor={descriptor} route={route} screenProps={screenProps} mode={mode} headerMode={headerMode} onDidFocus={this.handleDidFocus} onDidBlur={this.handleDidBlur}/>); | ||
})} | ||
@@ -57,0 +31,0 @@ </>); |
{ | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"name": "react-native-navigators", | ||
@@ -4,0 +4,0 @@ "repository": { |
export * from './createNavigators'; | ||
export * from './types'; | ||
export { NativeNavigationClosingStateContext } from './NativeScene'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2784
257868
162
1