text: 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 _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));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 _getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _propTypes=_interopRequireDefault(require("prop-types"));var _withTheme=_interopRequireDefault(require("../../Theme/withTheme"));var _Modal=_interopRequireDefault(require("./Modal.styles"));var _jsxFileName="/Users/cody/projects/material-bread/src/Components/Modal/Modal.ios.js";var Modal=function(_Component){(0,_inherits2.default)(Modal,_Component);function Modal(){var _getPrototypeOf2;var _this;(0,_classCallCheck2.default)(this,Modal);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf2=(0,_getPrototypeOf3.default)(Modal)).call.apply(_getPrototypeOf2,[this].concat(args)));(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(_this),"state",{opacityAnimation:new _reactNative.Animated.Value(0),scaleAnimation:new _reactNative.Animated.Value(0.5),animationDuration:200,show:false});return _this;}(0,_createClass2.default)(Modal,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var visible=this.props.visible;if(visible!==prevProps.visible){this.toggle();}}},{key:"toggle",value:function toggle(){var _this2=this;var _this$state=this.state,opacityAnimation=_this$state.opacityAnimation,scaleAnimation=_this$state.scaleAnimation,animationDuration=_this$state.animationDuration,show=_this$state.show;var visible=this.props.visible;var opacity=0;var scale=0;if(visible){opacity=1;scale=1;this.setState({show:!show},function(){_reactNative.Animated.parallel([_reactNative.Animated.timing(opacityAnimation,{toValue:opacity,duration:animationDuration+50}),_reactNative.Animated.timing(scaleAnimation,{toValue:scale,duration:animationDuration})]).start();});}else{_reactNative.Animated.parallel([_reactNative.Animated.timing(opacityAnimation,{toValue:opacity,duration:animationDuration}),_reactNative.Animated.timing(scaleAnimation,{toValue:scale,duration:400})]).start(function(){_this2.setState({show:!show});});}}},{key:"render",value:function render(){var _this$props=this.props,onRequestClose=_this$props.onRequestClose,onShow=_this$props.onShow,onTouchOutside=_this$props.onTouchOutside,containerStyle=_this$props.containerStyle,children=_this$props.children,NativeModalProps=_this$props.NativeModalProps;var _this$state2=this.state,opacityAnimation=_this$state2.opacityAnimation,scaleAnimation=_this$state2.scaleAnimation,show=_this$state2.show;var deviceWidth=_reactNative.Dimensions.get('window').width;var deviceHeight=_reactNative.Dimensions.get('window').height;return _react.default.createElement(_reactNative.Modal,(0,_extends2.default)({animationType:'none',transparent:true,visible:show,onRequestClose:onRequestClose,onShow:onShow},NativeModalProps,{__source:{fileName:_jsxFileName,lineNumber:109}}),_react.default.createElement(_reactNative.View,{style:[_Modal.default.container,containerStyle],__source:{fileName:_jsxFileName,lineNumber:116}},_react.default.createElement(_reactNative.TouchableWithoutFeedback,{onPress:onTouchOutside,__source:{fileName:_jsxFileName,lineNumber:117}},_react.default.createElement(_reactNative.Animated.View,{useNativeDriver:false,style:{width:deviceWidth,height:deviceHeight,position:'absolute',backgroundColor:'rgba(0,0,0,.5)',padding:24,opacity:opacityAnimation},__source:{fileName:_jsxFileName,lineNumber:118}})),_react.default.createElement(_reactNative.Animated.View,{useNativeDriver:false,style:{opacity:opacityAnimation,transform:[{scale:scaleAnimation}]},__source:{fileName:_jsxFileName,lineNumber:130}},children)));}}]);return Modal;}(_react.Component);(0,_defineProperty2.default)(Modal,"propTypes",{buttons:_propTypes.default.element,visible:_propTypes.default.bool,onRequestClose:_propTypes.default.func,onShow:_propTypes.default.func,onTouchOutside:_propTypes.default.func,containerStyle:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.array]),NativeModalProps:_propTypes.default.object,children:_propTypes.default.node});(0,_defineProperty2.default)(Modal,"defaultProps",{visible:false});var _default=(0,_withTheme.default)(Modal);exports.default=_default;