react-native-navigators
Advanced tools
Comparing version 0.0.6 to 0.1.0
@@ -5,4 +5,3 @@ import { NavigationRouteConfigMap } from 'react-navigation'; | ||
export declare function createStackNavigator(routeConfigMap: NavigationRouteConfigMap<NativeNavigationOptions, any>, stackConfig: Omit<NavigationNativeRouterConfig, 'mode'>): import("react-navigation").NavigationNavigator<NavigationNativeRouterConfig, import("react-navigation").NavigationProp<import("react-navigation").NavigationState>>; | ||
export declare function createModalNavigator(routeConfigMap: NavigationRouteConfigMap<NativeNavigationOptions, any>, stackConfig: Omit<NavigationNativeRouterConfig, 'headerMode' | 'mode'>): import("react-navigation").NavigationNavigator<NavigationNativeRouterConfig, import("react-navigation").NavigationProp<import("react-navigation").NavigationState>>; | ||
export declare function createCardNavigator(routeConfigMap: NavigationRouteConfigMap<NativeNavigationOptions, any>, stackConfig: Omit<NavigationNativeRouterConfig, 'headerMode' | 'mode'>): import("react-navigation").NavigationNavigator<NavigationNativeRouterConfig, import("react-navigation").NavigationProp<import("react-navigation").NavigationState>>; | ||
export declare function createSplitNavigator(routeConfigMap: NavigationRouteConfigMap<NativeNavigationOptions, any>, stackConfig: Omit<NavigationNativeRouterConfig, 'headerMode' | 'mode'>): import("react-navigation").NavigationNavigator<NavigationNativeRouterConfig, import("react-navigation").NavigationProp<import("react-navigation").NavigationState>>; |
@@ -12,6 +12,2 @@ import { createNavigator, StackRouter } from 'react-navigation'; | ||
} | ||
export function createModalNavigator(routeConfigMap, stackConfig) { | ||
const router = StackRouter(routeConfigMap, stackConfig); | ||
return createNavigator(NativeNavigators, router, Object.assign(Object.assign({}, stackConfig), { mode: NativeNavigatorModes.Modal })); | ||
} | ||
export function createCardNavigator(routeConfigMap, stackConfig) { | ||
@@ -18,0 +14,0 @@ const router = StackRouter(routeConfigMap, stackConfig); |
@@ -47,2 +47,3 @@ import React, { PureComponent } from 'react'; | ||
static getDerivedStateFromProps(props, state) { | ||
var _a; | ||
const { navigation, screenProps } = props; | ||
@@ -61,3 +62,3 @@ if (navigation.state.routes === state.propRoutes && screenProps === state.screenProps && state.routes.length) { | ||
const nextFocusedRoute = routes[routes.length - 1]; | ||
if (closingRouteKey === (previousFocusedRoute === null || previousFocusedRoute === void 0 ? void 0 : previousFocusedRoute.key)) { | ||
if (closingRouteKey === ((_a = previousFocusedRoute) === null || _a === void 0 ? void 0 : _a.key)) { | ||
// During a closing transition, just update the routes state. | ||
@@ -90,3 +91,3 @@ routes = [...routes, previousFocusedRoute]; | ||
const { closingRouteKey, routes, descriptors, screenProps } = this.state; | ||
const mode = navigationConfig.mode || NativeNavigatorModes.Modal; | ||
const mode = navigationConfig.mode || NativeNavigatorModes.Stack; | ||
return (<NativeStackNavigator mode={mode}> | ||
@@ -93,0 +94,0 @@ <NativeScenes mode={mode} headerMode={navigationConfig.headerMode} routes={routes} descriptors={descriptors} navigation={navigation} screenProps={screenProps} onOpenRoute={this.handleOpenRoute} onCloseRoute={this.handleCloseRoute} onDismissRoute={this.handleDismissRoute} closingRouteKey={closingRouteKey}/> |
@@ -49,3 +49,3 @@ import React, { PureComponent } from 'react'; | ||
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} popover={options.popover} onDidFocus={this.handleDidFocus} onDidBlur={this.handleDidBlur} route={route} style={options.cardStyle} statusBarStyle={options.statusBarStyle} statusBarHidden={options.statusBarHidden}> | ||
(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> | ||
@@ -52,0 +52,0 @@ <NativeSceneView screenProps={screenProps} navigation={navigation} component={SceneComponent}/> |
@@ -20,5 +20,2 @@ import React, { useState } from 'react'; | ||
break; | ||
case NativeNavigatorModes.Modal: | ||
Navigator = RNNativeModalNavigator; | ||
break; | ||
default: | ||
@@ -31,4 +28,3 @@ Navigator = RNNativeStackNavigator; | ||
const RNNativeStackNavigator = requireNativeComponent('RNNativeStackNavigator'); | ||
const RNNativeModalNavigator = requireNativeComponent('RNNativeModalNavigator'); | ||
const RNNativeCardNavigator = requireNativeComponent('RNNativeCardNavigator'); | ||
//# sourceMappingURL=NativeStackNavigator.js.map |
import { PureComponent } from 'react'; | ||
import { StyleProp, ViewStyle } from 'react-native'; | ||
import { NavigationRoute } from 'react-navigation'; | ||
import { NativeNavigatorTransitions, NativeNavigationPopover, NativeNavigationStatusBarStyle } from './types'; | ||
import { NativeNavigatorTransitions, NativeNavigationStatusBarStyle } from './types'; | ||
interface NativeStackNavigatorProps { | ||
@@ -11,3 +11,2 @@ closing: boolean; | ||
gestureEnabled: boolean; | ||
popover?: NativeNavigationPopover; | ||
onDidFocus: (route: NavigationRoute) => void; | ||
@@ -14,0 +13,0 @@ onDidBlur: (route: NavigationRoute, dismissed: boolean) => void; |
@@ -22,4 +22,4 @@ import React, { PureComponent } from 'react'; | ||
render() { | ||
const { closing, translucent, transparent, transition, gestureEnabled, popover, style, statusBarStyle, statusBarHidden } = this.props; | ||
return (<RNNativeStackScene closing={closing} translucent={translucent} transparent={transparent} transition={transition} gestureEnabled={gestureEnabled} popover={popover} onDidFocus={this.onDidFocus} onDidBlur={this.onDidBlur} style={style ? [style, StyleSheet.absoluteFill] : StyleSheet.absoluteFill} statusBarStyle={statusBarStyle} statusBarHidden={statusBarHidden}> | ||
const { closing, translucent, transparent, transition, gestureEnabled, style, statusBarStyle, statusBarHidden } = this.props; | ||
return (<RNNativeStackScene closing={closing} translucent={translucent} transparent={transparent} transition={transition} gestureEnabled={gestureEnabled} onDidFocus={this.onDidFocus} onDidBlur={this.onDidBlur} style={style ? [style, StyleSheet.absoluteFill] : StyleSheet.absoluteFill} statusBarStyle={statusBarStyle} statusBarHidden={statusBarHidden}> | ||
{this.props.children} | ||
@@ -26,0 +26,0 @@ </RNNativeStackScene>); |
import { ReactNode } from 'react'; | ||
import { StyleProp, ViewStyle, TextStyle } from 'react-native'; | ||
import { NavigationParams, NavigationDescriptor, NavigationInjectedProps, NavigationScreenConfig } from 'react-navigation'; | ||
export interface NativeNavigationPopover { | ||
sourceViewNativeID: string; | ||
contentSize: NativeNavigatorSize; | ||
sourceRect?: NativeNavigatorRect; | ||
directions?: NativeNavigatorDirection[]; | ||
} | ||
export interface NativeNavigationOptions { | ||
@@ -24,3 +18,2 @@ transition?: NativeNavigatorTransitions; | ||
headerTitleStyle?: StyleProp<TextStyle>; | ||
popover?: NativeNavigationPopover; | ||
statusBarStyle?: NativeNavigationStatusBarStyle; | ||
@@ -50,3 +43,2 @@ statusBarHidden?: boolean; | ||
Stack = "stack", | ||
Modal = "modal", | ||
Card = "card", | ||
@@ -53,0 +45,0 @@ Split = "split" |
@@ -19,3 +19,2 @@ export var NativeNavigationStatusBarStyle; | ||
NativeNavigatorModes["Stack"] = "stack"; | ||
NativeNavigatorModes["Modal"] = "modal"; | ||
NativeNavigatorModes["Card"] = "card"; | ||
@@ -22,0 +21,0 @@ NativeNavigatorModes["Split"] = "split"; // todo |
{ | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"name": "react-native-navigators", | ||
@@ -4,0 +4,0 @@ "repository": { |
@@ -10,9 +10,2 @@ import { ReactNode } from 'react'; | ||
export interface NativeNavigationPopover { | ||
sourceViewNativeID: string; | ||
contentSize: NativeNavigatorSize; | ||
sourceRect?: NativeNavigatorRect; | ||
directions?: NativeNavigatorDirection[]; | ||
} | ||
export interface NativeNavigationOptions { | ||
@@ -32,3 +25,2 @@ transition?: NativeNavigatorTransitions; | ||
headerTitleStyle?: StyleProp<TextStyle>; | ||
popover?: NativeNavigationPopover; | ||
statusBarStyle?: NativeNavigationStatusBarStyle; | ||
@@ -65,3 +57,2 @@ statusBarHidden?: boolean; | ||
Stack = 'stack', | ||
Modal = 'modal', // present, 默认不透明 | ||
Card = 'card', // add child controller,默认不透明 | ||
@@ -68,0 +59,0 @@ Split = 'split' // todo |
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
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
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
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
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
1063879
252
2721