react-navigation-stack
Version:
Stack navigator component for React Navigation
2 lines • 24.9 kB
JavaScript
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNavigation=require("react-navigation");var _reactNativeScreens=require("react-native-screens");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _StackViewCard=_interopRequireDefault(require("./StackViewCard"));var _Header=_interopRequireDefault(require("../Header/Header"));var _StackViewTransitionConfigs=_interopRequireDefault(require("./StackViewTransitionConfigs"));var _HeaderStyleInterpolator=_interopRequireDefault(require("../Header/HeaderStyleInterpolator"));var _StackGestureContext=_interopRequireDefault(require("../../utils/StackGestureContext"));var _clamp=_interopRequireDefault(require("../../utils/clamp"));var _ReactNativeFeatures=require("../../utils/ReactNativeFeatures");var _jsxFileName="/Users/satya/Workspace/Callstack/react-navigation-stack/src/views/StackView/StackViewLayout.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(source,true).forEach(function(key){(0,_defineProperty2.default)(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(source).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}var IPHONE_XS_HEIGHT=812;var IPHONE_XR_HEIGHT=896;var _Dimensions$get=_reactNative.Dimensions.get('window'),WINDOW_WIDTH=_Dimensions$get.width,WINDOW_HEIGHT=_Dimensions$get.height;var IS_IPHONE_X=_reactNative.Platform.OS==='ios'&&!_reactNative.Platform.isPad&&!_reactNative.Platform.isTVOS&&(WINDOW_HEIGHT===IPHONE_XS_HEIGHT||WINDOW_WIDTH===IPHONE_XS_HEIGHT||WINDOW_HEIGHT===IPHONE_XR_HEIGHT||WINDOW_WIDTH===IPHONE_XR_HEIGHT);var EaseInOut=_reactNative.Easing.inOut(_reactNative.Easing.ease);var HEADER_LAYOUT_PRESET=['center','left'];var HEADER_TRANSITION_PRESET=['fade-in-place','uikit'];var HEADER_BACKGROUND_TRANSITION_PRESET=['toggle','fade','translate'];var ANIMATION_DURATION=500;var POSITION_THRESHOLD=1/2;var GESTURE_RESPONSE_DISTANCE_HORIZONTAL=50;var GESTURE_RESPONSE_DISTANCE_VERTICAL=135;var USE_NATIVE_DRIVER=_reactNative.Platform.OS==='android'||_reactNative.Platform.OS==='ios';var getDefaultHeaderHeight=function getDefaultHeaderHeight(isLandscape){if(_reactNative.Platform.OS==='ios'){if(isLandscape&&!_reactNative.Platform.isPad){return 32;}else if(IS_IPHONE_X){return 88;}else{return 64;}}else if(_reactNative.Platform.OS==='android'){return 56;}else{return 64;}};var StackViewLayout=function(_React$Component){(0,_inherits2.default)(StackViewLayout,_React$Component);function StackViewLayout(props){var _this;(0,_classCallCheck2.default)(this,StackViewLayout);_this=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(StackViewLayout).call(this,props));_this.immediateIndex=null;_this.handleFloatingHeaderLayout=function(e){var height=e.nativeEvent.layout.height;if(height!==_this.state.floatingHeaderHeight){_this.setState({floatingHeaderHeight:height});}};_this.handlePanGestureStateChange=function(_ref){var nativeEvent=_ref.nativeEvent;if(nativeEvent.oldState===_reactNativeGestureHandler.State.ACTIVE){if(_this.positionSwitch.__getValue()===1){return;}if(_this.isMotionVertical()){_this.handleReleaseVertical(nativeEvent);}else{_this.handleReleaseHorizontal(nativeEvent);}}else if(nativeEvent.state===_reactNativeGestureHandler.State.ACTIVE){_this.props.onGestureBegin&&_this.props.onGestureBegin();_this.positionSwitch.setValue(0);}};_this.renderCard=function(scene){var _this$props=_this.props,transitionProps=_this$props.transitionProps,cardShadowEnabled=_this$props.cardShadowEnabled,cardOverlayEnabled=_this$props.cardOverlayEnabled,transparentCard=_this$props.transparentCard,cardStyle=_this$props.cardStyle;var _ref2=_this.transitionConfig,screenInterpolator=_ref2.screenInterpolator;var style=screenInterpolator&&screenInterpolator(_objectSpread({},transitionProps,{shadowEnabled:cardShadowEnabled,cardOverlayEnabled:cardOverlayEnabled,position:_this.position,scene:scene}));var options=scene.descriptor.options;var hasHeader=options.header!==null;var headerMode=_this.getHeaderMode();var floatingContainerStyle=_reactNative.StyleSheet.absoluteFill;if(hasHeader&&headerMode==='float'&&!options.headerTransparent){floatingContainerStyle=_objectSpread({},_reactNative.Platform.select({web:{},default:_reactNative.StyleSheet.absoluteFillObject}),{paddingTop:_this.state.floatingHeaderHeight});}return React.createElement(_StackViewCard.default,(0,_extends2.default)({},transitionProps,{key:"card_"+scene.key,position:_this.position,realPosition:transitionProps.position,animatedStyle:style,transparent:transparentCard,style:[floatingContainerStyle,cardStyle],scene:scene,__source:{fileName:_jsxFileName,lineNumber:975}}),_this.renderInnerScene(scene));};_this.panGestureRef=React.createRef();_this.gestureX=new _reactNative.Animated.Value(0);_this.gestureY=new _reactNative.Animated.Value(0);_this.positionSwitch=new _reactNative.Animated.Value(1);if(_reactNative.Animated.subtract){_this.gestureSwitch=_reactNative.Animated.subtract(1,_this.positionSwitch);}else{_this.gestureSwitch=_reactNative.Animated.add(1,_reactNative.Animated.multiply(-1,_this.positionSwitch));}_this.gestureEvent=_reactNative.Animated.event([{nativeEvent:{translationX:_this.gestureX,translationY:_this.gestureY}}],{useNativeDriver:USE_NATIVE_DRIVER});_this.state={floatingHeaderHeight:getDefaultHeaderHeight(props.isLandscape)};return _this;}(0,_createClass2.default)(StackViewLayout,[{key:"renderHeader",value:function renderHeader(scene,headerMode){var options=scene.descriptor.options;var header=options.header,headerShown=options.headerShown;if(__DEV__&&typeof header==='string'){throw new Error("Invalid header value: \""+header+"\". The header option must be a valid React component or null, not a string.");}if((header===null||headerShown===false)&&headerMode==='screen'){return null;}if(React.isValidElement(header)){return header;}var renderHeader=header||function(props){return React.createElement(_Header.default,(0,_extends2.default)({},props,{__source:{fileName:_jsxFileName,lineNumber:217}}));};var _ref3=this.transitionConfig,headerLeftInterpolator=_ref3.headerLeftInterpolator,headerTitleInterpolator=_ref3.headerTitleInterpolator,headerRightInterpolator=_ref3.headerRightInterpolator,headerBackgroundInterpolator=_ref3.headerBackgroundInterpolator;var backgroundTransitionPresetInterpolator=this.getHeaderBackgroundTransitionPreset();if(backgroundTransitionPresetInterpolator){headerBackgroundInterpolator=backgroundTransitionPresetInterpolator;}var _this$props2=this.props,transitionProps=_this$props2.transitionProps,passProps=(0,_objectWithoutProperties2.default)(_this$props2,["transitionProps"]);return React.createElement(_reactNavigation.NavigationProvider,{value:scene.descriptor.navigation,__source:{fileName:_jsxFileName,lineNumber:234}},renderHeader(_objectSpread({},passProps,{},transitionProps,{position:this.position,scene:scene,mode:headerMode,transitionPreset:this.getHeaderTransitionPreset(),layoutPreset:this.getHeaderLayoutPreset(),backTitleVisible:this.getHeaderBackTitleVisible(),leftInterpolator:headerLeftInterpolator,titleInterpolator:headerTitleInterpolator,rightInterpolator:headerRightInterpolator,backgroundInterpolator:headerBackgroundInterpolator})));}},{key:"reset",value:function reset(resetToIndex,duration){if(_reactNative.Platform.OS==='ios'&&(0,_ReactNativeFeatures.supportsImprovedSpringAnimation)()){_reactNative.Animated.spring(this.props.transitionProps.position,{toValue:resetToIndex,stiffness:6000,damping:100,mass:3,overshootClamping:true,restDisplacementThreshold:0.01,restSpeedThreshold:0.01,useNativeDriver:USE_NATIVE_DRIVER}).start();}else{_reactNative.Animated.timing(this.props.transitionProps.position,{toValue:resetToIndex,duration:duration,easing:EaseInOut,useNativeDriver:USE_NATIVE_DRIVER}).start();}}},{key:"goBack",value:function goBack(backFromIndex,duration){var _this2=this;var _this$props$transitio=this.props.transitionProps,navigation=_this$props$transitio.navigation,position=_this$props$transitio.position,scenes=_this$props$transitio.scenes;var toValue=Math.max(backFromIndex-1,0);this.immediateIndex=toValue;var onCompleteAnimation=function onCompleteAnimation(){_this2.immediateIndex=null;var backFromScene=scenes.find(function(s){return s.index===toValue+1;});if(backFromScene){navigation.dispatch(_reactNavigation.NavigationActions.back({key:backFromScene.route.key,immediate:true}));navigation.dispatch(_reactNavigation.StackActions.completeTransition());}};if(_reactNative.Platform.OS==='ios'&&(0,_ReactNativeFeatures.supportsImprovedSpringAnimation)()){_reactNative.Animated.spring(position,{toValue:toValue,stiffness:7000,damping:300,mass:3,overshootClamping:true,restDisplacementThreshold:0.01,restSpeedThreshold:0.01,useNativeDriver:USE_NATIVE_DRIVER}).start(onCompleteAnimation);}else{_reactNative.Animated.timing(position,{toValue:toValue,duration:duration,easing:EaseInOut,useNativeDriver:USE_NATIVE_DRIVER}).start(onCompleteAnimation);}}},{key:"prepareAnimated",value:function prepareAnimated(){if(this.props===this.prevProps){return;}this.prevProps=this.props;this.prepareGesture();this.preparePosition();this.prepareTransitionConfig();}},{key:"render",value:function render(){this.prepareAnimated();var transitionProps=this.props.transitionProps;var index=transitionProps.navigation.state.index,scenes=transitionProps.scenes;var headerMode=this.getHeaderMode();var floatingHeader=null;if(headerMode==='float'){var scene=transitionProps.scene;floatingHeader=React.createElement(_reactNative.View,{style:styles.floatingHeader,pointerEvents:"box-none",onLayout:this.handleFloatingHeaderLayout,__source:{fileName:_jsxFileName,lineNumber:356}},this.renderHeader(scene,headerMode));}return React.createElement(_reactNativeGestureHandler.PanGestureHandler,(0,_extends2.default)({},this.gestureActivationCriteria(),{ref:this.panGestureRef,onGestureEvent:this.gestureEvent,onHandlerStateChange:this.handlePanGestureStateChange,enabled:index>0&&this.isGestureEnabled(),__source:{fileName:_jsxFileName,lineNumber:367}}),React.createElement(_reactNative.Animated.View,{style:[styles.container,this.context==='light'?this.transitionConfig.containerStyleLight:this.transitionConfig.containerStyleDark,this.transitionConfig.containerStyle],__source:{fileName:_jsxFileName,lineNumber:374}},React.createElement(_StackGestureContext.default.Provider,{value:this.panGestureRef,__source:{fileName:_jsxFileName,lineNumber:383}},React.createElement(_reactNativeScreens.ScreenContainer,{style:styles.scenes,__source:{fileName:_jsxFileName,lineNumber:384}},scenes.map(this.renderCard)),floatingHeader)));}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var prevState=prevProps.transitionProps.navigation.state;var state=this.props.transitionProps.navigation.state;if(prevState.index!==state.index){this.maybeCancelGesture();}}},{key:"getGestureResponseDistance",value:function getGestureResponseDistance(){var scene=this.props.transitionProps.scene;var options=scene.descriptor.options;var _options$gestureRespo=options.gestureResponseDistance,userGestureResponseDistance=_options$gestureRespo===void 0?{}:_options$gestureRespo;return this.isModal()?userGestureResponseDistance.vertical||GESTURE_RESPONSE_DISTANCE_VERTICAL:userGestureResponseDistance.horizontal||GESTURE_RESPONSE_DISTANCE_HORIZONTAL;}},{key:"gestureActivationCriteria",value:function gestureActivationCriteria(){var layout=this.props.transitionProps.layout;var gestureResponseDistance=this.getGestureResponseDistance();var isMotionInverted=this.isMotionInverted();if(this.isMotionVertical()){var height=layout.height.__getValue();return{maxDeltaX:15,minOffsetY:isMotionInverted?-5:5,hitSlop:isMotionInverted?{top:-height+gestureResponseDistance}:{bottom:-height+gestureResponseDistance}};}else{var width=layout.width.__getValue();var hitSlop=-width+gestureResponseDistance;return{minOffsetX:isMotionInverted?-5:5,maxDeltaY:20,hitSlop:isMotionInverted?{left:hitSlop}:{right:hitSlop}};}}},{key:"isGestureEnabled",value:function isGestureEnabled(){var gesturesEnabled=this.props.transitionProps.scene.descriptor.options.gesturesEnabled;return typeof gesturesEnabled==='boolean'?gesturesEnabled:_reactNative.Platform.OS==='ios';}},{key:"isMotionVertical",value:function isMotionVertical(){return this.isModal();}},{key:"isModal",value:function isModal(){return this.props.mode==='modal';}},{key:"isMotionInverted",value:function isMotionInverted(){var scene=this.props.transitionProps.scene;var options=scene.descriptor.options;var gestureDirection=options.gestureDirection;if(this.isModal()){return gestureDirection==='inverted';}else{return typeof gestureDirection==='string'?gestureDirection==='inverted':_reactNative.I18nManager.isRTL;}}},{key:"computeHorizontalGestureValue",value:function computeHorizontalGestureValue(_ref4){var translationX=_ref4.translationX;var _this$props$transitio2=this.props.transitionProps,navigation=_this$props$transitio2.navigation,layout=_this$props$transitio2.layout;var index=navigation.state.index;var distance=layout.width.__getValue();var x=this.isMotionInverted()?-1*translationX:translationX;var value=index-x/distance;return(0,_clamp.default)(index-1,value,index);}},{key:"computeVerticalGestureValue",value:function computeVerticalGestureValue(_ref5){var translationY=_ref5.translationY;var _this$props$transitio3=this.props.transitionProps,navigation=_this$props$transitio3.navigation,layout=_this$props$transitio3.layout;var index=navigation.state.index;var distance=layout.height.__getValue();var y=this.isMotionInverted()?-1*translationY:translationY;var value=index-y/distance;return(0,_clamp.default)(index-1,value,index);}},{key:"maybeCancelGesture",value:function maybeCancelGesture(){this.positionSwitch.setValue(1);}},{key:"prepareGesture",value:function prepareGesture(){if(!this.isGestureEnabled()){if(this.positionSwitch.__getValue()!==1){this.positionSwitch.setValue(1);}this.gesturePosition=undefined;return;}if(this.props.transitionProps.layout.width.__getValue()===0||this.props.transitionProps.layout.height.__getValue()===0){return;}if(this.isMotionVertical()){this.prepareGestureVertical();}else{this.prepareGestureHorizontal();}}},{key:"prepareGestureHorizontal",value:function prepareGestureHorizontal(){var index=this.props.transitionProps.navigation.state.index;if(this.isMotionInverted()){this.gesturePosition=_reactNative.Animated.add(index,_reactNative.Animated.divide(this.gestureX,this.props.transitionProps.layout.width)).interpolate({inputRange:[index-1,index],outputRange:[index-1,index],extrapolate:'clamp'});}else{this.gesturePosition=_reactNative.Animated.add(index,_reactNative.Animated.multiply(-1,_reactNative.Animated.divide(this.gestureX,this.props.transitionProps.layout.width))).interpolate({inputRange:[index-1,index],outputRange:[index-1,index],extrapolate:'clamp'});}}},{key:"prepareGestureVertical",value:function prepareGestureVertical(){var index=this.props.transitionProps.navigation.state.index;if(this.isMotionInverted()){this.gesturePosition=_reactNative.Animated.add(index,_reactNative.Animated.divide(this.gestureY,this.props.transitionProps.layout.height)).interpolate({inputRange:[index-1,index],outputRange:[index-1,index],extrapolate:'clamp'});}else{this.gesturePosition=_reactNative.Animated.add(index,_reactNative.Animated.multiply(-1,_reactNative.Animated.divide(this.gestureY,this.props.transitionProps.layout.height))).interpolate({inputRange:[index-1,index],outputRange:[index-1,index],extrapolate:'clamp'});}}},{key:"handleReleaseHorizontal",value:function handleReleaseHorizontal(nativeEvent){var _this$props$transitio4=this.props.transitionProps,navigation=_this$props$transitio4.navigation,position=_this$props$transitio4.position,layout=_this$props$transitio4.layout;var index=navigation.state.index;var immediateIndex=this.immediateIndex==null?index:this.immediateIndex;var distance=layout.width.__getValue();var movementDirection=this.isMotionInverted()?-1:1;var movedDistance=movementDirection*nativeEvent.translationX;var gestureVelocity=movementDirection*nativeEvent.velocityX;var defaultVelocity=distance/ANIMATION_DURATION;var velocity=Math.max(Math.abs(gestureVelocity),defaultVelocity);var resetDuration=this.isMotionInverted()?(distance-movedDistance)/velocity:movedDistance/velocity;var goBackDuration=this.isMotionInverted()?movedDistance/velocity:(distance-movedDistance)/velocity;var value=this.computeHorizontalGestureValue(nativeEvent);position.setValue(value);this.positionSwitch.setValue(1);if(gestureVelocity<-50){this.props.onGestureCanceled&&this.props.onGestureCanceled();this.reset(immediateIndex,resetDuration);return;}if(gestureVelocity>50){this.props.onGestureEnd&&this.props.onGestureEnd();this.goBack(immediateIndex,goBackDuration);return;}if(value<=index-POSITION_THRESHOLD){this.props.onGestureEnd&&this.props.onGestureEnd();this.goBack(immediateIndex,goBackDuration);}else{this.props.onGestureCanceled&&this.props.onGestureCanceled();this.reset(immediateIndex,resetDuration);}}},{key:"handleReleaseVertical",value:function handleReleaseVertical(nativeEvent){var _this$props$transitio5=this.props.transitionProps,navigation=_this$props$transitio5.navigation,position=_this$props$transitio5.position,layout=_this$props$transitio5.layout;var index=navigation.state.index;var immediateIndex=this.immediateIndex==null?index:this.immediateIndex;var distance=layout.height.__getValue();var isMotionInverted=this.isMotionInverted();var movementDirection=isMotionInverted?-1:1;var movedDistance=movementDirection*nativeEvent.translationY;var gestureVelocity=movementDirection*nativeEvent.velocityY;var defaultVelocity=distance/ANIMATION_DURATION;var velocity=Math.max(Math.abs(gestureVelocity),defaultVelocity);var resetDuration=isMotionInverted?(distance-movedDistance)/velocity:movedDistance/velocity;var goBackDuration=isMotionInverted?movedDistance/velocity:(distance-movedDistance)/velocity;var value=this.computeVerticalGestureValue(nativeEvent);position.setValue(value);this.positionSwitch.setValue(1);if(gestureVelocity<-50){this.props.onGestureCanceled&&this.props.onGestureCanceled();this.reset(immediateIndex,resetDuration);return;}if(gestureVelocity>50){this.props.onGestureEnd&&this.props.onGestureEnd();this.goBack(immediateIndex,goBackDuration);return;}if(value<=index-POSITION_THRESHOLD){this.props.onGestureEnd&&this.props.onGestureEnd();this.goBack(immediateIndex,goBackDuration);}else{this.props.onGestureCanceled&&this.props.onGestureCanceled();this.reset(immediateIndex,resetDuration);}}},{key:"getHeaderMode",value:function getHeaderMode(){if(this.props.headerMode){return this.props.headerMode;}if(_reactNative.Platform.OS==='android'||this.props.mode==='modal'){return'screen';}return'float';}},{key:"getHeaderBackgroundTransitionPreset",value:function getHeaderBackgroundTransitionPreset(){var headerBackgroundTransitionPreset=this.props.headerBackgroundTransitionPreset;if(headerBackgroundTransitionPreset){if(HEADER_BACKGROUND_TRANSITION_PRESET.includes(headerBackgroundTransitionPreset)){if(headerBackgroundTransitionPreset==='fade'){return _HeaderStyleInterpolator.default.forBackgroundWithFade;}else if(headerBackgroundTransitionPreset==='translate'){return _HeaderStyleInterpolator.default.forBackgroundWithTranslation;}else if(headerBackgroundTransitionPreset==='toggle'){return _HeaderStyleInterpolator.default.forBackgroundWithInactiveHidden;}}else if(__DEV__){console.error("Invalid configuration applied for headerBackgroundTransitionPreset - expected one of "+HEADER_BACKGROUND_TRANSITION_PRESET.join(', ')+" but received "+JSON.stringify(headerBackgroundTransitionPreset));}}return null;}},{key:"getHeaderLayoutPreset",value:function getHeaderLayoutPreset(){var headerLayoutPreset=this.props.headerLayoutPreset;if(headerLayoutPreset){if(__DEV__){if(this.getHeaderTransitionPreset()==='uikit'&&headerLayoutPreset==='left'&&_reactNative.Platform.OS==='ios'){console.warn("headerTransitionPreset with the value 'uikit' is incompatible with headerLayoutPreset 'left'");}}if(HEADER_LAYOUT_PRESET.includes(headerLayoutPreset)){return headerLayoutPreset;}if(__DEV__){console.error("Invalid configuration applied for headerLayoutPreset - expected one of "+HEADER_LAYOUT_PRESET.join(', ')+" but received "+JSON.stringify(headerLayoutPreset));}}if(_reactNative.Platform.OS!=='ios'){return'left';}else{return'center';}}},{key:"getHeaderTransitionPreset",value:function getHeaderTransitionPreset(){if(_reactNative.Platform.OS!=='ios'||this.getHeaderMode()==='screen'){return'fade-in-place';}var headerTransitionPreset=this.props.headerTransitionPreset;if(headerTransitionPreset){if(HEADER_TRANSITION_PRESET.includes(headerTransitionPreset)){return headerTransitionPreset;}if(__DEV__){console.error("Invalid configuration applied for headerTransitionPreset - expected one of "+HEADER_TRANSITION_PRESET.join(', ')+" but received "+JSON.stringify(headerTransitionPreset));}}return'fade-in-place';}},{key:"getHeaderBackTitleVisible",value:function getHeaderBackTitleVisible(){var headerBackTitleVisible=this.props.headerBackTitleVisible;var layoutPreset=this.getHeaderLayoutPreset();var enabledByDefault=!(layoutPreset==='left'||_reactNative.Platform.OS!=='ios');return typeof headerBackTitleVisible==='boolean'?headerBackTitleVisible:enabledByDefault;}},{key:"renderInnerScene",value:function renderInnerScene(scene){var _scene$descriptor=scene.descriptor,navigation=_scene$descriptor.navigation,getComponent=_scene$descriptor.getComponent;var SceneComponent=getComponent();var screenProps=this.props.screenProps;var headerMode=this.getHeaderMode();if(headerMode==='screen'){return React.createElement(_reactNative.View,{style:styles.container,__source:{fileName:_jsxFileName,lineNumber:887}},React.createElement(_reactNative.View,{style:styles.scenes,__source:{fileName:_jsxFileName,lineNumber:888}},React.createElement(_reactNavigation.SceneView,{screenProps:screenProps,navigation:navigation,component:SceneComponent,__source:{fileName:_jsxFileName,lineNumber:889}})),this.renderHeader(scene,headerMode));}return React.createElement(_reactNavigation.SceneView,{screenProps:screenProps,navigation:navigation,component:SceneComponent,__source:{fileName:_jsxFileName,lineNumber:900}});}},{key:"prepareTransitionConfig",value:function prepareTransitionConfig(){this.transitionConfig=_StackViewTransitionConfigs.default.getTransitionConfig(this.props.transitionConfig,_objectSpread({},this.props.transitionProps,{position:this.position}),this.props.lastTransitionProps,this.isModal());}},{key:"preparePosition",value:function preparePosition(){if(this.gesturePosition){this.position=_reactNative.Animated.add(_reactNative.Animated.multiply(this.props.transitionProps.position,this.positionSwitch),_reactNative.Animated.multiply(this.gesturePosition,this.gestureSwitch));}else{this.position=this.props.transitionProps.position;}}}]);return StackViewLayout;}(React.Component);StackViewLayout.contextType=_reactNavigation.ThemeContext;var styles=_reactNative.StyleSheet.create({container:{flex:1,flexDirection:'column-reverse',overflow:'hidden'},scenes:{flex:1},floatingHeader:{position:_reactNative.Platform.select({default:'absolute',web:'fixed'}),left:0,top:0,right:0}});var _default=(0,_reactNavigation.withOrientation)(StackViewLayout);exports.default=_default;
//# sourceMappingURL=StackViewLayout.js.map