From 183eaf0eba2fc5c2668e45b4b4d7004982f67a74 Mon Sep 17 00:00:00 2001 From: Preeternal Date: Wed, 27 May 2020 11:54:11 +0300 Subject: [PATCH 1/2] initial commit --- dist/src/basic/DeckSwiper.js | 2 +- dist/src/basic/DeckSwiper.js.map | 2 +- dist/src/basic/Fab.js | 2 +- dist/src/basic/Fab.js.map | 2 +- dist/src/basic/Item.js | 2 +- dist/src/basic/Item.js.map | 2 +- dist/src/basic/ToastContainer.js | 2 +- dist/src/basic/ToastContainer.js.map | 2 +- dist/src/theme/components/Badge.js | 2 +- dist/src/theme/components/Badge.js.map | 2 +- package.json | 1 + src/basic/Picker.android.js | 4 +- src/basic/Picker.ios.js | 65 ++++++++++++++------------ src/basic/Picker.js | 4 +- src/basic/PickerItem.js | 4 +- src/basic/ToastContainer.js | 1 - src/theme/components/Badge.js | 1 - yarn.lock | 10 ++-- 18 files changed, 59 insertions(+), 51 deletions(-) diff --git a/dist/src/basic/DeckSwiper.js b/dist/src/basic/DeckSwiper.js index 74edb807c..80a3667cd 100644 --- a/dist/src/basic/DeckSwiper.js +++ b/dist/src/basic/DeckSwiper.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.DeckSwiper=undefined;var _jsxFileName='src/basic/DeckSwiper.js';var _extends=Object.assign||function(target){for(var i=1;i5;},onPanResponderGrant:function onPanResponderGrant(){_this2.state.pan.setOffset({x:_this2.state.pan.x._value,y:_this2.state.pan.y._value});_this2.state.pan.setValue({x:0,y:0});},onPanResponderMove:function onPanResponderMove(e,gestureState){if(gestureState.dx>20){if(_this2.props.onSwiping)_this2.props.onSwiping('right',gestureState.dx);}else if(gestureState.dx<-20){if(_this2.props.onSwiping)_this2.props.onSwiping('left',gestureState.dx);}var val=Math.abs(gestureState.dx*0.0013);if(val>0.2){val=0.2;}_reactNative.Animated.timing(_this2.state.fadeAnim,{toValue:0.8+val}).start();_reactNative.Animated.spring(_this2.state.enter,{toValue:0.8+val,friction:7}).start();_reactNative.Animated.event([null,{dx:_this2.state.pan.x}])(e,gestureState);},onPanResponderRelease:function onPanResponderRelease(e,_ref3){var vx=_ref3.vx,vy=_ref3.vy;if(_this2.props.onSwiping)_this2.props.onSwiping(null);var velocity=void 0;if(vx>=0){velocity=(0,_clamp2.default)(vx,4.5,10);}else if(vx<0){velocity=(0,_clamp2.default)(vx*-1,4.5,10)*-1;}if(Math.abs(_this2.state.pan.x._value)>SWIPE_THRESHOLD){if(velocity>0){_this2.props.onSwipeRight?_this2.props.onSwipeRight(_this2.state.selectedItem):undefined;_this2.selectNext();}else{_this2.props.onSwipeLeft?_this2.props.onSwipeLeft(_this2.state.selectedItem):undefined;_this2.selectNext();}_reactNative.Animated.decay(_this2.state.pan,{velocity:{x:velocity,y:vy},deceleration:0.98}).start(_this2._resetState.bind(_this2));}else{_reactNative.Animated.spring(_this2.state.pan,{toValue:{x:0,y:0},friction:4}).start();}}});}},{key:'_resetState',value:function _resetState(){this.state.pan.setValue({x:0,y:0});this.state.enter.setValue(0.8);this.state.fadeAnim.setValue(0.8);this.setState({card1Top:!this.state.card1Top,card2Top:!this.state.card2Top});if(this.props.onSwiping)this.props.onSwiping(null);}},{key:'swipeRight',value:function swipeRight(){var _this3=this;if(this.props.onSwiping)this.props.onSwiping('right');setTimeout(function(){_reactNative.Animated.timing(_this3.state.fadeAnim,{toValue:1}).start();_reactNative.Animated.spring(_this3.state.enter,{toValue:1,friction:7}).start();_this3.selectNext();_reactNative.Animated.decay(_this3.state.pan,{velocity:{x:8,y:1},deceleration:0.98}).start(_this3._resetState.bind(_this3));},300);}},{key:'swipeLeft',value:function swipeLeft(){var _this4=this;if(this.props.onSwiping)this.props.onSwiping('left');setTimeout(function(){_reactNative.Animated.timing(_this4.state.fadeAnim,{toValue:1}).start();_reactNative.Animated.spring(_this4.state.enter,{toValue:1,friction:7}).start();_this4.selectNext();_reactNative.Animated.decay(_this4.state.pan,{velocity:{x:-8,y:1},deceleration:0.98}).start(_this4._resetState.bind(_this4));},300);}},{key:'selectNext',value:function selectNext(){var _this5=this;var dataSource=this.props.dataSource;var currentIndex=dataSource.indexOf(this.state.selectedItem);if(!this.state.looping){if(currentIndex===dataSource.length-1){return this.setState({disabled:true});}else if(currentIndex===dataSource.length-2){return setTimeout(function(){_this5.setState({selectedItem:dataSource[currentIndex+1]});setTimeout(function(){_this5.setState({lastCard:true});},350);},50);}}var nextIndexes=this.findNextIndexes(currentIndex);setTimeout(function(){_this5.setState({selectedItem:_this5.props.dataSource[nextIndexes[0]]});setTimeout(function(){_this5.setState({selectedItem2:_this5.props.dataSource[nextIndexes[1]]});},350);},50);return null;}},{key:'findNextIndexes',value:function findNextIndexes(currentIndex){var newIdx=currentIndex+1;var newIdx2=currentIndex+2;if(newIdx2>this.props.dataSource.length-1&&newIdx===this.props.dataSource.length-1){return[newIdx,0];}else if(newIdx>this.props.dataSource.length-1){return[0,1];}return[newIdx,newIdx2];}},{key:'render',value:function render(){if(this.state.disabled){return _react2.default.createElement(_reactNative.View,{style:{position:'relative',flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:261}},_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:262}},this.props.renderEmpty&&this.props.renderEmpty()));}else if(this.state.lastCard){return _react2.default.createElement(_reactNative.View,{style:{position:'relative',flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:268}},this.state.selectedItem===undefined?_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:270}}):_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:272}},_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[1],this.getInitialStyle().topCard,{opacity:this.state.fadeAnim}]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:273}}),this.props.renderEmpty&&this.props.renderEmpty()),_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[0],this.getInitialStyle().topCard]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:283}}),this.props.renderItem(this.state.selectedItem))));}return _react2.default.createElement(_reactNative.View,{style:{position:'relative',flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:298}},this.state.selectedItem===undefined?_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:300}}):_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:302}},_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[1],this.getInitialStyle().topCard,{opacity:this.state.fadeAnim}]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:303}}),this.props.renderBottom?this.props.renderBottom(this.state.selectedItem2):this.props.renderItem(this.state.selectedItem2)),_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[0],this.getInitialStyle().topCard]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:315}}),this.props.renderTop?this.props.renderTop(this.state.selectedItem):this.props.renderItem(this.state.selectedItem))));}}]);return DeckSwiper;}(_react.Component);DeckSwiper.propTypes=_extends({},_reactNative.ViewPropTypes,{style:_propTypes2.default.oneOfType([_propTypes2.default.object,_propTypes2.default.number,_propTypes2.default.array]),dataSource:_propTypes2.default.array});var StyledDeckSwiper=(0,_nativeBaseShoutemTheme.connectStyle)('NativeBase.DeckSwiper',{},_mapPropsToStyleNames2.default)(DeckSwiper);exports.DeckSwiper=StyledDeckSwiper; +Object.defineProperty(exports,"__esModule",{value:true});exports.DeckSwiper=undefined;var _jsxFileName='src/basic/DeckSwiper.js';var _extends=Object.assign||function(target){for(var i=1;i5;},onPanResponderGrant:function onPanResponderGrant(){_this2.state.pan.setOffset({x:_this2.state.pan.x._value,y:_this2.state.pan.y._value});_this2.state.pan.setValue({x:0,y:0});},onPanResponderMove:function onPanResponderMove(e,gestureState){if(gestureState.dx>20){if(_this2.props.onSwiping)_this2.props.onSwiping('right',gestureState.dx);}else if(gestureState.dx<-20){if(_this2.props.onSwiping)_this2.props.onSwiping('left',gestureState.dx);}var val=Math.abs(gestureState.dx*0.0013);if(val>0.2){val=0.2;}_reactNative.Animated.timing(_this2.state.fadeAnim,{toValue:0.8+val,useNativeDriver:false}).start();_reactNative.Animated.spring(_this2.state.enter,{toValue:0.8+val,friction:7,useNativeDriver:false}).start();_reactNative.Animated.event([null,{dx:_this2.state.pan.x}],{useNativeDriver:false})(e,gestureState);},onPanResponderRelease:function onPanResponderRelease(e,_ref3){var vx=_ref3.vx,vy=_ref3.vy;if(_this2.props.onSwiping)_this2.props.onSwiping(null);var velocity=void 0;if(vx>=0){velocity=(0,_clamp2.default)(vx,4.5,10);}else if(vx<0){velocity=(0,_clamp2.default)(vx*-1,4.5,10)*-1;}if(Math.abs(_this2.state.pan.x._value)>SWIPE_THRESHOLD){if(velocity>0){_this2.props.onSwipeRight?_this2.props.onSwipeRight(_this2.state.selectedItem):undefined;_this2.selectNext();}else{_this2.props.onSwipeLeft?_this2.props.onSwipeLeft(_this2.state.selectedItem):undefined;_this2.selectNext();}_reactNative.Animated.decay(_this2.state.pan,{velocity:{x:velocity,y:vy},deceleration:0.98}).start(_this2._resetState.bind(_this2));}else{_reactNative.Animated.spring(_this2.state.pan,{toValue:{x:0,y:0},friction:4,useNativeDriver:false}).start();}}});}},{key:'_resetState',value:function _resetState(){this.state.pan.setValue({x:0,y:0});this.state.enter.setValue(0.8);this.state.fadeAnim.setValue(0.8);this.setState({card1Top:!this.state.card1Top,card2Top:!this.state.card2Top});if(this.props.onSwiping)this.props.onSwiping(null);}},{key:'swipeRight',value:function swipeRight(){var _this3=this;if(this.props.onSwiping)this.props.onSwiping('right');setTimeout(function(){_reactNative.Animated.timing(_this3.state.fadeAnim,{toValue:1,useNativeDriver:false}).start();_reactNative.Animated.spring(_this3.state.enter,{toValue:1,friction:7,useNativeDriver:false}).start();_this3.selectNext();_reactNative.Animated.decay(_this3.state.pan,{velocity:{x:8,y:1},deceleration:0.98}).start(_this3._resetState.bind(_this3));},300);}},{key:'swipeLeft',value:function swipeLeft(){var _this4=this;if(this.props.onSwiping)this.props.onSwiping('left');setTimeout(function(){_reactNative.Animated.timing(_this4.state.fadeAnim,{toValue:1,useNativeDriver:false}).start();_reactNative.Animated.spring(_this4.state.enter,{toValue:1,friction:7,useNativeDriver:false}).start();_this4.selectNext();_reactNative.Animated.decay(_this4.state.pan,{velocity:{x:-8,y:1},deceleration:0.98}).start(_this4._resetState.bind(_this4));},300);}},{key:'selectNext',value:function selectNext(){var _this5=this;var dataSource=this.props.dataSource;var currentIndex=dataSource.indexOf(this.state.selectedItem);if(!this.state.looping){if(currentIndex===dataSource.length-1){return this.setState({disabled:true});}else if(currentIndex===dataSource.length-2){return setTimeout(function(){_this5.setState({selectedItem:dataSource[currentIndex+1]});setTimeout(function(){_this5.setState({lastCard:true});},350);},50);}}var nextIndexes=this.findNextIndexes(currentIndex);setTimeout(function(){_this5.setState({selectedItem:_this5.props.dataSource[nextIndexes[0]]});setTimeout(function(){_this5.setState({selectedItem2:_this5.props.dataSource[nextIndexes[1]]});},350);},50);return null;}},{key:'findNextIndexes',value:function findNextIndexes(currentIndex){var newIdx=currentIndex+1;var newIdx2=currentIndex+2;if(newIdx2>this.props.dataSource.length-1&&newIdx===this.props.dataSource.length-1){return[newIdx,0];}else if(newIdx>this.props.dataSource.length-1){return[0,1];}return[newIdx,newIdx2];}},{key:'render',value:function render(){if(this.state.disabled){return _react2.default.createElement(_reactNative.View,{style:{position:'relative',flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:263}},_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:264}},this.props.renderEmpty&&this.props.renderEmpty()));}else if(this.state.lastCard){return _react2.default.createElement(_reactNative.View,{style:{position:'relative',flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:270}},this.state.selectedItem===undefined?_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:272}}):_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:274}},_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[1],this.getInitialStyle().topCard,{opacity:this.state.fadeAnim}]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:275}}),this.props.renderEmpty&&this.props.renderEmpty()),_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[0],this.getInitialStyle().topCard]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:285}}),this.props.renderItem(this.state.selectedItem))));}return _react2.default.createElement(_reactNative.View,{style:{position:'relative',flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:300}},this.state.selectedItem===undefined?_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:302}}):_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:304}},_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[1],this.getInitialStyle().topCard,{opacity:this.state.fadeAnim}]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:305}}),this.props.renderBottom?this.props.renderBottom(this.state.selectedItem2):this.props.renderItem(this.state.selectedItem2)),_react2.default.createElement(_reactNative.Animated.View,_extends({style:[this.getCardStyles()[0],this.getInitialStyle().topCard]},this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:317}}),this.props.renderTop?this.props.renderTop(this.state.selectedItem):this.props.renderItem(this.state.selectedItem))));}}]);return DeckSwiper;}(_react.Component);DeckSwiper.propTypes=_extends({},_reactNative.ViewPropTypes,{style:_propTypes2.default.oneOfType([_propTypes2.default.object,_propTypes2.default.number,_propTypes2.default.array]),dataSource:_propTypes2.default.array});var StyledDeckSwiper=(0,_nativeBaseShoutemTheme.connectStyle)('NativeBase.DeckSwiper',{},_mapPropsToStyleNames2.default)(DeckSwiper);exports.DeckSwiper=StyledDeckSwiper; //# sourceMappingURL=DeckSwiper.js.map \ No newline at end of file diff --git a/dist/src/basic/DeckSwiper.js.map b/dist/src/basic/DeckSwiper.js.map index 35cf473ec..a901eaae7 100644 --- a/dist/src/basic/DeckSwiper.js.map +++ b/dist/src/basic/DeckSwiper.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/basic/DeckSwiper.js"],"names":["SWIPE_THRESHOLD","DeckSwiper","props","getInitialStyle","topCard","position","top","right","left","state","pan","Animated","ValueXY","pan2","enter","Value","selectedItem","dataSource","selectedItem2","card1Top","card2Top","fadeAnim","looping","disabled","length","lastCard","setPanresponder","setState","undefined","visibleIndex","indexOf","currentIndex","nextIndex","x","y","translateX","translateY","rotate","interpolate","inputRange","outputRange","opacity","scale","animatedCardStyles","transform","animatedCardStyles2","_panResponder","PanResponder","create","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","evt","gestureState","Math","abs","dx","onPanResponderGrant","setOffset","_value","setValue","onPanResponderMove","e","onSwiping","val","timing","toValue","start","spring","friction","event","onPanResponderRelease","vx","vy","velocity","onSwipeRight","selectNext","onSwipeLeft","decay","deceleration","_resetState","bind","setTimeout","nextIndexes","findNextIndexes","newIdx","newIdx2","flexDirection","renderEmpty","getCardStyles","panHandlers","renderItem","renderBottom","renderTop","Component","propTypes","ViewPropTypes","style","PropTypes","oneOfType","object","number","array","StyledDeckSwiper","mapPropsToStyleNames"],"mappings":"+1BAAA,4B,2CACA,qC,mDACA,yCACA,4B,2CACA,iEAEA,mE,08BAEA,GAAMA,iBAAkB,GAAxB,C,GAEMC,W,uDACJ,oBAAYC,KAAZ,CAAmB,gJACXA,KADW,SA4CnBC,eA5CmB,CA4CD,UAAM,CACtB,MAAO,CACLC,QAAS,CACPC,SAAU,UADH,CAEPC,IAAK,CAFE,CAGPC,MAAO,CAHA,CAIPC,KAAM,CAJC,CADJ,CAAP,CAQD,CArDkB,CAEjB,MAAKC,KAAL,CAAa,CACXC,IAAK,GAAIC,uBAASC,OAAb,EADM,CAEXC,KAAM,GAAIF,uBAASC,OAAb,EAFK,CAGXE,MAAO,GAAIH,uBAASI,KAAb,CAAmB,GAAnB,CAH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KAAK1F,KAAL,CAAW0F,SAAX,CAAqB,KAAKnF,KAAL,CAAWO,YAAhC,CADH,CAEG,KAAKd,KAAL,CAAWwF,UAAX,CAAsB,KAAKjF,KAAL,CAAWO,YAAjC,CANN,CAbF,CAJJ,CADF,CA8BD,C,wBA5TsB6E,gB,EA+TzB5F,WAAW6F,SAAX,aACKC,0BADL,EAEEC,MAAOC,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAQEpF,WAAYgF,oBAAUI,KARxB,GAWA,GAAMC,kBAAmB,yCACvB,uBADuB,CAEvB,EAFuB,CAGvBC,8BAHuB,EAIvBtG,UAJuB,CAAzB,C,QAM6BA,U,CAApBqG,gB","file":"DeckSwiper.js","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { View, Animated, PanResponder, ViewPropTypes } from 'react-native';\nimport clamp from 'clamp';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nconst SWIPE_THRESHOLD = 120;\n\nclass DeckSwiper extends Component {\n constructor(props) {\n super(props);\n this.state = {\n pan: new Animated.ValueXY(),\n pan2: new Animated.ValueXY(),\n enter: new Animated.Value(0.8),\n selectedItem: this.props.dataSource[0],\n selectedItem2: this.props.dataSource[1],\n card1Top: true,\n card2Top: false,\n fadeAnim: new Animated.Value(0.8),\n looping:\n typeof this.props.looping === 'undefined' ? true : this.props.looping,\n disabled: this.props.dataSource.length === 0,\n lastCard: this.props.dataSource.length === 1\n };\n this.setPanresponder();\n }\n\n componentDidUpdate({ dataSource }) {\n if (dataSource.length !== this.props.dataSource.length) {\n if (dataSource.length <= 1) {\n this.setState({\n ...this.state,\n selectedItem: dataSource[0],\n selectedItem2: undefined,\n disabled: dataSource.length === 0,\n lastCard: dataSource.length === 1\n });\n return;\n }\n\n const visibleIndex = dataSource.indexOf(this.state.selectedItem);\n const currentIndex = visibleIndex < 0 ? visibleIndex + 1 : visibleIndex;\n const nextIndex =\n currentIndex + 1 === dataSource.length ? 0 : currentIndex + 1;\n\n this.setState({\n selectedItem: dataSource[currentIndex],\n selectedItem2: dataSource[nextIndex]\n });\n }\n }\n\n getInitialStyle = () => {\n return {\n topCard: {\n position: 'absolute',\n top: 0,\n right: 0,\n left: 0\n }\n };\n };\n\n getCardStyles() {\n const { pan, enter } = this.state;\n\n const [translateX, translateY] = [pan.x, pan.y];\n // let [translateX, translateY] = [pan2.x, pan2.y];\n\n const rotate = pan.x.interpolate({\n inputRange: [-700, 0, 700],\n outputRange: ['-10deg', '0deg', '10deg']\n });\n\n const opacity = pan.x.interpolate({\n inputRange: [-320, 0, 320],\n outputRange: [0.9, 1, 0.9]\n });\n const scale = enter;\n\n const animatedCardStyles = {\n transform: [{ translateX }, { translateY }, { rotate }],\n opacity\n };\n const animatedCardStyles2 = { transform: [{ scale }] };\n\n return [animatedCardStyles, animatedCardStyles2];\n }\n\n setPanresponder() {\n this._panResponder = PanResponder.create({\n onMoveShouldSetResponderCapture: () => true,\n onMoveShouldSetPanResponderCapture: (evt, gestureState) =>\n Math.abs(gestureState.dx) > 5,\n\n onPanResponderGrant: () => {\n this.state.pan.setOffset({\n x: this.state.pan.x._value,\n y: this.state.pan.y._value\n });\n this.state.pan.setValue({ x: 0, y: 0 });\n },\n\n onPanResponderMove: (e, gestureState) => {\n if (gestureState.dx > 20) {\n if (this.props.onSwiping)\n this.props.onSwiping('right', gestureState.dx);\n } else if (gestureState.dx < -20) {\n if (this.props.onSwiping)\n this.props.onSwiping('left', gestureState.dx);\n }\n let val = Math.abs(gestureState.dx * 0.0013);\n if (val > 0.2) {\n val = 0.2;\n }\n Animated.timing(this.state.fadeAnim, { toValue: 0.8 + val }).start();\n Animated.spring(this.state.enter, {\n toValue: 0.8 + val,\n friction: 7\n }).start();\n Animated.event([null, { dx: this.state.pan.x }])(e, gestureState);\n },\n\n onPanResponderRelease: (e, { vx, vy }) => {\n if (this.props.onSwiping) this.props.onSwiping(null);\n let velocity;\n\n if (vx >= 0) {\n velocity = clamp(vx, 4.5, 10);\n } else if (vx < 0) {\n velocity = clamp(vx * -1, 4.5, 10) * -1;\n }\n\n if (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) {\n if (velocity > 0) {\n this.props.onSwipeRight\n ? this.props.onSwipeRight(this.state.selectedItem)\n : undefined;\n this.selectNext();\n } else {\n this.props.onSwipeLeft\n ? this.props.onSwipeLeft(this.state.selectedItem)\n : undefined;\n this.selectNext();\n }\n\n Animated.decay(this.state.pan, {\n velocity: { x: velocity, y: vy },\n deceleration: 0.98\n }).start(this._resetState.bind(this));\n } else {\n Animated.spring(this.state.pan, {\n toValue: { x: 0, y: 0 },\n friction: 4\n }).start();\n }\n }\n });\n }\n\n _resetState() {\n this.state.pan.setValue({ x: 0, y: 0 });\n this.state.enter.setValue(0.8);\n this.state.fadeAnim.setValue(0.8);\n this.setState({\n card1Top: !this.state.card1Top,\n card2Top: !this.state.card2Top\n });\n if (this.props.onSwiping) this.props.onSwiping(null);\n }\n\n swipeRight() {\n if (this.props.onSwiping) this.props.onSwiping('right');\n setTimeout(() => {\n Animated.timing(this.state.fadeAnim, { toValue: 1 }).start();\n Animated.spring(this.state.enter, { toValue: 1, friction: 7 }).start();\n this.selectNext();\n Animated.decay(this.state.pan, {\n velocity: { x: 8, y: 1 },\n deceleration: 0.98\n }).start(this._resetState.bind(this));\n }, 300);\n }\n\n swipeLeft() {\n if (this.props.onSwiping) this.props.onSwiping('left');\n setTimeout(() => {\n Animated.timing(this.state.fadeAnim, { toValue: 1 }).start();\n Animated.spring(this.state.enter, { toValue: 1, friction: 7 }).start();\n this.selectNext();\n Animated.decay(this.state.pan, {\n velocity: { x: -8, y: 1 },\n deceleration: 0.98\n }).start(this._resetState.bind(this));\n }, 300);\n }\n\n selectNext() {\n const dataSource = this.props.dataSource;\n const currentIndex = dataSource.indexOf(this.state.selectedItem);\n\n // if not looping, check for these conditionals and if true return from selectNext()\n if (!this.state.looping) {\n // reached end -> only display static renderEmpty() -> no swiping\n if (currentIndex === dataSource.length - 1) {\n return this.setState({\n disabled: true\n });\n } else if (currentIndex === dataSource.length - 2) {\n // show last card with renderEmpty() component behind it\n return setTimeout(() => {\n this.setState({\n selectedItem: dataSource[currentIndex + 1]\n });\n setTimeout(() => {\n this.setState({\n lastCard: true\n });\n }, 350);\n }, 50);\n }\n }\n\n const nextIndexes = this.findNextIndexes(currentIndex);\n setTimeout(() => {\n this.setState({\n selectedItem: this.props.dataSource[nextIndexes[0]]\n });\n setTimeout(() => {\n this.setState({\n selectedItem2: this.props.dataSource[nextIndexes[1]]\n });\n }, 350);\n }, 50);\n\n return null;\n }\n\n findNextIndexes(currentIndex) {\n const newIdx = currentIndex + 1;\n const newIdx2 = currentIndex + 2;\n\n if (\n newIdx2 > this.props.dataSource.length - 1 &&\n newIdx === this.props.dataSource.length - 1\n ) {\n return [newIdx, 0];\n } else if (newIdx > this.props.dataSource.length - 1) {\n return [0, 1];\n }\n return [newIdx, newIdx2];\n }\n\n render() {\n if (this.state.disabled) {\n // disable swiping and renderEmpty\n return (\n \n {{this.props.renderEmpty && this.props.renderEmpty()}}\n \n );\n } else if (this.state.lastCard) {\n // display renderEmpty underneath last viable card\n return (\n \n {this.state.selectedItem === undefined ? (\n \n ) : (\n \n \n {this.props.renderEmpty && this.props.renderEmpty()}\n \n \n {this.props.renderItem(this.state.selectedItem)}\n \n \n )}\n \n );\n }\n return (\n \n {this.state.selectedItem === undefined ? (\n \n ) : (\n \n \n {this.props.renderBottom\n ? this.props.renderBottom(this.state.selectedItem2)\n : this.props.renderItem(this.state.selectedItem2)}\n \n \n {this.props.renderTop\n ? this.props.renderTop(this.state.selectedItem)\n : this.props.renderItem(this.state.selectedItem)}\n \n \n )}\n \n );\n }\n}\n\nDeckSwiper.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n // eslint-disable-next-line react/forbid-prop-types\n dataSource: PropTypes.array\n};\n\nconst StyledDeckSwiper = connectStyle(\n 'NativeBase.DeckSwiper',\n {},\n mapPropsToStyleNames\n)(DeckSwiper);\n\nexport { StyledDeckSwiper as DeckSwiper };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/DeckSwiper.js"],"names":["SWIPE_THRESHOLD","DeckSwiper","props","getInitialStyle","topCard","position","top","right","left","state","pan","Animated","ValueXY","pan2","enter","Value","selectedItem","dataSource","selectedItem2","card1Top","card2Top","fadeAnim","looping","disabled","length","lastCard","setPanresponder","setState","undefined","visibleIndex","indexOf","currentIndex","nextIndex","x","y","translateX","translateY","rotate","interpolate","inputRange","outputRange","opacity","scale","animatedCardStyles","transform","animatedCardStyles2","_panResponder","PanResponder","create","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","evt","gestureState","Math","abs","dx","onPanResponderGrant","setOffset","_value","setValue","onPanResponderMove","e","onSwiping","val","timing","toValue","useNativeDriver","start","spring","friction","event","onPanResponderRelease","vx","vy","velocity","onSwipeRight","selectNext","onSwipeLeft","decay","deceleration","_resetState","bind","setTimeout","nextIndexes","findNextIndexes","newIdx","newIdx2","flexDirection","renderEmpty","getCardStyles","panHandlers","renderItem","renderBottom","renderTop","Component","propTypes","ViewPropTypes","style","PropTypes","oneOfType","object","number","array","StyledDeckSwiper","mapPropsToStyleNames"],"mappings":"+1BAAA,4B,2CACA,qC,mDACA,yCACA,4B,2CACA,iEAEA,mE,08BAEA,GAAMA,iBAAkB,GAAxB,C,GAEMC,W,uDACJ,oBAAYC,KAAZ,CAAmB,gJACXA,KADW,SA4CnBC,eA5CmB,CA4CD,UAAM,CACtB,MAAO,CACLC,QAAS,CACPC,SAAU,UADH,CAEPC,IAAK,CAFE,CAGPC,MAAO,CAHA,CAIPC,KAAM,CAJC,CADJ,CAAP,CAQD,CArDkB,CAEjB,MAAKC,KAAL,CAAa,CACXC,IAAK,GAAIC,uBAASC,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KAAL,CAAWS,aAAnC,CADH,CAEG,KAAKhB,KAAL,CAAWyF,UAAX,CAAsB,KAAKlF,KAAL,CAAWS,aAAjC,CAVN,CADF,CAaE,8BAAC,qBAAD,CAAU,IAAV,WACE,MAAO,CAAC,KAAKuE,aAAL,GAAqB,CAArB,CAAD,CAA0B,KAAKtF,eAAL,GAAuBC,OAAjD,CADT,EAEM,KAAK0C,aAAL,CAAmB4C,WAFzB,oDAIG,KAAKxF,KAAL,CAAW2F,SAAX,CACG,KAAK3F,KAAL,CAAW2F,SAAX,CAAqB,KAAKpF,KAAL,CAAWO,YAAhC,CADH,CAEG,KAAKd,KAAL,CAAWyF,UAAX,CAAsB,KAAKlF,KAAL,CAAWO,YAAjC,CANN,CAbF,CAJJ,CADF,CA8BD,C,wBA9TsB8E,gB,EAiUzB7F,WAAW8F,SAAX,aACKC,0BADL,EAEEC,MAAOC,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAQErF,WAAYiF,oBAAUI,KARxB,GAWA,GAAMC,kBAAmB,yCACvB,uBADuB,CAEvB,EAFuB,CAGvBC,8BAHuB,EAIvBvG,UAJuB,CAAzB,C,QAM6BA,U,CAApBsG,gB","file":"DeckSwiper.js","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { View, Animated, PanResponder, ViewPropTypes } from 'react-native';\nimport clamp from 'clamp';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nconst SWIPE_THRESHOLD = 120;\n\nclass DeckSwiper extends Component {\n constructor(props) {\n super(props);\n this.state = {\n pan: new Animated.ValueXY(),\n pan2: new Animated.ValueXY(),\n enter: new Animated.Value(0.8),\n selectedItem: this.props.dataSource[0],\n selectedItem2: this.props.dataSource[1],\n card1Top: true,\n card2Top: false,\n fadeAnim: new Animated.Value(0.8),\n looping:\n typeof this.props.looping === 'undefined' ? true : this.props.looping,\n disabled: this.props.dataSource.length === 0,\n lastCard: this.props.dataSource.length === 1\n };\n this.setPanresponder();\n }\n\n componentDidUpdate({ dataSource }) {\n if (dataSource.length !== this.props.dataSource.length) {\n if (dataSource.length <= 1) {\n this.setState({\n ...this.state,\n selectedItem: dataSource[0],\n selectedItem2: undefined,\n disabled: dataSource.length === 0,\n lastCard: dataSource.length === 1\n });\n return;\n }\n\n const visibleIndex = dataSource.indexOf(this.state.selectedItem);\n const currentIndex = visibleIndex < 0 ? visibleIndex + 1 : visibleIndex;\n const nextIndex =\n currentIndex + 1 === dataSource.length ? 0 : currentIndex + 1;\n\n this.setState({\n selectedItem: dataSource[currentIndex],\n selectedItem2: dataSource[nextIndex]\n });\n }\n }\n\n getInitialStyle = () => {\n return {\n topCard: {\n position: 'absolute',\n top: 0,\n right: 0,\n left: 0\n }\n };\n };\n\n getCardStyles() {\n const { pan, enter } = this.state;\n\n const [translateX, translateY] = [pan.x, pan.y];\n // let [translateX, translateY] = [pan2.x, pan2.y];\n\n const rotate = pan.x.interpolate({\n inputRange: [-700, 0, 700],\n outputRange: ['-10deg', '0deg', '10deg']\n });\n\n const opacity = pan.x.interpolate({\n inputRange: [-320, 0, 320],\n outputRange: [0.9, 1, 0.9]\n });\n const scale = enter;\n\n const animatedCardStyles = {\n transform: [{ translateX }, { translateY }, { rotate }],\n opacity\n };\n const animatedCardStyles2 = { transform: [{ scale }] };\n\n return [animatedCardStyles, animatedCardStyles2];\n }\n\n setPanresponder() {\n this._panResponder = PanResponder.create({\n onMoveShouldSetResponderCapture: () => true,\n onMoveShouldSetPanResponderCapture: (evt, gestureState) =>\n Math.abs(gestureState.dx) > 5,\n\n onPanResponderGrant: () => {\n this.state.pan.setOffset({\n x: this.state.pan.x._value,\n y: this.state.pan.y._value\n });\n this.state.pan.setValue({ x: 0, y: 0 });\n },\n\n onPanResponderMove: (e, gestureState) => {\n if (gestureState.dx > 20) {\n if (this.props.onSwiping)\n this.props.onSwiping('right', gestureState.dx);\n } else if (gestureState.dx < -20) {\n if (this.props.onSwiping)\n this.props.onSwiping('left', gestureState.dx);\n }\n let val = Math.abs(gestureState.dx * 0.0013);\n if (val > 0.2) {\n val = 0.2;\n }\n Animated.timing(this.state.fadeAnim, { toValue: 0.8 + val, useNativeDriver: false }).start();\n Animated.spring(this.state.enter, {\n toValue: 0.8 + val,\n friction: 7,\n useNativeDriver: false\n }).start();\n Animated.event([null, { dx: this.state.pan.x }], { useNativeDriver: false })(e, gestureState);\n },\n\n onPanResponderRelease: (e, { vx, vy }) => {\n if (this.props.onSwiping) this.props.onSwiping(null);\n let velocity;\n\n if (vx >= 0) {\n velocity = clamp(vx, 4.5, 10);\n } else if (vx < 0) {\n velocity = clamp(vx * -1, 4.5, 10) * -1;\n }\n\n if (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) {\n if (velocity > 0) {\n this.props.onSwipeRight\n ? this.props.onSwipeRight(this.state.selectedItem)\n : undefined;\n this.selectNext();\n } else {\n this.props.onSwipeLeft\n ? this.props.onSwipeLeft(this.state.selectedItem)\n : undefined;\n this.selectNext();\n }\n\n Animated.decay(this.state.pan, {\n velocity: { x: velocity, y: vy },\n deceleration: 0.98\n }).start(this._resetState.bind(this));\n } else {\n Animated.spring(this.state.pan, {\n toValue: { x: 0, y: 0 },\n friction: 4,\n useNativeDriver: false\n }).start();\n }\n }\n });\n }\n\n _resetState() {\n this.state.pan.setValue({ x: 0, y: 0 });\n this.state.enter.setValue(0.8);\n this.state.fadeAnim.setValue(0.8);\n this.setState({\n card1Top: !this.state.card1Top,\n card2Top: !this.state.card2Top\n });\n if (this.props.onSwiping) this.props.onSwiping(null);\n }\n\n swipeRight() {\n if (this.props.onSwiping) this.props.onSwiping('right');\n setTimeout(() => {\n Animated.timing(this.state.fadeAnim, { toValue: 1, useNativeDriver: false }).start();\n Animated.spring(this.state.enter, { toValue: 1, friction: 7, useNativeDriver: false }).start();\n this.selectNext();\n Animated.decay(this.state.pan, {\n velocity: { x: 8, y: 1 },\n deceleration: 0.98\n }).start(this._resetState.bind(this));\n }, 300);\n }\n\n swipeLeft() {\n if (this.props.onSwiping) this.props.onSwiping('left');\n setTimeout(() => {\n Animated.timing(this.state.fadeAnim, { toValue: 1, useNativeDriver: false }).start();\n Animated.spring(this.state.enter, { toValue: 1, friction: 7, useNativeDriver: false }).start();\n this.selectNext();\n Animated.decay(this.state.pan, {\n velocity: { x: -8, y: 1 },\n deceleration: 0.98\n }).start(this._resetState.bind(this));\n }, 300);\n }\n\n selectNext() {\n const dataSource = this.props.dataSource;\n const currentIndex = dataSource.indexOf(this.state.selectedItem);\n\n // if not looping, check for these conditionals and if true return from selectNext()\n if (!this.state.looping) {\n // reached end -> only display static renderEmpty() -> no swiping\n if (currentIndex === dataSource.length - 1) {\n return this.setState({\n disabled: true\n });\n } else if (currentIndex === dataSource.length - 2) {\n // show last card with renderEmpty() component behind it\n return setTimeout(() => {\n this.setState({\n selectedItem: dataSource[currentIndex + 1]\n });\n setTimeout(() => {\n this.setState({\n lastCard: true\n });\n }, 350);\n }, 50);\n }\n }\n\n const nextIndexes = this.findNextIndexes(currentIndex);\n setTimeout(() => {\n this.setState({\n selectedItem: this.props.dataSource[nextIndexes[0]]\n });\n setTimeout(() => {\n this.setState({\n selectedItem2: this.props.dataSource[nextIndexes[1]]\n });\n }, 350);\n }, 50);\n\n return null;\n }\n\n findNextIndexes(currentIndex) {\n const newIdx = currentIndex + 1;\n const newIdx2 = currentIndex + 2;\n\n if (\n newIdx2 > this.props.dataSource.length - 1 &&\n newIdx === this.props.dataSource.length - 1\n ) {\n return [newIdx, 0];\n } else if (newIdx > this.props.dataSource.length - 1) {\n return [0, 1];\n }\n return [newIdx, newIdx2];\n }\n\n render() {\n if (this.state.disabled) {\n // disable swiping and renderEmpty\n return (\n \n {{this.props.renderEmpty && this.props.renderEmpty()}}\n \n );\n } else if (this.state.lastCard) {\n // display renderEmpty underneath last viable card\n return (\n \n {this.state.selectedItem === undefined ? (\n \n ) : (\n \n \n {this.props.renderEmpty && this.props.renderEmpty()}\n \n \n {this.props.renderItem(this.state.selectedItem)}\n \n \n )}\n \n );\n }\n return (\n \n {this.state.selectedItem === undefined ? (\n \n ) : (\n \n \n {this.props.renderBottom\n ? this.props.renderBottom(this.state.selectedItem2)\n : this.props.renderItem(this.state.selectedItem2)}\n \n \n {this.props.renderTop\n ? this.props.renderTop(this.state.selectedItem)\n : this.props.renderItem(this.state.selectedItem)}\n \n \n )}\n \n );\n }\n}\n\nDeckSwiper.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n // eslint-disable-next-line react/forbid-prop-types\n dataSource: PropTypes.array\n};\n\nconst StyledDeckSwiper = connectStyle(\n 'NativeBase.DeckSwiper',\n {},\n mapPropsToStyleNames\n)(DeckSwiper);\n\nexport { StyledDeckSwiper as DeckSwiper };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Fab.js b/dist/src/basic/Fab.js index 7799fa3c7..7aace3a2d 100644 --- a/dist/src/basic/Fab.js +++ b/dist/src/basic/Fab.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.Fab=undefined;var _jsxFileName='src/basic/Fab.js';var _extends=Object.assign||function(target){for(var i=1;i {\n if (item.type.displayName === 'Styled(Button)') {\n return true;\n }\n return null;\n });\n // eslint-disable-next-line react/no-did-mount-set-state\n this.setState({\n buttons: icon.length\n });\n this.activeTimer = setTimeout(() => {\n this.setState({\n active: this.props.active\n });\n }, 0);\n }\n\n componentWillUnmount() {\n if (this.activeTimer) {\n clearTimeout(this.activeTimer);\n }\n }\n\n getOtherButtonStyle(child, i) {\n const { active, direction } = this.props;\n const type = {\n top: direction ? this.fabOtherBtns(direction, i).top : undefined,\n left: direction ? this.fabOtherBtns(direction, i).left : 8,\n right: direction ? this.fabOtherBtns(direction, i).right : 0,\n bottom: direction\n ? this.fabOtherBtns(direction, i).bottom\n : active === false\n ? Platform.OS === PLATFORM.IOS\n ? 8\n : 8\n : i * 50 + 50\n };\n\n return merge(\n this.getInitialStyle().buttonStyle,\n StyleSheet.flatten(child.props.style),\n type\n );\n }\n\n getContainerStyle() {\n return merge(this.getInitialStyle().container, this.props.containerStyle);\n }\n\n getInitialStyle(iconStyle) {\n const { direction, position } = this.props;\n return {\n fab: {\n height: variables.fabWidth,\n width: variables.fabWidth,\n borderRadius: variables.fabBorderRadius,\n elevation: variables.fabElevation,\n shadowColor: variables.fabShadowColor,\n shadowOffset: {\n width: variables.fabShadowOffsetWidth,\n height: variables.fabShadowOffsetHeight\n },\n shadowOpacity: variables.fabShadowOpacity,\n justifyContent: 'center',\n alignItems: 'center',\n shadowRadius: variables.fabShadowRadius,\n position: 'absolute',\n bottom: variables.fabBottom,\n backgroundColor: variables.fabBackgroundColor\n },\n container: {\n position: 'absolute',\n top: position ? this.fabTopValue(position).top : undefined,\n bottom: position\n ? this.fabTopValue(position).bottom\n : variables.fabContainerBottom,\n right: position\n ? this.fabTopValue(position).right\n : variables.fabContainerBottom,\n left: position ? this.fabTopValue(position).left : undefined,\n width: variables.fabWidth,\n height: this.containerHeight,\n flexDirection: direction\n ? direction === DIRECTION.LEFT || direction === DIRECTION.RIGHT\n ? 'row'\n : 'column'\n : 'column',\n alignItems: 'center'\n },\n iconStyle: {\n color: variables.fabIconColor,\n fontSize: variables.fabIconSize,\n lineHeight: Platform.OS === PLATFORM.IOS ? 27 : undefined,\n ...iconStyle\n },\n buttonStyle: {\n position: 'absolute',\n height: variables.fabButtonHeight,\n width: variables.fabButtonHeight,\n left: variables.fabButtonLeft,\n borderRadius: variables.fabButtonBorderRadius,\n transform: this.state.active\n ? [{ scale: new Animated.Value(1) }]\n : [{ scale: this.buttonScale }],\n marginBottom: variables.fabButtonMarginBottom,\n backgroundColor: variables.fabBackgroundColor\n }\n };\n }\n\n prepareButtonProps = child => {\n const inp = clone(child.props);\n delete inp.style;\n\n const defaultProps = {};\n\n return computeProps(inp, defaultProps);\n };\n\n fabTopValue = pos => {\n if (pos === POSITION.TOP_LEFT) {\n return {\n top: variables.fabDefaultPosition,\n bottom: undefined,\n left: variables.fabDefaultPosition,\n right: undefined\n };\n } else if (pos === POSITION.BOTTOM_RIGHT) {\n return {\n top: undefined,\n bottom: variables.fabDefaultPosition,\n left: undefined,\n right: variables.fabDefaultPosition\n };\n } else if (pos === POSITION.BOTTOM_LEFT) {\n return {\n top: undefined,\n bottom: variables.fabDefaultPosition,\n left: variables.fabDefaultPosition,\n right: undefined\n };\n } else if (pos === POSITION.TOP_RIGHT) {\n return {\n top: variables.fabDefaultPosition,\n bottom: undefined,\n left: undefined,\n right: variables.fabDefaultPosition\n };\n }\n return null;\n };\n\n fabOtherBtns(direction, i) {\n const { active } = this.props;\n if (direction === DIRECTION.UP) {\n return {\n top: undefined,\n bottom:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 50\n : 5\n : i * 50 + 65,\n left: 8,\n right: 0\n };\n } else if (direction === DIRECTION.LEFT) {\n return {\n top: 8,\n bottom: 0,\n left:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 8\n : 8\n : -(i * 50 + variables.fabWidth + 2),\n right: 0\n };\n } else if (direction === DIRECTION.DOWN) {\n return {\n top:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 50\n : 8\n : i * 50 + 73,\n bottom: 0,\n left: 8,\n right: 0\n };\n } else if (direction === DIRECTION.RIGHT) {\n return {\n top: 8,\n bottom: 0,\n left:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 50\n : 8\n : i * 50 + 73,\n right: 0\n };\n }\n return null;\n }\n\n prepareFabProps() {\n const defaultProps = {\n style: this.getInitialStyle().fab\n };\n const incomingProps = clone(this.props);\n delete incomingProps.onPress;\n\n return computeProps(incomingProps, defaultProps);\n }\n\n upAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerHeight, {\n toValue: this.state.buttons * 51.3 + variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n\n leftAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerWidth, {\n toValue: this.state.buttons * 51.3 + variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n\n rightAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerWidth, {\n toValue: this.state.buttons * 51.3 + variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n\n downAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n _animate() {\n const {\n props: { direction, position }\n } = this;\n\n if (direction) {\n if (direction === DIRECTION.UP) {\n if (position === POSITION.TOP_LEFT || position === POSITION.TOP_RIGHT) {\n console.warn(\n 'Passing direction = up with position = topLeft/topRight is not suggested.'\n );\n } else {\n this.upAnimate();\n }\n } else if (direction === DIRECTION.LEFT) {\n if (\n position === POSITION.TOP_LEFT ||\n position === POSITION.BOTTOM_LEFT\n ) {\n console.warn(\n 'Passing direction = left with position = topLeft/bottomLeft is not suggested.'\n );\n } else {\n this.leftAnimate();\n }\n } else if (direction === DIRECTION.RIGHT) {\n if (\n position === POSITION.TOP_RIGHT ||\n position === POSITION.BOTTOM_RIGHT\n ) {\n console.warn(\n 'Passing direction = right with position = topRight/bottomRight is not suggested.'\n );\n } else {\n this.rightAnimate();\n }\n } else if (direction === DIRECTION.DOWN) {\n if (\n position === POSITION.BOTTOM_LEFT ||\n position === POSITION.BOTTOM_RIGHT\n ) {\n console.warn(\n 'Passing direction = down with position = bottomLeft/bottomRight is not suggested.'\n );\n } else {\n this.downAnimate();\n }\n }\n } else {\n this.upAnimate();\n }\n }\n\n fabOnPress() {\n if (this.props.onPress) {\n this.props.onPress();\n this._animate();\n this.activeTimer = setTimeout(() => {\n this.setState({\n active: this.props.active\n });\n }, 100);\n }\n }\n\n renderButtons() {\n const childrenArray = React.Children.toArray(this.props.children);\n const newChildren = [];\n childrenArray.slice(1).map((child, i) =>\n newChildren.push(\n \n {child.props.children}\n \n )\n );\n return newChildren;\n }\n\n renderFab() {\n const childrenArray = React.Children.toArray(this.props.children);\n remove(childrenArray, item => {\n if (item.type.displayName === 'Styled(Button)') {\n return true;\n }\n return null;\n });\n return React.cloneElement(childrenArray[0], {\n style: this.getInitialStyle(childrenArray[0].props.style).iconStyle\n });\n }\n\n render() {\n const { style } = this.props;\n return (\n \n {this.renderButtons()}\n {Platform.OS === PLATFORM.IOS ||\n variables.androidRipple === false ||\n Platform.Version <= 21 ? (\n this.fabOnPress()}\n {...this.prepareFabProps()}\n activeOpacity={1}\n >\n {this.renderFab()}\n \n ) : (\n this.fabOnPress()}\n // eslint-disable-next-line new-cap\n background={TouchableNativeFeedback.Ripple(\n variables.androidRippleColor,\n false\n )}\n {...this.prepareFabProps()}\n >\n \n {this.renderFab()}\n \n \n )}\n \n );\n }\n}\nconst StyledFab = connectStyle('NativeBase.Fab', {}, mapPropsToStyleNames)(Fab);\nexport { StyledFab as Fab };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Fab.js"],"names":["DIRECTION","DOWN","LEFT","RIGHT","UP","POSITION","BOTTOM_LEFT","BOTTOM_RIGHT","TOP_LEFT","TOP_RIGHT","AnimatedFab","Animated","createAnimatedComponent","Button","Fab","props","prepareButtonProps","inp","child","style","defaultProps","fabTopValue","pos","top","variables","fabDefaultPosition","bottom","undefined","left","right","containerHeight","Value","fabWidth","containerWidth","buttonScale","state","buttons","active","childrenArray","React","Children","toArray","children","icon","item","type","displayName","setState","length","activeTimer","setTimeout","clearTimeout","i","direction","fabOtherBtns","Platform","OS","PLATFORM","IOS","getInitialStyle","buttonStyle","StyleSheet","flatten","container","containerStyle","iconStyle","position","fab","height","width","borderRadius","fabBorderRadius","elevation","fabElevation","shadowColor","fabShadowColor","shadowOffset","fabShadowOffsetWidth","fabShadowOffsetHeight","shadowOpacity","fabShadowOpacity","justifyContent","alignItems","shadowRadius","fabShadowRadius","fabBottom","backgroundColor","fabBackgroundColor","fabContainerBottom","flexDirection","color","fabIconColor","fontSize","fabIconSize","lineHeight","fabButtonHeight","fabButtonLeft","fabButtonBorderRadius","transform","scale","marginBottom","fabButtonMarginBottom","incomingProps","onPress","spring","toValue","useNativeDriver","start","console","warn","upAnimate","leftAnimate","rightAnimate","downAnimate","_animate","newChildren","slice","map","push","getOtherButtonStyle","cloneElement","getContainerStyle","renderButtons","androidRipple","Version","fabOnPress","prepareFabProps","renderFab","TouchableNativeFeedback","Ripple","androidRippleColor","Component","StyledFab","mapPropsToStyleNames"],"mappings":"i1BAAA,4B,2CACA,yCAQA,8BACA,iEAEA,qD,iDACA,2DACA,mD,yDACA,mE,yEAEA,gC,i4BAEA,GAAMA,WAAY,CAChBC,KAAM,MADU,CAEhBC,KAAM,MAFU,CAGhBC,MAAO,OAHS,CAIhBC,GAAI,IAJY,CAAlB,CAOA,GAAMC,UAAW,CACfC,YAAa,YADE,CAEfC,aAAc,aAFC,CAGfC,SAAU,SAHK,CAIfC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QAAS,yBAAM,QAAKF,UAAL,EAAN,EADX,CAGE,WAAYG,qCAAwBC,MAAxB,CACVzG,mBAAU0G,kBADA,CAEV,KAFU,CAHd,EAOM,KAAKJ,eAAL,EAPN,oDASE,8BAAC,iBAAD,EAAM,MAAO,CAAC,KAAKnE,eAAL,GAAuBQ,GAAxB,CAA6BhD,KAA7B,CAAb,kDACG,KAAK4G,SAAL,EADH,CATF,CAbJ,CADF,CA8BD,C,iBAxceI,gB,EA0clB,GAAMC,WAAY,yCAAa,gBAAb,CAA+B,EAA/B,CAAmCC,8BAAnC,EAAyDvH,GAAzD,CAAlB,C,QACsBA,G,CAAbsH,S","file":"Fab.js","sourcesContent":["import React, { Component } from 'react';\nimport {\n Platform,\n Animated,\n TouchableOpacity,\n TouchableNativeFeedback,\n View,\n StyleSheet\n} from 'react-native';\nimport { remove, merge, clone } from 'lodash';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport variables from '../theme/variables/platform';\nimport { PLATFORM } from '../theme/variables/commonColor';\nimport computeProps from '../utils/computeProps';\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nimport { Button } from './Button';\n\nconst DIRECTION = {\n DOWN: 'down',\n LEFT: 'left',\n RIGHT: 'right',\n UP: 'up'\n};\n\nconst POSITION = {\n BOTTOM_LEFT: 'bottomLeft',\n BOTTOM_RIGHT: 'bottomRight',\n TOP_LEFT: 'topLeft',\n TOP_RIGHT: 'topRight'\n};\n\nconst AnimatedFab = Animated.createAnimatedComponent(Button);\n\nclass Fab extends Component {\n constructor(props) {\n super(props);\n this.containerHeight = new Animated.Value(variables.fabWidth);\n this.containerWidth = new Animated.Value(0);\n this.buttonScale = new Animated.Value(0);\n this.state = {\n buttons: undefined,\n active: false\n };\n }\n\n componentDidMount() {\n const childrenArray = React.Children.toArray(this.props.children);\n const icon = remove(childrenArray, item => {\n if (item.type.displayName === 'Styled(Button)') {\n return true;\n }\n return null;\n });\n // eslint-disable-next-line react/no-did-mount-set-state\n this.setState({\n buttons: icon.length\n });\n this.activeTimer = setTimeout(() => {\n this.setState({\n active: this.props.active\n });\n }, 0);\n }\n\n componentWillUnmount() {\n if (this.activeTimer) {\n clearTimeout(this.activeTimer);\n }\n }\n\n getOtherButtonStyle(child, i) {\n const { active, direction } = this.props;\n const type = {\n top: direction ? this.fabOtherBtns(direction, i).top : undefined,\n left: direction ? this.fabOtherBtns(direction, i).left : 8,\n right: direction ? this.fabOtherBtns(direction, i).right : 0,\n bottom: direction\n ? this.fabOtherBtns(direction, i).bottom\n : active === false\n ? Platform.OS === PLATFORM.IOS\n ? 8\n : 8\n : i * 50 + 50\n };\n\n return merge(\n this.getInitialStyle().buttonStyle,\n StyleSheet.flatten(child.props.style),\n type\n );\n }\n\n getContainerStyle() {\n return merge(this.getInitialStyle().container, this.props.containerStyle);\n }\n\n getInitialStyle(iconStyle) {\n const { direction, position } = this.props;\n return {\n fab: {\n height: variables.fabWidth,\n width: variables.fabWidth,\n borderRadius: variables.fabBorderRadius,\n elevation: variables.fabElevation,\n shadowColor: variables.fabShadowColor,\n shadowOffset: {\n width: variables.fabShadowOffsetWidth,\n height: variables.fabShadowOffsetHeight\n },\n shadowOpacity: variables.fabShadowOpacity,\n justifyContent: 'center',\n alignItems: 'center',\n shadowRadius: variables.fabShadowRadius,\n position: 'absolute',\n bottom: variables.fabBottom,\n backgroundColor: variables.fabBackgroundColor\n },\n container: {\n position: 'absolute',\n top: position ? this.fabTopValue(position).top : undefined,\n bottom: position\n ? this.fabTopValue(position).bottom\n : variables.fabContainerBottom,\n right: position\n ? this.fabTopValue(position).right\n : variables.fabContainerBottom,\n left: position ? this.fabTopValue(position).left : undefined,\n width: variables.fabWidth,\n height: this.containerHeight,\n flexDirection: direction\n ? direction === DIRECTION.LEFT || direction === DIRECTION.RIGHT\n ? 'row'\n : 'column'\n : 'column',\n alignItems: 'center'\n },\n iconStyle: {\n color: variables.fabIconColor,\n fontSize: variables.fabIconSize,\n lineHeight: Platform.OS === PLATFORM.IOS ? 27 : undefined,\n ...iconStyle\n },\n buttonStyle: {\n position: 'absolute',\n height: variables.fabButtonHeight,\n width: variables.fabButtonHeight,\n left: variables.fabButtonLeft,\n borderRadius: variables.fabButtonBorderRadius,\n transform: this.state.active\n ? [{ scale: new Animated.Value(1) }]\n : [{ scale: this.buttonScale }],\n marginBottom: variables.fabButtonMarginBottom,\n backgroundColor: variables.fabBackgroundColor\n }\n };\n }\n\n prepareButtonProps = child => {\n const inp = clone(child.props);\n delete inp.style;\n\n const defaultProps = {};\n\n return computeProps(inp, defaultProps);\n };\n\n fabTopValue = pos => {\n if (pos === POSITION.TOP_LEFT) {\n return {\n top: variables.fabDefaultPosition,\n bottom: undefined,\n left: variables.fabDefaultPosition,\n right: undefined\n };\n } else if (pos === POSITION.BOTTOM_RIGHT) {\n return {\n top: undefined,\n bottom: variables.fabDefaultPosition,\n left: undefined,\n right: variables.fabDefaultPosition\n };\n } else if (pos === POSITION.BOTTOM_LEFT) {\n return {\n top: undefined,\n bottom: variables.fabDefaultPosition,\n left: variables.fabDefaultPosition,\n right: undefined\n };\n } else if (pos === POSITION.TOP_RIGHT) {\n return {\n top: variables.fabDefaultPosition,\n bottom: undefined,\n left: undefined,\n right: variables.fabDefaultPosition\n };\n }\n return null;\n };\n\n fabOtherBtns(direction, i) {\n const { active } = this.props;\n if (direction === DIRECTION.UP) {\n return {\n top: undefined,\n bottom:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 50\n : 5\n : i * 50 + 65,\n left: 8,\n right: 0\n };\n } else if (direction === DIRECTION.LEFT) {\n return {\n top: 8,\n bottom: 0,\n left:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 8\n : 8\n : -(i * 50 + variables.fabWidth + 2),\n right: 0\n };\n } else if (direction === DIRECTION.DOWN) {\n return {\n top:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 50\n : 8\n : i * 50 + 73,\n bottom: 0,\n left: 8,\n right: 0\n };\n } else if (direction === DIRECTION.RIGHT) {\n return {\n top: 8,\n bottom: 0,\n left:\n active === false\n ? Platform.OS === PLATFORM.IOS\n ? 50\n : 8\n : i * 50 + 73,\n right: 0\n };\n }\n return null;\n }\n\n prepareFabProps() {\n const defaultProps = {\n style: this.getInitialStyle().fab\n };\n const incomingProps = clone(this.props);\n delete incomingProps.onPress;\n\n return computeProps(incomingProps, defaultProps);\n }\n\n upAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerHeight, {\n toValue: this.state.buttons * 51.3 + variables.fabWidth,\n useNativeDriver: false\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth,\n useNativeDriver: false\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n\n leftAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerWidth, {\n toValue: this.state.buttons * 51.3 + variables.fabWidth,\n useNativeDriver: false\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth,\n useNativeDriver: false\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n\n rightAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerWidth, {\n toValue: this.state.buttons * 51.3 + variables.fabWidth,\n useNativeDriver: false\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth,\n useNativeDriver: false\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n\n downAnimate() {\n if (!this.props.active) {\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth,\n useNativeDriver: false\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 1,\n useNativeDriver: true\n }).start();\n } else {\n this.setState({\n active: false\n });\n Animated.spring(this.containerHeight, {\n toValue: variables.fabWidth\n }).start();\n Animated.spring(this.buttonScale, {\n toValue: 0,\n useNativeDriver: true\n }).start();\n }\n }\n _animate() {\n const {\n props: { direction, position }\n } = this;\n\n if (direction) {\n if (direction === DIRECTION.UP) {\n if (position === POSITION.TOP_LEFT || position === POSITION.TOP_RIGHT) {\n console.warn(\n 'Passing direction = up with position = topLeft/topRight is not suggested.'\n );\n } else {\n this.upAnimate();\n }\n } else if (direction === DIRECTION.LEFT) {\n if (\n position === POSITION.TOP_LEFT ||\n position === POSITION.BOTTOM_LEFT\n ) {\n console.warn(\n 'Passing direction = left with position = topLeft/bottomLeft is not suggested.'\n );\n } else {\n this.leftAnimate();\n }\n } else if (direction === DIRECTION.RIGHT) {\n if (\n position === POSITION.TOP_RIGHT ||\n position === POSITION.BOTTOM_RIGHT\n ) {\n console.warn(\n 'Passing direction = right with position = topRight/bottomRight is not suggested.'\n );\n } else {\n this.rightAnimate();\n }\n } else if (direction === DIRECTION.DOWN) {\n if (\n position === POSITION.BOTTOM_LEFT ||\n position === POSITION.BOTTOM_RIGHT\n ) {\n console.warn(\n 'Passing direction = down with position = bottomLeft/bottomRight is not suggested.'\n );\n } else {\n this.downAnimate();\n }\n }\n } else {\n this.upAnimate();\n }\n }\n\n fabOnPress() {\n if (this.props.onPress) {\n this.props.onPress();\n this._animate();\n this.activeTimer = setTimeout(() => {\n this.setState({\n active: this.props.active\n });\n }, 100);\n }\n }\n\n renderButtons() {\n const childrenArray = React.Children.toArray(this.props.children);\n const newChildren = [];\n childrenArray.slice(1).map((child, i) =>\n newChildren.push(\n \n {child.props.children}\n \n )\n );\n return newChildren;\n }\n\n renderFab() {\n const childrenArray = React.Children.toArray(this.props.children);\n remove(childrenArray, item => {\n if (item.type.displayName === 'Styled(Button)') {\n return true;\n }\n return null;\n });\n return React.cloneElement(childrenArray[0], {\n style: this.getInitialStyle(childrenArray[0].props.style).iconStyle\n });\n }\n\n render() {\n const { style } = this.props;\n return (\n \n {this.renderButtons()}\n {Platform.OS === PLATFORM.IOS ||\n variables.androidRipple === false ||\n Platform.Version <= 21 ? (\n this.fabOnPress()}\n {...this.prepareFabProps()}\n activeOpacity={1}\n >\n {this.renderFab()}\n \n ) : (\n this.fabOnPress()}\n // eslint-disable-next-line new-cap\n background={TouchableNativeFeedback.Ripple(\n variables.androidRippleColor,\n false\n )}\n {...this.prepareFabProps()}\n >\n \n {this.renderFab()}\n \n \n )}\n \n );\n }\n}\nconst StyledFab = connectStyle('NativeBase.Fab', {}, mapPropsToStyleNames)(Fab);\nexport { StyledFab as Fab };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Item.js b/dist/src/basic/Item.js index 66ba44b2c..34bfc792f 100644 --- a/dist/src/basic/Item.js +++ b/dist/src/basic/Item.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.Item=undefined;var _extends=Object.assign||function(target){for(var i=1;i {\n this.setState({ isFocused: true });\n };\n this.floatUp(-16);\n effect();\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n // Temporary fix to avoid the crash.\n // To be refactored to getDerivedStateFromProps.\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n\n remove(childrenArray, item => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n getPlacholderValue(inputProps) {\n let placeholderValue;\n\n if (isArray(this.props.children) && this.props.children[0].props.children) {\n placeholderValue = null;\n } else {\n placeholderValue = inputProps.placeholder;\n }\n\n return placeholderValue;\n }\n\n floatBack(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n return null;\n });\n\n let inputProps = {};\n remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n\n let icon = [];\n let iconProps = {};\n icon = remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n return null;\n });\n\n let image = [];\n image = remove(childrenArray, item => {\n if (item.type === Thumbnail) {\n return item;\n }\n return null;\n });\n\n if (this.props.floatingLabel && icon.length) {\n let flag = true;\n let isIcon = false;\n\n for (let i = 0; i < this.props.children.length; i++) {\n if (\n this.props.children[i].props.name &&\n this.props.children[i].type.displayName !== 'Styled(Input)'\n ) {\n isIcon = true;\n newChildren.push(\n \n );\n }\n\n if (\n (this.props.children[i].props.children ||\n this.props.children[i].props.placeholder) &&\n flag\n ) {\n flag = false;\n\n newChildren.push(\n \n \n \n );\n\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n placeholder={this.getPlacholderValue(inputProps)}\n onFocus={() => {\n this.setState({ isFocused: true });\n if (inputProps.onFocus) {\n inputProps.onFocus();\n }\n }}\n onBlur={e => {\n if (inputProps.value) {\n this.setState({\n isFocused: true\n });\n } else if (!this.state.text.length) {\n this.setState({ isFocused: false });\n }\n\n if (inputProps.onBlur) {\n inputProps.onBlur(e);\n }\n }}\n onChangeText={text => {\n this.setState({ text });\n if (inputProps.onChangeText) {\n inputProps.onChangeText(text);\n }\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel && image.length) {\n let isImage = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].type.displayName === 'Styled(Thumbnail)') {\n isImage = true;\n\n newChildren.push(\n \n );\n }\n\n if (this.props.children[i].props.children) {\n newChildren.push(\n \n \n \n );\n\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n placeholder={this.getPlacholderValue(inputProps)}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({ isFocused: true })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n style={{\n left:\n this.props.last && isImage\n ? 10\n : this.props.last\n ? 4\n : isImage\n ? 10\n : 0,\n marginRight: 12\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n \n \n \n );\n\n newChildren.push(\n (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n placeholder={this.getPlacholderValue(inputProps)}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({ isFocused: true })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n \n \n \n \n \n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n const labelStyle = StyleSheet.flatten([\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n ]);\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack(labelProps.floatBack);\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newLabel'\n })\n );\n }\n return newLabel;\n }\n\n render() {\n return (\n (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n \n );\n }\n}\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle('NativeBase.Item', {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","isFocused","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","effect","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","item","type","displayName","roundedInputGroup","borderWidth","rounded","variables","undefined","borderRadius","inputGroupRoundedBorderRadius","placeholderValue","placeholder","e","timing","toValue","duration","useNativeDriver","start","defaultProps","style","getInitialStyle","newChildren","label","labelProps","Label","Input","icon","iconProps","Icon","image","Thumbnail","length","flag","isIcon","i","name","push","position","left","last","right","top","opacity","paddingTop","Platform","OS","paddingBottom","renderLabel","c","getPlacholderValue","onFocus","onBlur","onChangeText","isImage","marginRight","stackedLabel","flexDirection","flex","width","deviceWidth","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","createElement","key","float","floatBack","_root","prepareRootProps","renderChildren","Component","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","error","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAEA,4B,2CACA,qC,mDACA,yCAOA,8BACA,iEAEA,qD,iDACA,mD,yDACA,mE,yEAEA,8BACA,8BACA,4BACA,sC,o4BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC,UAAW,KADA,CAEXC,KAAM,EAFK,CAGXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAHE,CAIXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAJC,CAAb,CAFiB,aAQlB,C,8EACmB,iBAClB,GAAI,KAAKN,KAAL,CAAWQ,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C,CAC5C,GAAMC,QAAS,QAATA,OAAS,EAAM,CACnB,OAAKC,QAAL,CAAc,CAAEV,UAAW,IAAb,CAAd,EACD,CAFD,CAGA,KAAKW,OAAL,CAAa,CAAC,EAAd,EACAF,SACD,CACD,GAAI,KAAKF,UAAL,EAAmB,KAAKA,UAAL,CAAgBK,MAAvC,CACE,KAAKL,UAAL,CAAgBK,MAAhB,CAAuB,KAAKC,SAA5B,EACH,CACF,C,0FAMgCC,S,CAAW,iBAC1C,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB,CAEA,mBAAOJ,aAAP,CAAsB,cAAQ,CAC5B,GAAIK,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C,CAC7C,OAAKf,UAAL,CAAkBa,KAAKtB,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,CAfD,IAeO,CACLT,SAASxB,IAAT,CACExC,gBAAMsE,aAAN,CAAoB1C,YAApB,aACKD,UADL,EAEE4C,IAAK,UAFP,GADF,EAMD,CACD,MAAOP,SAAP,CACD,C,uCAEQ,iBACP,MACE,+BAAC,6BAAD,WACE,IAAK,sBAAM,QAAKU,KAAL,CAAatB,CAAnB,EADP,EAEM,KAAKuB,gBAAL,EAFN,EAGE,cAAe,CAHjB,mDAKG,KAAKC,cAAL,EALH,CADF,CASD,C,kBAtagBC,gB,EAyanBhG,KAAKiG,SAAL,aACKC,8BAAiBD,SADtB,EAEEvD,MAAOyD,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAOEC,YAAaL,oBAAUM,IAPzB,CAQEhG,cAAe0F,oBAAUM,IAR3B,CASE3B,aAAcqB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEG,MAAOT,oBAAUM,IAZnB,GAeA,GAAMI,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB9G,IADiB,CAAnB,C,QAIuBA,I,CAAd6G,U","file":"Item.js","sourcesContent":["/* eslint-disable no-plusplus */\n/* eslint-disable no-loop-func */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from 'react-native';\nimport { isArray, remove } from 'lodash';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport variables from '../theme/variables/platform';\nimport computeProps from '../utils/computeProps';\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nimport { Input } from './Input';\nimport { Label } from './Label';\nimport { Icon } from './Icon';\nimport { Thumbnail } from './Thumbnail';\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n isFocused: false,\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n const effect = () => {\n this.setState({ isFocused: true });\n };\n this.floatUp(-16);\n effect();\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n // Temporary fix to avoid the crash.\n // To be refactored to getDerivedStateFromProps.\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n\n remove(childrenArray, item => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n getPlacholderValue(inputProps) {\n let placeholderValue;\n\n if (isArray(this.props.children) && this.props.children[0].props.children) {\n placeholderValue = null;\n } else {\n placeholderValue = inputProps.placeholder;\n }\n\n return placeholderValue;\n }\n\n floatBack(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || 18,\n duration: 150,\n useNativeDriver: false\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n useNativeDriver: false\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n useNativeDriver: false\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n useNativeDriver: false\n }).start();\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n return null;\n });\n\n let inputProps = {};\n remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n\n let icon = [];\n let iconProps = {};\n icon = remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n return null;\n });\n\n let image = [];\n image = remove(childrenArray, item => {\n if (item.type === Thumbnail) {\n return item;\n }\n return null;\n });\n\n if (this.props.floatingLabel && icon.length) {\n let flag = true;\n let isIcon = false;\n\n for (let i = 0; i < this.props.children.length; i++) {\n if (\n this.props.children[i].props.name &&\n this.props.children[i].type.displayName !== 'Styled(Input)'\n ) {\n isIcon = true;\n newChildren.push(\n \n );\n }\n\n if (\n (this.props.children[i].props.children ||\n this.props.children[i].props.placeholder) &&\n flag\n ) {\n flag = false;\n\n newChildren.push(\n \n \n \n );\n\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n placeholder={this.getPlacholderValue(inputProps)}\n onFocus={() => {\n this.setState({ isFocused: true });\n if (inputProps.onFocus) {\n inputProps.onFocus();\n }\n }}\n onBlur={e => {\n if (inputProps.value) {\n this.setState({\n isFocused: true\n });\n } else if (!this.state.text.length) {\n this.setState({ isFocused: false });\n }\n\n if (inputProps.onBlur) {\n inputProps.onBlur(e);\n }\n }}\n onChangeText={text => {\n this.setState({ text });\n if (inputProps.onChangeText) {\n inputProps.onChangeText(text);\n }\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel && image.length) {\n let isImage = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].type.displayName === 'Styled(Thumbnail)') {\n isImage = true;\n\n newChildren.push(\n \n );\n }\n\n if (this.props.children[i].props.children) {\n newChildren.push(\n \n \n \n );\n\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n placeholder={this.getPlacholderValue(inputProps)}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({ isFocused: true })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n style={{\n left:\n this.props.last && isImage\n ? 10\n : this.props.last\n ? 4\n : isImage\n ? 10\n : 0,\n marginRight: 12\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n \n \n \n );\n\n newChildren.push(\n (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n placeholder={this.getPlacholderValue(inputProps)}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({ isFocused: true })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n \n \n \n \n \n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n const labelStyle = StyleSheet.flatten([\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n ]);\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack(labelProps.floatBack);\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newLabel'\n })\n );\n }\n return newLabel;\n }\n\n render() {\n return (\n (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n \n );\n }\n}\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle('NativeBase.Item', {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} \ No newline at end of file diff --git a/dist/src/basic/ToastContainer.js b/dist/src/basic/ToastContainer.js index 5b2d6cacd..558e98828 100644 --- a/dist/src/basic/ToastContainer.js +++ b/dist/src/basic/ToastContainer.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.ToastContainer=undefined;var _extends=Object.assign||function(target){for(var i=1;i=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var POSITION={ABSOLUTE:'absolute',BOTTOM:'bottom',TOP:'top'};var ToastContainer=function(_Component){_inherits(ToastContainer,_Component);_createClass(ToastContainer,null,[{key:'show',value:function show(_ref){var config=_objectWithoutProperties(_ref,[]);this.toastInstance._root.showToast({config:config});}},{key:'hide',value:function hide(){if(this.toastInstance._root.getModalState()){this.toastInstance._root.closeToast('functionCall');}}}]);function ToastContainer(props){_classCallCheck(this,ToastContainer);var _this=_possibleConstructorReturn(this,(ToastContainer.__proto__||Object.getPrototypeOf(ToastContainer)).call(this,props));_this.state={fadeAnim:new _reactNative.Animated.Value(0),pan:new _reactNative.Animated.ValueXY({x:0,y:0}),keyboardHeight:0,isKeyboardVisible:false,modalVisible:false};_this.keyboardDidHide=_this.keyboardDidHide.bind(_this);_this.keyboardDidShow=_this.keyboardDidShow.bind(_this);_this._panResponder=_reactNative.PanResponder.create({onMoveShouldSetPanResponderCapture:function onMoveShouldSetPanResponderCapture(){return true;},onPanResponderRelease:function onPanResponderRelease(evt,_ref2){var dx=_ref2.dx;if(dx!==0){_reactNative.Animated.timing(_this.state.pan,{toValue:{x:dx,y:0},duration:100}).start(function(){return _this.closeToast('swipe');});}}});return _this;}_createClass(ToastContainer,[{key:'componentDidMount',value:function componentDidMount(){_reactNative.Keyboard.addListener('keyboardDidShow',this.keyboardDidShow);_reactNative.Keyboard.addListener('keyboardDidHide',this.keyboardDidHide);}},{key:'getToastStyle',value:function getToastStyle(){return{position:POSITION.ABSOLUTE,opacity:this.state.fadeAnim,width:'100%',elevation:9,paddingHorizontal:_reactNative.Platform.OS===_commonColor.PLATFORM.IOS?20:0,top:this.state.position===POSITION.TOP?30:undefined,bottom:this.state.position===POSITION.BOTTOM?this.getTop():undefined};}},{key:'getTop',value:function getTop(){if(_reactNative.Platform.OS===_commonColor.PLATFORM.IOS){if(this.state.isKeyboardVisible){return this.state.keyboardHeight;}return 30;}return 0;}},{key:'getButtonText',value:function getButtonText(buttonText){if(buttonText){if(buttonText.trim().length===0){return undefined;}return buttonText;}return undefined;}},{key:'getModalState',value:function getModalState(){return this.state.modalVisible;}},{key:'keyboardDidHide',value:function keyboardDidHide(){this.setState({keyboardHeight:0,isKeyboardVisible:false});}},{key:'keyboardDidShow',value:function keyboardDidShow(e){this.setState({keyboardHeight:e.endCoordinates.height,isKeyboardVisible:true});}},{key:'showToast',value:function showToast(_ref3){var config=_ref3.config;this.setState({modalVisible:true,text:config.text,buttonText:this.getButtonText(config.buttonText),type:config.type,position:config.position?config.position:POSITION.BOTTOM,supportedOrientations:config.supportedOrientations,style:config.style,buttonTextStyle:config.buttonTextStyle,buttonStyle:config.buttonStyle,textStyle:config.textStyle,onClose:config.onClose});if(this.closeTimeout){clearTimeout(this.closeTimeout);}if(config.duration!==0){var duration=config.duration>0?config.duration:1500;this.closeTimeout=setTimeout(this.closeToast.bind(this,'timeout'),duration);}_reactNative.Animated.timing(this.state.fadeAnim,{toValue:1,duration:200}).start();}},{key:'closeModal',value:function closeModal(reason){this.setState({modalVisible:false});var onClose=this.state.onClose;if(onClose&&typeof onClose==='function'){onClose(reason);}}},{key:'closeToast',value:function closeToast(reason){var _this2=this;clearTimeout(this.closeTimeout);_reactNative.Animated.timing(this.state.fadeAnim,{toValue:0,duration:200}).start(function(){_this2.closeModal.bind(_this2,reason);_this2.state.pan.setValue({x:0,y:0});});}},{key:'render',value:function render(){var _this3=this;if(this.state.modalVisible){var _state$pan=this.state.pan,x=_state$pan.x,y=_state$pan.y;return _react2.default.createElement(_reactNative.Animated.View,_extends({},this._panResponder.panHandlers,{style:[this.getToastStyle(),{transform:[{translateX:x},{translateY:y}]}],__source:{fileName:_jsxFileName,lineNumber:174}}),_react2.default.createElement(_Toast.Toast,{style:[this.state.style],danger:this.state.type==='danger',success:this.state.type==='success',warning:this.state.type==='warning',__source:{fileName:_jsxFileName,lineNumber:181}},_react2.default.createElement(_Text.Text,{style:this.state.textStyle,__source:{fileName:_jsxFileName,lineNumber:187}},this.state.text),this.state.buttonText&&_react2.default.createElement(_Button.Button,{style:this.state.buttonStyle,onPress:function onPress(){return _this3.closeToast('user');},__source:{fileName:_jsxFileName,lineNumber:189}},_react2.default.createElement(_Text.Text,{style:this.state.buttonTextStyle,__source:{fileName:_jsxFileName,lineNumber:193}},this.state.buttonText))));}return null;}}]);return ToastContainer;}(_react.Component);ToastContainer.propTypes=_extends({},_reactNative.ViewPropTypes);var StyledToastContainer=(0,_nativeBaseShoutemTheme.connectStyle)('NativeBase.ToastContainer',{},_mapPropsToStyleNames2.default)(ToastContainer);exports.ToastContainer=StyledToastContainer; +Object.defineProperty(exports,"__esModule",{value:true});exports.ToastContainer=undefined;var _extends=Object.assign||function(target){for(var i=1;i=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var POSITION={ABSOLUTE:'absolute',BOTTOM:'bottom',TOP:'top'};var ToastContainer=function(_Component){_inherits(ToastContainer,_Component);_createClass(ToastContainer,null,[{key:'show',value:function show(_ref){var config=_objectWithoutProperties(_ref,[]);this.toastInstance._root.showToast({config:config});}},{key:'hide',value:function hide(){if(this.toastInstance._root.getModalState()){this.toastInstance._root.closeToast('functionCall');}}}]);function ToastContainer(props){_classCallCheck(this,ToastContainer);var _this=_possibleConstructorReturn(this,(ToastContainer.__proto__||Object.getPrototypeOf(ToastContainer)).call(this,props));_this.state={fadeAnim:new _reactNative.Animated.Value(0),pan:new _reactNative.Animated.ValueXY({x:0,y:0}),keyboardHeight:0,isKeyboardVisible:false,modalVisible:false};_this.keyboardDidHide=_this.keyboardDidHide.bind(_this);_this.keyboardDidShow=_this.keyboardDidShow.bind(_this);_this._panResponder=_reactNative.PanResponder.create({onMoveShouldSetPanResponderCapture:function onMoveShouldSetPanResponderCapture(){return true;},onPanResponderRelease:function onPanResponderRelease(evt,_ref2){var dx=_ref2.dx;if(dx!==0){_reactNative.Animated.timing(_this.state.pan,{toValue:{x:dx,y:0},duration:100}).start(function(){return _this.closeToast('swipe');});}}});return _this;}_createClass(ToastContainer,[{key:'componentDidMount',value:function componentDidMount(){_reactNative.Keyboard.addListener('keyboardDidShow',this.keyboardDidShow);_reactNative.Keyboard.addListener('keyboardDidHide',this.keyboardDidHide);}},{key:'getToastStyle',value:function getToastStyle(){return{position:POSITION.ABSOLUTE,opacity:this.state.fadeAnim,width:'100%',elevation:9,paddingHorizontal:_reactNative.Platform.OS===_commonColor.PLATFORM.IOS?20:0,top:this.state.position===POSITION.TOP?30:undefined,bottom:this.state.position===POSITION.BOTTOM?this.getTop():undefined};}},{key:'getTop',value:function getTop(){if(_reactNative.Platform.OS===_commonColor.PLATFORM.IOS){if(this.state.isKeyboardVisible){return this.state.keyboardHeight;}return 30;}return 0;}},{key:'getButtonText',value:function getButtonText(buttonText){if(buttonText){if(buttonText.trim().length===0){return undefined;}return buttonText;}return undefined;}},{key:'getModalState',value:function getModalState(){return this.state.modalVisible;}},{key:'keyboardDidHide',value:function keyboardDidHide(){this.setState({keyboardHeight:0,isKeyboardVisible:false});}},{key:'keyboardDidShow',value:function keyboardDidShow(e){this.setState({keyboardHeight:e.endCoordinates.height,isKeyboardVisible:true});}},{key:'showToast',value:function showToast(_ref3){var config=_ref3.config;this.setState({modalVisible:true,text:config.text,buttonText:this.getButtonText(config.buttonText),type:config.type,position:config.position?config.position:POSITION.BOTTOM,supportedOrientations:config.supportedOrientations,style:config.style,buttonTextStyle:config.buttonTextStyle,buttonStyle:config.buttonStyle,textStyle:config.textStyle,onClose:config.onClose});if(this.closeTimeout){clearTimeout(this.closeTimeout);}if(config.duration!==0){var duration=config.duration>0?config.duration:1500;this.closeTimeout=setTimeout(this.closeToast.bind(this,'timeout'),duration);}_reactNative.Animated.timing(this.state.fadeAnim,{toValue:1,duration:200,useNativeDriver:false}).start();}},{key:'closeModal',value:function closeModal(reason){this.setState({modalVisible:false});var onClose=this.state.onClose;if(onClose&&typeof onClose==='function'){onClose(reason);}}},{key:'closeToast',value:function closeToast(reason){var _this2=this;clearTimeout(this.closeTimeout);_reactNative.Animated.timing(this.state.fadeAnim,{toValue:0,duration:200,useNativeDriver:false}).start(function(){_this2.closeModal.bind(_this2,reason);_this2.state.pan.setValue({x:0,y:0});});}},{key:'render',value:function render(){var _this3=this;if(this.state.modalVisible){var _state$pan=this.state.pan,x=_state$pan.x,y=_state$pan.y;return _react2.default.createElement(_reactNative.Animated.View,_extends({},this._panResponder.panHandlers,{style:[this.getToastStyle(),{transform:[{translateX:x},{translateY:y}]}],__source:{fileName:_jsxFileName,lineNumber:176}}),_react2.default.createElement(_Toast.Toast,{style:[this.state.style],danger:this.state.type==='danger',success:this.state.type==='success',warning:this.state.type==='warning',__source:{fileName:_jsxFileName,lineNumber:183}},_react2.default.createElement(_Text.Text,{style:this.state.textStyle,__source:{fileName:_jsxFileName,lineNumber:189}},this.state.text),this.state.buttonText&&_react2.default.createElement(_Button.Button,{style:this.state.buttonStyle,onPress:function onPress(){return _this3.closeToast('user');},__source:{fileName:_jsxFileName,lineNumber:191}},_react2.default.createElement(_Text.Text,{style:this.state.buttonTextStyle,__source:{fileName:_jsxFileName,lineNumber:195}},this.state.buttonText))));}return null;}}]);return ToastContainer;}(_react.Component);ToastContainer.propTypes=_extends({},_reactNative.ViewPropTypes);var StyledToastContainer=(0,_nativeBaseShoutemTheme.connectStyle)('NativeBase.ToastContainer',{},_mapPropsToStyleNames2.default)(ToastContainer);exports.ToastContainer=StyledToastContainer; //# sourceMappingURL=ToastContainer.js.map \ No newline at end of file diff --git a/dist/src/basic/ToastContainer.js.map b/dist/src/basic/ToastContainer.js.map index 60ff4896f..e0a581afc 100644 --- a/dist/src/basic/ToastContainer.js.map +++ b/dist/src/basic/ToastContainer.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/basic/ToastContainer.js"],"names":["POSITION","ABSOLUTE","BOTTOM","TOP","ToastContainer","config","toastInstance","_root","showToast","getModalState","closeToast","props","state","fadeAnim","Animated","Value","pan","ValueXY","x","y","keyboardHeight","isKeyboardVisible","modalVisible","keyboardDidHide","bind","keyboardDidShow","_panResponder","PanResponder","create","onMoveShouldSetPanResponderCapture","onPanResponderRelease","evt","dx","timing","toValue","duration","start","Keyboard","addListener","position","opacity","width","elevation","paddingHorizontal","Platform","OS","PLATFORM","IOS","top","undefined","bottom","getTop","buttonText","trim","length","setState","e","endCoordinates","height","text","getButtonText","type","supportedOrientations","style","buttonTextStyle","buttonStyle","textStyle","onClose","closeTimeout","clearTimeout","setTimeout","reason","closeModal","setValue","panHandlers","getToastStyle","transform","translateX","translateY","Component","propTypes","ViewPropTypes","StyledToastContainer","mapPropsToStyleNames"],"mappings":"u2BACA,4B,2CACA,qC,mDACA,yCAOA,iEAEA,mE,yEACA,2DAEA,4BACA,gCACA,8B,skCAEA,GAAMA,UAAW,CACfC,SAAU,UADK,CAEfC,OAAQ,QAFO,CAGfC,IAAK,KAHU,CAAjB,C,GAMMC,e,kIACuB,IAAVC,OAAU,mCACzB,KAAKC,aAAL,CAAmBC,KAAnB,CAAyBC,SAAzB,CAAmC,CAAEH,aAAF,CAAnC,EACD,C,mCACa,CACZ,GAAI,KAAKC,aAAL,CAAmBC,KAAnB,CAAyBE,aAAzB,EAAJ,CAA8C,CAC5C,KAAKH,aAAL,CAAmBC,KAAnB,CAAyBG,UAAzB,CAAoC,cAApC,EACD,CACF,C,IACD,wBAAYC,KAAZ,CAAmB,4JACXA,KADW,GAGjB,MAAKC,KAAL,CAAa,CACXC,SAAU,GAAIC,uBAASC,KAAb,CAAmB,CAAnB,CADC,CAEXC,IAAK,GAAIF,uBAASG,OAAb,CAAqB,CAAEC,EAAG,CAAL,CAAQC,EAAG,CAAX,CAArB,CAFM,CAGXC,eAAgB,CAHL,CAIXC,kBAAmB,KAJR,CAKXC,aAAc,KALH,CAAb,CAQA,MAAKC,eAAL,CAAuB,MAAKA,eAAL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L,CAAWiD,IAAX,GAAoB,QAF9B,CAGE,QAAS,KAAKjD,KAAL,CAAWiD,IAAX,GAAoB,SAH/B,CAIE,QAAS,KAAKjD,KAAL,CAAWiD,IAAX,GAAoB,SAJ/B,kDAME,8BAAC,UAAD,EAAM,MAAO,KAAKjD,KAAL,CAAWsD,SAAxB,kDAAoC,KAAKtD,KAAL,CAAW+C,IAA/C,CANF,CAOG,KAAK/C,KAAL,CAAWwC,UAAX,EACC,8BAAC,cAAD,EACE,MAAO,KAAKxC,KAAL,CAAWqD,WADpB,CAEE,QAAS,yBAAM,QAAKvD,UAAL,CAAgB,MAAhB,CAAN,EAFX,kDAIE,8BAAC,UAAD,EAAM,MAAO,KAAKE,KAAL,CAAWoD,eAAxB,kDACG,KAAKpD,KAAL,CAAWwC,UADd,CAJF,CARJ,CAPF,CADF,CA4BD,CACD,MAAO,KAAP,CACD,C,4BAjL0B2B,gB,EAoL7B3E,eAAe4E,SAAf,aACKC,0BADL,EAIA,GAAMC,sBAAuB,yCAC3B,2BAD2B,CAE3B,EAF2B,CAG3BC,8BAH2B,EAI3B/E,cAJ2B,CAA7B,C,QAMiCA,c,CAAxB8E,oB","file":"ToastContainer.js","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n Keyboard,\n Platform,\n Animated,\n ViewPropTypes,\n PanResponder\n} from 'react-native';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\nimport { PLATFORM } from '../theme/variables/commonColor';\n\nimport { Text } from './Text';\nimport { Button } from './Button';\nimport { Toast } from './Toast';\n\nconst POSITION = {\n ABSOLUTE: 'absolute',\n BOTTOM: 'bottom',\n TOP: 'top'\n};\n\nclass ToastContainer extends Component {\n static show({ ...config }) {\n this.toastInstance._root.showToast({ config });\n }\n static hide() {\n if (this.toastInstance._root.getModalState()) {\n this.toastInstance._root.closeToast('functionCall');\n }\n }\n constructor(props) {\n super(props);\n\n this.state = {\n fadeAnim: new Animated.Value(0),\n pan: new Animated.ValueXY({ x: 0, y: 0 }),\n keyboardHeight: 0,\n isKeyboardVisible: false,\n modalVisible: false\n };\n\n this.keyboardDidHide = this.keyboardDidHide.bind(this);\n this.keyboardDidShow = this.keyboardDidShow.bind(this);\n this._panResponder = PanResponder.create({\n onMoveShouldSetPanResponderCapture: () => true,\n onPanResponderRelease: (evt, { dx }) => {\n if (dx !== 0) {\n Animated.timing(this.state.pan, {\n toValue: { x: dx, y: 0 },\n duration: 100\n }).start(() => this.closeToast('swipe'));\n }\n }\n });\n }\n\n componentDidMount() {\n Keyboard.addListener('keyboardDidShow', this.keyboardDidShow);\n Keyboard.addListener('keyboardDidHide', this.keyboardDidHide);\n }\n\n getToastStyle() {\n return {\n position: POSITION.ABSOLUTE,\n opacity: this.state.fadeAnim,\n width: '100%',\n elevation: 9,\n paddingHorizontal: Platform.OS === PLATFORM.IOS ? 20 : 0,\n top: this.state.position === POSITION.TOP ? 30 : undefined,\n bottom:\n this.state.position === POSITION.BOTTOM ? this.getTop() : undefined\n };\n }\n\n getTop() {\n if (Platform.OS === PLATFORM.IOS) {\n if (this.state.isKeyboardVisible) {\n return this.state.keyboardHeight;\n }\n return 30;\n }\n return 0;\n }\n\n getButtonText(buttonText) {\n if (buttonText) {\n if (buttonText.trim().length === 0) {\n return undefined;\n }\n return buttonText;\n }\n return undefined;\n }\n getModalState() {\n return this.state.modalVisible;\n }\n\n static toastInstance;\n\n keyboardDidHide() {\n this.setState({\n keyboardHeight: 0,\n isKeyboardVisible: false\n });\n }\n\n keyboardDidShow(e) {\n this.setState({\n keyboardHeight: e.endCoordinates.height,\n isKeyboardVisible: true\n });\n }\n\n showToast({ config }) {\n this.setState({\n modalVisible: true,\n text: config.text,\n buttonText: this.getButtonText(config.buttonText),\n type: config.type,\n position: config.position ? config.position : POSITION.BOTTOM,\n supportedOrientations: config.supportedOrientations,\n style: config.style,\n buttonTextStyle: config.buttonTextStyle,\n buttonStyle: config.buttonStyle,\n textStyle: config.textStyle,\n onClose: config.onClose\n });\n // If we have a toast already open, cut off its close timeout so that it won't affect *this* toast.\n if (this.closeTimeout) {\n clearTimeout(this.closeTimeout);\n }\n // Set the toast to close after the duration.\n if (config.duration !== 0) {\n const duration = config.duration > 0 ? config.duration : 1500;\n this.closeTimeout = setTimeout(\n this.closeToast.bind(this, 'timeout'),\n duration\n );\n }\n // Fade the toast in now.\n Animated.timing(this.state.fadeAnim, {\n toValue: 1,\n duration: 200\n }).start();\n }\n closeModal(reason) {\n this.setState({\n modalVisible: false\n });\n const { onClose } = this.state;\n if (onClose && typeof onClose === 'function') {\n onClose(reason);\n }\n }\n closeToast(reason) {\n clearTimeout(this.closeTimeout);\n Animated.timing(this.state.fadeAnim, {\n toValue: 0,\n duration: 200\n }).start(() => {\n this.closeModal.bind(this, reason);\n this.state.pan.setValue({ x: 0, y: 0 });\n });\n }\n\n render() {\n if (this.state.modalVisible) {\n const { x, y } = this.state.pan;\n return (\n \n \n {this.state.text}\n {this.state.buttonText && (\n this.closeToast('user')}\n >\n \n {this.state.buttonText}\n \n \n )}\n \n \n );\n }\n return null;\n }\n}\n\nToastContainer.propTypes = {\n ...ViewPropTypes\n};\n\nconst StyledToastContainer = connectStyle(\n 'NativeBase.ToastContainer',\n {},\n mapPropsToStyleNames\n)(ToastContainer);\n\nexport { StyledToastContainer as ToastContainer };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/ToastContainer.js"],"names":["POSITION","ABSOLUTE","BOTTOM","TOP","ToastContainer","config","toastInstance","_root","showToast","getModalState","closeToast","props","state","fadeAnim","Animated","Value","pan","ValueXY","x","y","keyboardHeight","isKeyboardVisible","modalVisible","keyboardDidHide","bind","keyboardDidShow","_panResponder","PanResponder","create","onMoveShouldSetPanResponderCapture","onPanResponderRelease","evt","dx","timing","toValue","duration","start","Keyboard","addListener","position","opacity","width","elevation","paddingHorizontal","Platform","OS","PLATFORM","IOS","top","undefined","bottom","getTop","buttonText","trim","length","setState","e","endCoordinates","height","text","getButtonText","type","supportedOrientations","style","buttonTextStyle","buttonStyle","textStyle","onClose","closeTimeout","clearTimeout","setTimeout","useNativeDriver","reason","closeModal","setValue","panHandlers","getToastStyle","transform","translateX","translateY","Component","propTypes","ViewPropTypes","StyledToastContainer","mapPropsToStyleNames"],"mappings":"u2BACA,4B,2CACA,qC,mDACA,yCAOA,iEAEA,mE,yEACA,2DAEA,4BACA,gCACA,8B,skCAEA,GAAMA,UAAW,CACfC,SAAU,UADK,CAEfC,OAAQ,QAFO,CAGfC,IAAK,KAHU,CAAjB,C,GAMMC,e,kIACuB,IAAVC,OAAU,mCACzB,KAAKC,aAAL,CAAmBC,KAAnB,CAAyBC,SAAzB,CAAmC,CAAEH,aAAF,CAAnC,EACD,C,mCACa,CACZ,GAAI,KAAKC,aAAL,CAAmBC,KAAnB,CAAyBE,aAAzB,EAAJ,CAA8C,CAC5C,KAAKH,aAAL,CAAmBC,KAAnB,CAAyBG,UAAzB,CAAoC,cAApC,EACD,CACF,C,IACD,wBAAYC,KAAZ,CAAmB,4JACXA,KADW,GAGjB,MAAKC,KAAL,CAAa,CACXC,SAAU,GAAIC,uBAASC,KAAb,CAAmB,CAAnB,CADC,CAEXC,IAAK,GAAIF,uBAASG,OAAb,CAAqB,CAAEC,EAAG,CAAL,CAAQC,EAAG,CAAX,CAArB,CAFM,CAGXC,eAAgB,CAHL,CAIXC,kBAAmB,KAJR,CAKXC,aAAc,KALH,CAAb,CAQA,MAAKC,eAAL,CAAuB,MAAKA,eAAL,CAAqBC,IAArB,OAAvB,CACA,MAAKC,eAAL,CAAuB,MAAKA,eAAL,CAAqBD,IAArB,OAAvB,CACA,MAAKE,aAAL,CAAqBC,0BAAaC,MAAb,CAAoB,CACvCC,mCAAoC,oDAAM,KAAN,EADG,CAEvCC,sBAAuB,+BAACC,GAAD,OAAiB,IAATC,GAAS,OAATA,EAAS,CACtC,GAAIA,KAAO,CAAX,CAAc,CACZlB,sBAAS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AKtD,KAAL,CAAW+C,IAA/C,CANF,CAOG,KAAK/C,KAAL,CAAWwC,UAAX,EACC,8BAAC,cAAD,EACE,MAAO,KAAKxC,KAAL,CAAWqD,WADpB,CAEE,QAAS,yBAAM,QAAKvD,UAAL,CAAgB,MAAhB,CAAN,EAFX,kDAIE,8BAAC,UAAD,EAAM,MAAO,KAAKE,KAAL,CAAWoD,eAAxB,kDACG,KAAKpD,KAAL,CAAWwC,UADd,CAJF,CARJ,CAPF,CADF,CA4BD,CACD,MAAO,KAAP,CACD,C,4BAnL0B4B,gB,EAsL7B5E,eAAe6E,SAAf,aACKC,0BADL,EAIA,GAAMC,sBAAuB,yCAC3B,2BAD2B,CAE3B,EAF2B,CAG3BC,8BAH2B,EAI3BhF,cAJ2B,CAA7B,C,QAMiCA,c,CAAxB+E,oB","file":"ToastContainer.js","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n Keyboard,\n Platform,\n Animated,\n ViewPropTypes,\n PanResponder\n} from 'react-native';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\nimport { PLATFORM } from '../theme/variables/commonColor';\n\nimport { Text } from './Text';\nimport { Button } from './Button';\nimport { Toast } from './Toast';\n\nconst POSITION = {\n ABSOLUTE: 'absolute',\n BOTTOM: 'bottom',\n TOP: 'top'\n};\n\nclass ToastContainer extends Component {\n static show({ ...config }) {\n this.toastInstance._root.showToast({ config });\n }\n static hide() {\n if (this.toastInstance._root.getModalState()) {\n this.toastInstance._root.closeToast('functionCall');\n }\n }\n constructor(props) {\n super(props);\n\n this.state = {\n fadeAnim: new Animated.Value(0),\n pan: new Animated.ValueXY({ x: 0, y: 0 }),\n keyboardHeight: 0,\n isKeyboardVisible: false,\n modalVisible: false\n };\n\n this.keyboardDidHide = this.keyboardDidHide.bind(this);\n this.keyboardDidShow = this.keyboardDidShow.bind(this);\n this._panResponder = PanResponder.create({\n onMoveShouldSetPanResponderCapture: () => true,\n onPanResponderRelease: (evt, { dx }) => {\n if (dx !== 0) {\n Animated.timing(this.state.pan, {\n toValue: { x: dx, y: 0 },\n duration: 100\n }).start(() => this.closeToast('swipe'));\n }\n }\n });\n }\n\n componentDidMount() {\n Keyboard.addListener('keyboardDidShow', this.keyboardDidShow);\n Keyboard.addListener('keyboardDidHide', this.keyboardDidHide);\n }\n\n getToastStyle() {\n return {\n position: POSITION.ABSOLUTE,\n opacity: this.state.fadeAnim,\n width: '100%',\n elevation: 9,\n paddingHorizontal: Platform.OS === PLATFORM.IOS ? 20 : 0,\n top: this.state.position === POSITION.TOP ? 30 : undefined,\n bottom:\n this.state.position === POSITION.BOTTOM ? this.getTop() : undefined\n };\n }\n\n getTop() {\n if (Platform.OS === PLATFORM.IOS) {\n if (this.state.isKeyboardVisible) {\n return this.state.keyboardHeight;\n }\n return 30;\n }\n return 0;\n }\n\n getButtonText(buttonText) {\n if (buttonText) {\n if (buttonText.trim().length === 0) {\n return undefined;\n }\n return buttonText;\n }\n return undefined;\n }\n getModalState() {\n return this.state.modalVisible;\n }\n\n static toastInstance;\n\n keyboardDidHide() {\n this.setState({\n keyboardHeight: 0,\n isKeyboardVisible: false\n });\n }\n\n keyboardDidShow(e) {\n this.setState({\n keyboardHeight: e.endCoordinates.height,\n isKeyboardVisible: true\n });\n }\n\n showToast({ config }) {\n this.setState({\n modalVisible: true,\n text: config.text,\n buttonText: this.getButtonText(config.buttonText),\n type: config.type,\n position: config.position ? config.position : POSITION.BOTTOM,\n supportedOrientations: config.supportedOrientations,\n style: config.style,\n buttonTextStyle: config.buttonTextStyle,\n buttonStyle: config.buttonStyle,\n textStyle: config.textStyle,\n onClose: config.onClose\n });\n // If we have a toast already open, cut off its close timeout so that it won't affect *this* toast.\n if (this.closeTimeout) {\n clearTimeout(this.closeTimeout);\n }\n // Set the toast to close after the duration.\n if (config.duration !== 0) {\n const duration = config.duration > 0 ? config.duration : 1500;\n this.closeTimeout = setTimeout(\n this.closeToast.bind(this, 'timeout'),\n duration\n );\n }\n // Fade the toast in now.\n Animated.timing(this.state.fadeAnim, {\n toValue: 1,\n duration: 200,\n useNativeDriver: false\n }).start();\n }\n closeModal(reason) {\n this.setState({\n modalVisible: false\n });\n const { onClose } = this.state;\n if (onClose && typeof onClose === 'function') {\n onClose(reason);\n }\n }\n closeToast(reason) {\n clearTimeout(this.closeTimeout);\n Animated.timing(this.state.fadeAnim, {\n toValue: 0,\n duration: 200,\n useNativeDriver: false\n }).start(() => {\n this.closeModal.bind(this, reason);\n this.state.pan.setValue({ x: 0, y: 0 });\n });\n }\n\n render() {\n if (this.state.modalVisible) {\n const { x, y } = this.state.pan;\n return (\n \n \n {this.state.text}\n {this.state.buttonText && (\n this.closeToast('user')}\n >\n \n {this.state.buttonText}\n \n \n )}\n \n \n );\n }\n return null;\n }\n}\n\nToastContainer.propTypes = {\n ...ViewPropTypes\n};\n\nconst StyledToastContainer = connectStyle(\n 'NativeBase.ToastContainer',\n {},\n mapPropsToStyleNames\n)(ToastContainer);\n\nexport { StyledToastContainer as ToastContainer };\n"]} \ No newline at end of file diff --git a/dist/src/theme/components/Badge.js b/dist/src/theme/components/Badge.js index 2c2b7ff75..977c3641f 100644 --- a/dist/src/theme/components/Badge.js +++ b/dist/src/theme/components/Badge.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});var _platform=require('./../variables/platform');var _platform2=_interopRequireDefault(_platform);var _commonColor=require('./../variables/commonColor');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}exports.default=function(){var variables=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_platform2.default;var badgeTheme={'.primary':{backgroundColor:variables.buttonPrimaryBg},'.warning':{backgroundColor:variables.buttonWarningBg},'.info':{backgroundColor:variables.buttonInfoBg},'.success':{backgroundColor:variables.buttonSuccessBg},'.danger':{backgroundColor:variables.buttonDangerBg},'NativeBase.Text':{color:variables.badgeColor,fontSize:variables.fontSizeBase,lineHeight:variables.lineHeight-1,textAlign:'center',paddingHorizontal:3},backgroundColor:variables.badgeBg,padding:variables.badgePadding,paddingHorizontal:6,alignSelf:'flex-start',justifyContent:variables.platform===_commonColor.PLATFORM.IOS?'center':undefined,borderRadius:13.5,height:27};return badgeTheme;}; +Object.defineProperty(exports,"__esModule",{value:true});var _platform=require('./../variables/platform');var _platform2=_interopRequireDefault(_platform);var _commonColor=require('./../variables/commonColor');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}exports.default=function(){var variables=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_platform2.default;var badgeTheme={'.primary':{backgroundColor:variables.buttonPrimaryBg},'.warning':{backgroundColor:variables.buttonWarningBg},'.info':{backgroundColor:variables.buttonInfoBg},'.success':{backgroundColor:variables.buttonSuccessBg},'.danger':{backgroundColor:variables.buttonDangerBg},'NativeBase.Text':{color:variables.badgeColor,fontSize:variables.fontSizeBase,lineHeight:variables.lineHeight-1,textAlign:'center',paddingHorizontal:3},backgroundColor:variables.badgeBg,padding:variables.badgePadding,paddingHorizontal:6,alignSelf:'flex-start',justifyContent:'center',borderRadius:13.5,height:27};return badgeTheme;}; //# sourceMappingURL=Badge.js.map \ No newline at end of file diff --git a/dist/src/theme/components/Badge.js.map b/dist/src/theme/components/Badge.js.map index c4ead23ac..756a2bf82 100644 --- a/dist/src/theme/components/Badge.js.map +++ b/dist/src/theme/components/Badge.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../../src/theme/components/Badge.js"],"names":["variables","variable","badgeTheme","backgroundColor","buttonPrimaryBg","buttonWarningBg","buttonInfoBg","buttonSuccessBg","buttonDangerBg","color","badgeColor","fontSize","fontSizeBase","lineHeight","textAlign","paddingHorizontal","badgeBg","padding","badgePadding","alignSelf","justifyContent","platform","PLATFORM","IOS","undefined","borderRadius","height"],"mappings":"yDAEA,iD,iDACA,uD,mGAEe,UAAoC,IAAnCA,UAAmC,2DAAbC,kBAAa,CACjD,GAAMC,YAAa,CACjB,WAAY,CACVC,gBAAiBH,UAAUI,eADjB,CADK,CAIjB,WAAY,CACVD,gBAAiBH,UAAUK,eADjB,CAJK,CAOjB,QAAS,CACPF,gBAAiBH,UAAUM,YADpB,CAPQ,CAUjB,WAAY,CACVH,gBAAiBH,UAAUO,eADjB,CAVK,CAajB,UAAW,CACTJ,gBAAiBH,UAAUQ,cADlB,CAbM,CAgBjB,kBAAmB,CACjBC,MAAOT,UAAUU,UADA,CAEjBC,SAAUX,UAAUY,YAFH,CAGjBC,WAAYb,UAAUa,UAAV,CAAuB,CAHlB,CAIjBC,UAAW,QAJM,CAKjBC,kBAAmB,CALF,CAhBF,CAuBjBZ,gBAAiBH,UAAUgB,OAvBV,CAwBjBC,QAASjB,UAAUkB,YAxBF,CAyBjBH,kBAAmB,CAzBF,CA0BjBI,UAAW,YA1BM,CA2BjBC,eAAgBpB,UAAUqB,QAAV,GAAuBC,sBAASC,GAAhC,CAAsC,QAAtC,CAAiDC,SA3BhD,CA4BjBC,aAAc,IA5BG,CA6BjBC,OAAQ,EA7BS,CAAnB,CA+BA,MAAOxB,WAAP,CACD,C","file":"Badge.js","sourcesContent":["// @flow\n\nimport variable from './../variables/platform';\nimport { PLATFORM } from './../variables/commonColor';\n\nexport default (variables /* : * */ = variable) => {\n const badgeTheme = {\n '.primary': {\n backgroundColor: variables.buttonPrimaryBg\n },\n '.warning': {\n backgroundColor: variables.buttonWarningBg\n },\n '.info': {\n backgroundColor: variables.buttonInfoBg\n },\n '.success': {\n backgroundColor: variables.buttonSuccessBg\n },\n '.danger': {\n backgroundColor: variables.buttonDangerBg\n },\n 'NativeBase.Text': {\n color: variables.badgeColor,\n fontSize: variables.fontSizeBase,\n lineHeight: variables.lineHeight - 1,\n textAlign: 'center',\n paddingHorizontal: 3\n },\n backgroundColor: variables.badgeBg,\n padding: variables.badgePadding,\n paddingHorizontal: 6,\n alignSelf: 'flex-start',\n justifyContent: variables.platform === PLATFORM.IOS ? 'center' : undefined,\n borderRadius: 13.5,\n height: 27\n };\n return badgeTheme;\n};\n"]} \ No newline at end of file +{"version":3,"sources":["../../../../src/theme/components/Badge.js"],"names":["variables","variable","badgeTheme","backgroundColor","buttonPrimaryBg","buttonWarningBg","buttonInfoBg","buttonSuccessBg","buttonDangerBg","color","badgeColor","fontSize","fontSizeBase","lineHeight","textAlign","paddingHorizontal","badgeBg","padding","badgePadding","alignSelf","justifyContent","borderRadius","height"],"mappings":"yDAEA,iD,iDACA,uD,mGAEe,UAAoC,IAAnCA,UAAmC,2DAAbC,kBAAa,CACjD,GAAMC,YAAa,CACjB,WAAY,CACVC,gBAAiBH,UAAUI,eADjB,CADK,CAIjB,WAAY,CACVD,gBAAiBH,UAAUK,eADjB,CAJK,CAOjB,QAAS,CACPF,gBAAiBH,UAAUM,YADpB,CAPQ,CAUjB,WAAY,CACVH,gBAAiBH,UAAUO,eADjB,CAVK,CAajB,UAAW,CACTJ,gBAAiBH,UAAUQ,cADlB,CAbM,CAgBjB,kBAAmB,CACjBC,MAAOT,UAAUU,UADA,CAEjBC,SAAUX,UAAUY,YAFH,CAGjBC,WAAYb,UAAUa,UAAV,CAAuB,CAHlB,CAIjBC,UAAW,QAJM,CAKjBC,kBAAmB,CALF,CAhBF,CAuBjBZ,gBAAiBH,UAAUgB,OAvBV,CAwBjBC,QAASjB,UAAUkB,YAxBF,CAyBjBH,kBAAmB,CAzBF,CA0BjBI,UAAW,YA1BM,CA2BjBC,eAAgB,QA3BC,CA4BjBC,aAAc,IA5BG,CA6BjBC,OAAQ,EA7BS,CAAnB,CA+BA,MAAOpB,WAAP,CACD,C","file":"Badge.js","sourcesContent":["// @flow\n\nimport variable from './../variables/platform';\nimport { PLATFORM } from './../variables/commonColor';\n\nexport default (variables /* : * */ = variable) => {\n const badgeTheme = {\n '.primary': {\n backgroundColor: variables.buttonPrimaryBg\n },\n '.warning': {\n backgroundColor: variables.buttonWarningBg\n },\n '.info': {\n backgroundColor: variables.buttonInfoBg\n },\n '.success': {\n backgroundColor: variables.buttonSuccessBg\n },\n '.danger': {\n backgroundColor: variables.buttonDangerBg\n },\n 'NativeBase.Text': {\n color: variables.badgeColor,\n fontSize: variables.fontSizeBase,\n lineHeight: variables.lineHeight - 1,\n textAlign: 'center',\n paddingHorizontal: 3\n },\n backgroundColor: variables.badgeBg,\n padding: variables.badgePadding,\n paddingHorizontal: 6,\n alignSelf: 'flex-start',\n justifyContent: 'center',\n borderRadius: 13.5,\n height: 27\n };\n return badgeTheme;\n};\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 6b0011afe..ba86f7b6d 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "license": "Apache-2.0", "private": false, "dependencies": { + "@react-native-community/picker": "^1.6.1", "blueimp-md5": "^2.5.0", "clamp": "^1.0.1", "color": "~3.1.2", diff --git a/src/basic/Picker.android.js b/src/basic/Picker.android.js index 792ffd018..381f5261d 100644 --- a/src/basic/Picker.android.js +++ b/src/basic/Picker.android.js @@ -2,7 +2,9 @@ /* eslint-disable react/prefer-es6-class */ import React, { Component } from 'react'; import createReactClass from 'create-react-class'; -import { Picker } from 'react-native'; + +import { Picker } from '@react-native-community/picker'; + import { connectStyle } from 'native-base-shoutem-theme'; import mapPropsToStyleNames from '../utils/mapPropsToStyleNames'; diff --git a/src/basic/Picker.ios.js b/src/basic/Picker.ios.js index fd537a301..ed205dc06 100644 --- a/src/basic/Picker.ios.js +++ b/src/basic/Picker.ios.js @@ -4,7 +4,10 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import { FlatList, Modal, Picker, View, ViewPropTypes } from 'react-native'; +import { FlatList, Modal, View, ViewPropTypes } from 'react-native'; + +import { Picker } from '@react-native-community/picker'; + import { connectStyle } from 'native-base-shoutem-theme'; import { find, get } from 'lodash'; @@ -211,36 +214,36 @@ class PickerNB extends Component { {this.renderHeader()} - String(index)} - renderItem={({ item }) => ( - { - this._setModalVisible(false); - this.props.onValueChange(item.props.value, item.key); - this.setState({ current: item.props.label }); - }} - > - - - {item.props.label} - - - - {item.props.value === this.props.selectedValue ? ( - - ) : ( - - )} - - - )} - /> + String(index)} + renderItem={({ item }) => ( + { + this._setModalVisible(false); + this.props.onValueChange(item.props.value, item.key); + this.setState({ current: item.props.label }); + }} + > + + + {item.props.label} + + + + {item.props.value === this.props.selectedValue ? ( + + ) : ( + + )} + + + )} + /> diff --git a/src/basic/Picker.js b/src/basic/Picker.js index 792ffd018..381f5261d 100644 --- a/src/basic/Picker.js +++ b/src/basic/Picker.js @@ -2,7 +2,9 @@ /* eslint-disable react/prefer-es6-class */ import React, { Component } from 'react'; import createReactClass from 'create-react-class'; -import { Picker } from 'react-native'; + +import { Picker } from '@react-native-community/picker'; + import { connectStyle } from 'native-base-shoutem-theme'; import mapPropsToStyleNames from '../utils/mapPropsToStyleNames'; diff --git a/src/basic/PickerItem.js b/src/basic/PickerItem.js index ac3a31abf..4892100d4 100644 --- a/src/basic/PickerItem.js +++ b/src/basic/PickerItem.js @@ -1,5 +1,7 @@ import React, { Component } from 'react'; -import { Picker } from 'react-native'; + +import { Picker } from '@react-native-community/picker'; + import { connectStyle } from 'native-base-shoutem-theme'; import mapPropsToStyleNames from '../utils/mapPropsToStyleNames'; diff --git a/src/basic/ToastContainer.js b/src/basic/ToastContainer.js index 14e865a3b..f57bffb1e 100644 --- a/src/basic/ToastContainer.js +++ b/src/basic/ToastContainer.js @@ -1,6 +1,5 @@ /* eslint-disable class-methods-use-this */ import React, { Component } from 'react'; -import PropTypes from 'prop-types'; import { Keyboard, Platform, diff --git a/src/theme/components/Badge.js b/src/theme/components/Badge.js index c27981eaa..98623bbdb 100644 --- a/src/theme/components/Badge.js +++ b/src/theme/components/Badge.js @@ -1,7 +1,6 @@ // @flow import variable from './../variables/platform'; -import { PLATFORM } from './../variables/commonColor'; export default (variables /* : * */ = variable) => { const badgeTheme = { diff --git a/yarn.lock b/yarn.lock index 08e5f2671..0b39e3470 100644 --- a/yarn.lock +++ b/yarn.lock @@ -927,6 +927,11 @@ shell-quote "1.6.1" ws "^1.1.0" +"@react-native-community/picker@^1.6.1": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@react-native-community/picker/-/picker-1.6.1.tgz#f893bf4982e549c954696d08a47e1d8e72762310" + integrity sha512-JuCOtim1tZhB3KoJhbuPj3pFweUnj4XgukktJk0MyUOB8wA3uCEHW+xsGYu8ZDYiyR0M6qXctz7Fz2qYFuTUSQ== + "@types/babel__core@^7.1.0": version "7.1.2" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.2.tgz#608c74f55928033fce18b99b213c16be4b3d114f" @@ -6598,11 +6603,6 @@ react-test-renderer@16.4.1: prop-types "^15.6.0" react-is "^16.4.1" -react-timer-mixin@^0.13.4: - version "0.13.4" - resolved "https://registry.yarnpkg.com/react-timer-mixin/-/react-timer-mixin-0.13.4.tgz#75a00c3c94c13abe29b43d63b4c65a88fc8264d3" - integrity sha512-4+ow23tp/Tv7hBM5Az5/Be/eKKF7DIvJ09voz5LyHGQaqqz9WV8YMs31eFvcYQs7d451LSg7kDJV70XYN/Ug/Q== - react-transform-hmr@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/react-transform-hmr/-/react-transform-hmr-1.0.4.tgz#e1a40bd0aaefc72e8dfd7a7cda09af85066397bb" From b1ad24110749d9dff3b9e05f64632e69459dda00 Mon Sep 17 00:00:00 2001 From: Preeternal Date: Mon, 15 Jun 2020 10:03:37 +0300 Subject: [PATCH 2/2] add @react-native-community/picker into peerDependencies --- README.md | 8 ++++++++ dist/src/basic/Picker.android.js | 2 +- dist/src/basic/Picker.android.js.map | 2 +- dist/src/basic/Picker.ios.js | 2 +- dist/src/basic/Picker.ios.js.map | 2 +- dist/src/basic/Picker.js | 2 +- dist/src/basic/Picker.js.map | 2 +- dist/src/basic/PickerItem.js | 2 +- dist/src/basic/PickerItem.js.map | 2 +- dist/src/basic/ToastContainer.js | 2 +- dist/src/basic/ToastContainer.js.map | 2 +- dist/src/theme/components/Badge.js | 2 +- dist/src/theme/components/Badge.js.map | 2 +- package.json | 3 ++- yarn.lock | 8 ++++---- 15 files changed, 26 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 0268f1431..de00a220f 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,10 @@ npm install native-base --save *Install Peer Dependencies:*
The peer dependencies included from any npm packages does not automatically get installed. Your application will not depend on it explicitly. +```js +npm install @react-native-community/picker --save +``` + ```js react-native link ``` @@ -72,6 +76,10 @@ Refer this link for additional information on [Expo](https://docs.expo.io/) ```js npm install native-base --save ``` +*Install peerDependencies:* +```js +npm install @react-native-community/picker --save +```
diff --git a/dist/src/basic/Picker.android.js b/dist/src/basic/Picker.android.js index f0df59231..c96d9edb7 100644 --- a/dist/src/basic/Picker.android.js +++ b/dist/src/basic/Picker.android.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.PickerNB=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\n// eslint-disable-next-line react/no-multi-comp\nPickerNB.Item = createReactClass({\n render() {\n return ;\n }\n});\n\nPickerNB.propTypes = {\n ...Picker.propTypes\n};\n\nconst StyledPickerNB = connectStyle(\n 'NativeBase.PickerNB',\n {},\n mapPropsToStyleNames\n)(PickerNB);\n\nexport { StyledPickerNB as PickerNB };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Picker.android.js"],"names":["PickerNB","_root","c","props","children","Component","Item","render","propTypes","Picker","StyledPickerNB","mapPropsToStyleNames"],"mappings":"i2BAEA,4B,2CACA,oD,iEAEA,sDAEA,iEAEA,mE,68BAEqBA,S,yRACV,iBACP,MACE,+BAAC,cAAD,WAAQ,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAb,EAAwC,KAAKC,KAA7C,mDACG,KAAKA,KAAL,CAAWC,QADd,CADF,CAKD,C,sBAPmCC,gB,kBAAjBL,Q,CAWrBA,SAASM,IAAT,CAAgB,+BAAiB,oBAC/BC,MAD+B,kBACtB,CACP,MAAO,+BAAC,cAAD,CAAQ,IAAR,aAAiB,KAAKJ,KAAtB,mDAAP,CACD,CAH8B,CAAjB,CAAhB,CAMAH,SAASQ,SAAT,aACKC,eAAOD,SADZ,EAIA,GAAME,gBAAiB,yCACrB,qBADqB,CAErB,EAFqB,CAGrBC,8BAHqB,EAIrBX,QAJqB,CAAvB,C,QAM2BA,Q,CAAlBU,c","file":"Picker.android.js","sourcesContent":["/* eslint-disable react/prefer-stateless-function */\n/* eslint-disable react/prefer-es6-class */\nimport React, { Component } from 'react';\nimport createReactClass from 'create-react-class';\n\nimport { Picker } from '@react-native-community/picker';\n\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nexport default class PickerNB extends Component {\n render() {\n return (\n (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\n// eslint-disable-next-line react/no-multi-comp\nPickerNB.Item = createReactClass({\n render() {\n return ;\n }\n});\n\nPickerNB.propTypes = {\n ...Picker.propTypes\n};\n\nconst StyledPickerNB = connectStyle(\n 'NativeBase.PickerNB',\n {},\n mapPropsToStyleNames\n)(PickerNB);\n\nexport { StyledPickerNB as PickerNB };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Picker.ios.js b/dist/src/basic/Picker.ios.js index 6122bb783..5e2be60eb 100644 --- a/dist/src/basic/Picker.ios.js +++ b/dist/src/basic/Picker.ios.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.PickerNB=undefined;var _jsxFileName='src/basic/Picker.ios.js';var _extends=Object.assign||function(target){for(var i=1;i {\n return {\n picker: {\n // alignItems: 'flex-end'\n },\n pickerItem: {}\n };\n };\n\n getLabel(props) {\n const children = this.getChildren(props.children);\n const item = find(\n children,\n child => child.props.value === props.selectedValue\n );\n return get(item, 'props.label');\n }\n\n getSelectedItem() {\n return find(\n this.props.children,\n child => child.props.value === this.props.selectedValue\n );\n }\n\n getChildren = children => {\n if (children && !Array.isArray(children)) {\n return [].concat(children);\n }\n // eslint-disable-next-line prefer-spread\n const appliedChildren = [].concat.apply([], children);\n return appliedChildren;\n };\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().picker,\n itemStyle: this.getInitialStyle().pickerItem\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n _setModalVisible(visible) {\n this.setState({ modalVisible: visible });\n }\n\n renderIcon() {\n return React.cloneElement(this.props.iosIcon, {\n style: [\n {\n fontSize: 22,\n lineHeight: 26\n },\n { ...this.props.iosIcon.props.style }\n ]\n });\n }\n\n renderButton() {\n const onPress = () => {\n if (this.props.enabled !== undefined && !this.props.enabled) return;\n this._setModalVisible(true);\n };\n const text = this.state.currentLabel\n ? this.state.currentLabel\n : this.props.placeholder;\n if (this.props.renderButton) {\n return this.props.renderButton({\n onPress,\n text,\n picker: this,\n selectedItem: this.getSelectedItem()\n });\n }\n return (\n \n {this.state.currentLabel ? (\n \n {this.state.currentLabel}\n \n ) : (\n \n {this.props.placeholder}\n \n )}\n {this.props.iosIcon === undefined ? null : this.renderIcon()}\n \n );\n }\n\n renderHeader() {\n return this.props.renderHeader ? (\n this.props.renderHeader(() => this._setModalVisible(false))\n ) : (\n
\n \n {\n this._setModalVisible(false);\n }}\n >\n \n {this.props.headerBackButtonText || 'Back'}\n \n \n \n \n \n {this.props.iosHeader || 'Select One'}\n \n \n \n
\n );\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillReceiveProps(nextProps) {\n const currentLabel = this.state.currentLabel;\n const nextLabel = this.getLabel(nextProps);\n const currentDS = this.state.dataSource;\n const nextDS = this.getChildren(nextProps.children);\n\n if (currentLabel !== nextLabel) {\n this.setState({\n currentLabel: nextLabel\n });\n }\n if (currentDS !== nextDS) {\n this.setState({\n dataSource: nextDS\n });\n }\n }\n\n render() {\n return (\n (this._root = c)}>\n {this.renderButton()}\n {\n this._setModalVisible(false);\n }}\n >\n \n {this.renderHeader()}\n \n String(index)}\n renderItem={({ item }) => (\n {\n this._setModalVisible(false);\n this.props.onValueChange(item.props.value, item.key);\n this.setState({ current: item.props.label });\n }}\n >\n \n \n {item.props.label}\n \n \n \n {item.props.value === this.props.selectedValue ? (\n \n ) : (\n \n )}\n \n \n )}\n />\n \n \n \n \n );\n }\n}\n\n// eslint-disable-next-line react/no-multi-comp\nPickerNB.Item = createReactClass({\n render() {\n return ;\n }\n});\n\nPickerNB.propTypes = {\n ...ViewPropTypes,\n renderButton: PropTypes.func\n};\n\nconst StyledPickerNB = connectStyle(\n 'NativeBase.PickerNB',\n {},\n mapPropsToStyleNames\n)(PickerNB);\n\nexport { StyledPickerNB as PickerNB };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Picker.ios.js"],"names":["PickerNB","props","getInitialStyle","picker","pickerItem","getChildren","children","Array","isArray","concat","appliedChildren","apply","state","modalVisible","currentLabel","getLabel","dataSource","item","child","value","selectedValue","defaultProps","style","itemStyle","visible","setState","React","cloneElement","iosIcon","fontSize","lineHeight","onPress","enabled","undefined","_setModalVisible","text","placeholder","renderButton","selectedItem","getSelectedItem","textStyle","note","placeholderStyle","renderIcon","renderHeader","headerStyle","shadowOffset","shadowColor","shadowRadius","shadowOpacity","marginLeft","headerBackButtonStyle","headerBackButtonTextStyle","headerBackButtonText","headerTitleStyle","iosHeader","nextProps","nextLabel","currentDS","nextDS","_root","c","modalStyle","testID","index","String","onValueChange","key","current","label","itemTextStyle","Component","Item","render","propTypes","ViewPropTypes","PropTypes","func","StyledPickerNB","mapPropsToStyleNames"],"mappings":"61BAGA,4B,2CACA,qC,mDACA,oD,iEACA,yCAEA,sDAEA,iEACA,8BAEA,mD,yDACA,mE,yEAEA,4BACA,8BACA,sCACA,kCACA,oCACA,gCACA,gCACA,8BACA,4BACA,8BACA,4B,o4BAEMA,S,qDACJ,kBAAYC,KAAZ,CAAmB,0IACXA,KADW,SASnBC,eATmB,CASD,UAAM,CACtB,MAAO,CACLC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AAL,CAAWoE,KADd,CADF,CAVF,CAeE,8BAAC,YAAD,mDACGpD,KAAKhB,KAAL,CAAWkB,KAAX,GAAqB,OAAKlB,KAAL,CAAWmB,aAAhC,CACC,8BAAC,YAAD,EAAO,aAAP,kDADD,CAGC,8BAAC,YAAD,EAAO,SAAU,KAAjB,kDAJJ,CAfF,CADU,EAJd,kDADF,CAFF,CAVF,CAFF,CADF,CAmDD,C,sBA/NoBmD,gB,EAmOvBvE,SAASwE,IAAT,CAAgB,+BAAiB,oBAC/BC,MAD+B,kBACtB,CACP,MAAO,+BAAC,cAAD,CAAQ,IAAR,aAAiB,KAAKxE,KAAL,EAAjB,oDAAP,CACD,CAH8B,CAAjB,CAAhB,CAMAD,SAAS0E,SAAT,aACKC,0BADL,EAEEtC,aAAcuC,oBAAUC,IAF1B,GAKA,GAAMC,gBAAiB,yCACrB,qBADqB,CAErB,EAFqB,CAGrBC,8BAHqB,EAIrB/E,QAJqB,CAAvB,C,QAM2BA,Q,CAAlB8E,c","file":"Picker.ios.js","sourcesContent":["/* eslint-disable react/prefer-stateless-function */\n/* eslint-disable react/prefer-es6-class */\n/* eslint-disable react/sort-comp */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport createReactClass from 'create-react-class';\nimport { FlatList, Modal, View, ViewPropTypes } from 'react-native';\n\nimport { Picker } from '@react-native-community/picker';\n\nimport { connectStyle } from 'native-base-shoutem-theme';\nimport { find, get } from 'lodash';\n\nimport computeProps from '../utils/computeProps';\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nimport { Text } from './Text';\nimport { Radio } from './Radio';\nimport { Container } from './Container';\nimport { Content } from './Content';\nimport { ListItem } from './ListItem';\nimport { Button } from './Button';\nimport { Header } from './Header';\nimport { Title } from './Title';\nimport { Left } from './Left';\nimport { Right } from './Right';\nimport { Body } from './Body';\n\nclass PickerNB extends Component {\n constructor(props) {\n super(props);\n this.state = {\n modalVisible: false,\n currentLabel: this.getLabel(props),\n dataSource: this.getChildren(props.children)\n };\n }\n\n getInitialStyle = () => {\n return {\n picker: {\n // alignItems: 'flex-end'\n },\n pickerItem: {}\n };\n };\n\n getLabel(props) {\n const children = this.getChildren(props.children);\n const item = find(\n children,\n child => child.props.value === props.selectedValue\n );\n return get(item, 'props.label');\n }\n\n getSelectedItem() {\n return find(\n this.props.children,\n child => child.props.value === this.props.selectedValue\n );\n }\n\n getChildren = children => {\n if (children && !Array.isArray(children)) {\n return [].concat(children);\n }\n // eslint-disable-next-line prefer-spread\n const appliedChildren = [].concat.apply([], children);\n return appliedChildren;\n };\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().picker,\n itemStyle: this.getInitialStyle().pickerItem\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n _setModalVisible(visible) {\n this.setState({ modalVisible: visible });\n }\n\n renderIcon() {\n return React.cloneElement(this.props.iosIcon, {\n style: [\n {\n fontSize: 22,\n lineHeight: 26\n },\n { ...this.props.iosIcon.props.style }\n ]\n });\n }\n\n renderButton() {\n const onPress = () => {\n if (this.props.enabled !== undefined && !this.props.enabled) return;\n this._setModalVisible(true);\n };\n const text = this.state.currentLabel\n ? this.state.currentLabel\n : this.props.placeholder;\n if (this.props.renderButton) {\n return this.props.renderButton({\n onPress,\n text,\n picker: this,\n selectedItem: this.getSelectedItem()\n });\n }\n return (\n \n {this.state.currentLabel ? (\n \n {this.state.currentLabel}\n \n ) : (\n \n {this.props.placeholder}\n \n )}\n {this.props.iosIcon === undefined ? null : this.renderIcon()}\n \n );\n }\n\n renderHeader() {\n return this.props.renderHeader ? (\n this.props.renderHeader(() => this._setModalVisible(false))\n ) : (\n
\n \n {\n this._setModalVisible(false);\n }}\n >\n \n {this.props.headerBackButtonText || 'Back'}\n \n \n \n \n \n {this.props.iosHeader || 'Select One'}\n \n \n \n
\n );\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillReceiveProps(nextProps) {\n const currentLabel = this.state.currentLabel;\n const nextLabel = this.getLabel(nextProps);\n const currentDS = this.state.dataSource;\n const nextDS = this.getChildren(nextProps.children);\n\n if (currentLabel !== nextLabel) {\n this.setState({\n currentLabel: nextLabel\n });\n }\n if (currentDS !== nextDS) {\n this.setState({\n dataSource: nextDS\n });\n }\n }\n\n render() {\n return (\n (this._root = c)}>\n {this.renderButton()}\n {\n this._setModalVisible(false);\n }}\n >\n \n {this.renderHeader()}\n \n String(index)}\n renderItem={({ item }) => (\n {\n this._setModalVisible(false);\n this.props.onValueChange(item.props.value, item.key);\n this.setState({ current: item.props.label });\n }}\n >\n \n \n {item.props.label}\n \n \n \n {item.props.value === this.props.selectedValue ? (\n \n ) : (\n \n )}\n \n \n )}\n />\n \n \n \n \n );\n }\n}\n\n// eslint-disable-next-line react/no-multi-comp\nPickerNB.Item = createReactClass({\n render() {\n return ;\n }\n});\n\nPickerNB.propTypes = {\n ...ViewPropTypes,\n renderButton: PropTypes.func\n};\n\nconst StyledPickerNB = connectStyle(\n 'NativeBase.PickerNB',\n {},\n mapPropsToStyleNames\n)(PickerNB);\n\nexport { StyledPickerNB as PickerNB };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Picker.js b/dist/src/basic/Picker.js index 3c9d860ba..717e1e403 100644 --- a/dist/src/basic/Picker.js +++ b/dist/src/basic/Picker.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.PickerNB=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\n// eslint-disable-next-line react/no-multi-comp\nPickerNB.Item = createReactClass({\n render() {\n return ;\n }\n});\n\nPickerNB.propTypes = {\n ...Picker.propTypes\n};\n\nconst StyledPickerNB = connectStyle(\n 'NativeBase.PickerNB',\n {},\n mapPropsToStyleNames\n)(PickerNB);\n\nexport { StyledPickerNB as PickerNB };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Picker.js"],"names":["PickerNB","_root","c","props","children","Component","Item","render","propTypes","Picker","StyledPickerNB","mapPropsToStyleNames"],"mappings":"y1BAEA,4B,2CACA,oD,iEAEA,sDAEA,iEAEA,mE,68BAEqBA,S,yRACV,iBACP,MACE,+BAAC,cAAD,WAAQ,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAb,EAAwC,KAAKC,KAA7C,mDACG,KAAKA,KAAL,CAAWC,QADd,CADF,CAKD,C,sBAPmCC,gB,kBAAjBL,Q,CAWrBA,SAASM,IAAT,CAAgB,+BAAiB,oBAC/BC,MAD+B,kBACtB,CACP,MAAO,+BAAC,cAAD,CAAQ,IAAR,aAAiB,KAAKJ,KAAtB,mDAAP,CACD,CAH8B,CAAjB,CAAhB,CAMAH,SAASQ,SAAT,aACKC,eAAOD,SADZ,EAIA,GAAME,gBAAiB,yCACrB,qBADqB,CAErB,EAFqB,CAGrBC,8BAHqB,EAIrBX,QAJqB,CAAvB,C,QAM2BA,Q,CAAlBU,c","file":"Picker.js","sourcesContent":["/* eslint-disable react/prefer-stateless-function */\n/* eslint-disable react/prefer-es6-class */\nimport React, { Component } from 'react';\nimport createReactClass from 'create-react-class';\n\nimport { Picker } from '@react-native-community/picker';\n\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nexport default class PickerNB extends Component {\n render() {\n return (\n (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\n// eslint-disable-next-line react/no-multi-comp\nPickerNB.Item = createReactClass({\n render() {\n return ;\n }\n});\n\nPickerNB.propTypes = {\n ...Picker.propTypes\n};\n\nconst StyledPickerNB = connectStyle(\n 'NativeBase.PickerNB',\n {},\n mapPropsToStyleNames\n)(PickerNB);\n\nexport { StyledPickerNB as PickerNB };\n"]} \ No newline at end of file diff --git a/dist/src/basic/PickerItem.js b/dist/src/basic/PickerItem.js index 69eef55b3..c31c30dbb 100644 --- a/dist/src/basic/PickerItem.js +++ b/dist/src/basic/PickerItem.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.Item=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n }\n}\n\nItem.propTypes = {\n ...Picker.Item.propTypes\n};\n\nconst StyledItem = connectStyle('NativeBase.Item', {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/PickerItem.js"],"names":["Item","_root","c","props","Component","propTypes","Picker","StyledItem","mapPropsToStyleNames"],"mappings":"y1BAAA,4B,2CAEA,sDAEA,iEAEA,mE,68BAEMA,K,iQACK,iBACP,MAAO,+BAAC,cAAD,CAAQ,IAAR,WAAa,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAlB,EAA6C,KAAKC,KAAlD,mDAAP,CACD,C,kBAHgBC,gB,EAMnBJ,KAAKK,SAAL,aACKC,eAAON,IAAP,CAAYK,SADjB,EAIA,GAAME,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjBR,IADiB,CAAnB,C,QAIuBA,I,CAAdO,U","file":"PickerItem.js","sourcesContent":["import React, { Component } from 'react';\n\nimport { Picker } from '@react-native-community/picker';\n\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nclass Item extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nItem.propTypes = {\n ...Picker.Item.propTypes\n};\n\nconst StyledItem = connectStyle('NativeBase.Item', {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} \ No newline at end of file diff --git a/dist/src/basic/ToastContainer.js b/dist/src/basic/ToastContainer.js index 558e98828..a8998cca5 100644 --- a/dist/src/basic/ToastContainer.js +++ b/dist/src/basic/ToastContainer.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.ToastContainer=undefined;var _extends=Object.assign||function(target){for(var i=1;i=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var POSITION={ABSOLUTE:'absolute',BOTTOM:'bottom',TOP:'top'};var ToastContainer=function(_Component){_inherits(ToastContainer,_Component);_createClass(ToastContainer,null,[{key:'show',value:function show(_ref){var config=_objectWithoutProperties(_ref,[]);this.toastInstance._root.showToast({config:config});}},{key:'hide',value:function hide(){if(this.toastInstance._root.getModalState()){this.toastInstance._root.closeToast('functionCall');}}}]);function ToastContainer(props){_classCallCheck(this,ToastContainer);var _this=_possibleConstructorReturn(this,(ToastContainer.__proto__||Object.getPrototypeOf(ToastContainer)).call(this,props));_this.state={fadeAnim:new _reactNative.Animated.Value(0),pan:new _reactNative.Animated.ValueXY({x:0,y:0}),keyboardHeight:0,isKeyboardVisible:false,modalVisible:false};_this.keyboardDidHide=_this.keyboardDidHide.bind(_this);_this.keyboardDidShow=_this.keyboardDidShow.bind(_this);_this._panResponder=_reactNative.PanResponder.create({onMoveShouldSetPanResponderCapture:function onMoveShouldSetPanResponderCapture(){return true;},onPanResponderRelease:function onPanResponderRelease(evt,_ref2){var dx=_ref2.dx;if(dx!==0){_reactNative.Animated.timing(_this.state.pan,{toValue:{x:dx,y:0},duration:100}).start(function(){return _this.closeToast('swipe');});}}});return _this;}_createClass(ToastContainer,[{key:'componentDidMount',value:function componentDidMount(){_reactNative.Keyboard.addListener('keyboardDidShow',this.keyboardDidShow);_reactNative.Keyboard.addListener('keyboardDidHide',this.keyboardDidHide);}},{key:'getToastStyle',value:function getToastStyle(){return{position:POSITION.ABSOLUTE,opacity:this.state.fadeAnim,width:'100%',elevation:9,paddingHorizontal:_reactNative.Platform.OS===_commonColor.PLATFORM.IOS?20:0,top:this.state.position===POSITION.TOP?30:undefined,bottom:this.state.position===POSITION.BOTTOM?this.getTop():undefined};}},{key:'getTop',value:function getTop(){if(_reactNative.Platform.OS===_commonColor.PLATFORM.IOS){if(this.state.isKeyboardVisible){return this.state.keyboardHeight;}return 30;}return 0;}},{key:'getButtonText',value:function getButtonText(buttonText){if(buttonText){if(buttonText.trim().length===0){return undefined;}return buttonText;}return undefined;}},{key:'getModalState',value:function getModalState(){return this.state.modalVisible;}},{key:'keyboardDidHide',value:function keyboardDidHide(){this.setState({keyboardHeight:0,isKeyboardVisible:false});}},{key:'keyboardDidShow',value:function keyboardDidShow(e){this.setState({keyboardHeight:e.endCoordinates.height,isKeyboardVisible:true});}},{key:'showToast',value:function showToast(_ref3){var config=_ref3.config;this.setState({modalVisible:true,text:config.text,buttonText:this.getButtonText(config.buttonText),type:config.type,position:config.position?config.position:POSITION.BOTTOM,supportedOrientations:config.supportedOrientations,style:config.style,buttonTextStyle:config.buttonTextStyle,buttonStyle:config.buttonStyle,textStyle:config.textStyle,onClose:config.onClose});if(this.closeTimeout){clearTimeout(this.closeTimeout);}if(config.duration!==0){var duration=config.duration>0?config.duration:1500;this.closeTimeout=setTimeout(this.closeToast.bind(this,'timeout'),duration);}_reactNative.Animated.timing(this.state.fadeAnim,{toValue:1,duration:200,useNativeDriver:false}).start();}},{key:'closeModal',value:function closeModal(reason){this.setState({modalVisible:false});var onClose=this.state.onClose;if(onClose&&typeof onClose==='function'){onClose(reason);}}},{key:'closeToast',value:function closeToast(reason){var _this2=this;clearTimeout(this.closeTimeout);_reactNative.Animated.timing(this.state.fadeAnim,{toValue:0,duration:200,useNativeDriver:false}).start(function(){_this2.closeModal.bind(_this2,reason);_this2.state.pan.setValue({x:0,y:0});});}},{key:'render',value:function render(){var _this3=this;if(this.state.modalVisible){var _state$pan=this.state.pan,x=_state$pan.x,y=_state$pan.y;return _react2.default.createElement(_reactNative.Animated.View,_extends({},this._panResponder.panHandlers,{style:[this.getToastStyle(),{transform:[{translateX:x},{translateY:y}]}],__source:{fileName:_jsxFileName,lineNumber:176}}),_react2.default.createElement(_Toast.Toast,{style:[this.state.style],danger:this.state.type==='danger',success:this.state.type==='success',warning:this.state.type==='warning',__source:{fileName:_jsxFileName,lineNumber:183}},_react2.default.createElement(_Text.Text,{style:this.state.textStyle,__source:{fileName:_jsxFileName,lineNumber:189}},this.state.text),this.state.buttonText&&_react2.default.createElement(_Button.Button,{style:this.state.buttonStyle,onPress:function onPress(){return _this3.closeToast('user');},__source:{fileName:_jsxFileName,lineNumber:191}},_react2.default.createElement(_Text.Text,{style:this.state.buttonTextStyle,__source:{fileName:_jsxFileName,lineNumber:195}},this.state.buttonText))));}return null;}}]);return ToastContainer;}(_react.Component);ToastContainer.propTypes=_extends({},_reactNative.ViewPropTypes);var StyledToastContainer=(0,_nativeBaseShoutemTheme.connectStyle)('NativeBase.ToastContainer',{},_mapPropsToStyleNames2.default)(ToastContainer);exports.ToastContainer=StyledToastContainer; +Object.defineProperty(exports,"__esModule",{value:true});exports.ToastContainer=undefined;var _extends=Object.assign||function(target){for(var i=1;i=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var POSITION={ABSOLUTE:'absolute',BOTTOM:'bottom',TOP:'top'};var ToastContainer=function(_Component){_inherits(ToastContainer,_Component);_createClass(ToastContainer,null,[{key:'show',value:function show(_ref){var config=_objectWithoutProperties(_ref,[]);this.toastInstance._root.showToast({config:config});}},{key:'hide',value:function hide(){if(this.toastInstance._root.getModalState()){this.toastInstance._root.closeToast('functionCall');}}}]);function ToastContainer(props){_classCallCheck(this,ToastContainer);var _this=_possibleConstructorReturn(this,(ToastContainer.__proto__||Object.getPrototypeOf(ToastContainer)).call(this,props));_this.state={fadeAnim:new _reactNative.Animated.Value(0),pan:new _reactNative.Animated.ValueXY({x:0,y:0}),keyboardHeight:0,isKeyboardVisible:false,modalVisible:false};_this.keyboardDidHide=_this.keyboardDidHide.bind(_this);_this.keyboardDidShow=_this.keyboardDidShow.bind(_this);_this._panResponder=_reactNative.PanResponder.create({onMoveShouldSetPanResponderCapture:function onMoveShouldSetPanResponderCapture(){return true;},onPanResponderRelease:function onPanResponderRelease(evt,_ref2){var dx=_ref2.dx;if(dx!==0){_reactNative.Animated.timing(_this.state.pan,{toValue:{x:dx,y:0},duration:100}).start(function(){return _this.closeToast('swipe');});}}});return _this;}_createClass(ToastContainer,[{key:'componentDidMount',value:function componentDidMount(){_reactNative.Keyboard.addListener('keyboardDidShow',this.keyboardDidShow);_reactNative.Keyboard.addListener('keyboardDidHide',this.keyboardDidHide);}},{key:'getToastStyle',value:function getToastStyle(){return{position:POSITION.ABSOLUTE,opacity:this.state.fadeAnim,width:'100%',elevation:9,paddingHorizontal:_reactNative.Platform.OS===_commonColor.PLATFORM.IOS?20:0,top:this.state.position===POSITION.TOP?30:undefined,bottom:this.state.position===POSITION.BOTTOM?this.getTop():undefined};}},{key:'getTop',value:function getTop(){if(_reactNative.Platform.OS===_commonColor.PLATFORM.IOS){if(this.state.isKeyboardVisible){return this.state.keyboardHeight;}return 30;}return 0;}},{key:'getButtonText',value:function getButtonText(buttonText){if(buttonText){if(buttonText.trim().length===0){return undefined;}return buttonText;}return undefined;}},{key:'getModalState',value:function getModalState(){return this.state.modalVisible;}},{key:'keyboardDidHide',value:function keyboardDidHide(){this.setState({keyboardHeight:0,isKeyboardVisible:false});}},{key:'keyboardDidShow',value:function keyboardDidShow(e){this.setState({keyboardHeight:e.endCoordinates.height,isKeyboardVisible:true});}},{key:'showToast',value:function showToast(_ref3){var config=_ref3.config;this.setState({modalVisible:true,text:config.text,buttonText:this.getButtonText(config.buttonText),type:config.type,position:config.position?config.position:POSITION.BOTTOM,supportedOrientations:config.supportedOrientations,style:config.style,buttonTextStyle:config.buttonTextStyle,buttonStyle:config.buttonStyle,textStyle:config.textStyle,onClose:config.onClose});if(this.closeTimeout){clearTimeout(this.closeTimeout);}if(config.duration!==0){var duration=config.duration>0?config.duration:1500;this.closeTimeout=setTimeout(this.closeToast.bind(this,'timeout'),duration);}_reactNative.Animated.timing(this.state.fadeAnim,{toValue:1,duration:200,useNativeDriver:false}).start();}},{key:'closeModal',value:function closeModal(reason){this.setState({modalVisible:false});var onClose=this.state.onClose;if(onClose&&typeof onClose==='function'){onClose(reason);}}},{key:'closeToast',value:function closeToast(reason){var _this2=this;clearTimeout(this.closeTimeout);_reactNative.Animated.timing(this.state.fadeAnim,{toValue:0,duration:200,useNativeDriver:false}).start(function(){_this2.closeModal.bind(_this2,reason);_this2.state.pan.setValue({x:0,y:0});});}},{key:'render',value:function render(){var _this3=this;if(this.state.modalVisible){var _state$pan=this.state.pan,x=_state$pan.x,y=_state$pan.y;return _react2.default.createElement(_reactNative.Animated.View,_extends({},this._panResponder.panHandlers,{style:[this.getToastStyle(),{transform:[{translateX:x},{translateY:y}]}],__source:{fileName:_jsxFileName,lineNumber:175}}),_react2.default.createElement(_Toast.Toast,{style:[this.state.style],danger:this.state.type==='danger',success:this.state.type==='success',warning:this.state.type==='warning',__source:{fileName:_jsxFileName,lineNumber:182}},_react2.default.createElement(_Text.Text,{style:this.state.textStyle,__source:{fileName:_jsxFileName,lineNumber:188}},this.state.text),this.state.buttonText&&_react2.default.createElement(_Button.Button,{style:this.state.buttonStyle,onPress:function onPress(){return _this3.closeToast('user');},__source:{fileName:_jsxFileName,lineNumber:190}},_react2.default.createElement(_Text.Text,{style:this.state.buttonTextStyle,__source:{fileName:_jsxFileName,lineNumber:194}},this.state.buttonText))));}return null;}}]);return ToastContainer;}(_react.Component);ToastContainer.propTypes=_extends({},_reactNative.ViewPropTypes);var StyledToastContainer=(0,_nativeBaseShoutemTheme.connectStyle)('NativeBase.ToastContainer',{},_mapPropsToStyleNames2.default)(ToastContainer);exports.ToastContainer=StyledToastContainer; //# sourceMappingURL=ToastContainer.js.map \ No newline at end of file diff --git a/dist/src/basic/ToastContainer.js.map b/dist/src/basic/ToastContainer.js.map index e0a581afc..6620989e3 100644 --- a/dist/src/basic/ToastContainer.js.map +++ b/dist/src/basic/ToastContainer.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/basic/ToastContainer.js"],"names":["POSITION","ABSOLUTE","BOTTOM","TOP","ToastContainer","config","toastInstance","_root","showToast","getModalState","closeToast","props","state","fadeAnim","Animated","Value","pan","ValueXY","x","y","keyboardHeight","isKeyboardVisible","modalVisible","keyboardDidHide","bind","keyboardDidShow","_panResponder","PanResponder","create","onMoveShouldSetPanResponderCapture","onPanResponderRelease","evt","dx","timing","toValue","duration","start","Keyboard","addListener","position","opacity","width","elevation","paddingHorizontal","Platform","OS","PLATFORM","IOS","top","undefined","bottom","getTop","buttonText","trim","length","setState","e","endCoordinates","height","text","getButtonText","type","supportedOrientations","style","buttonTextStyle","buttonStyle","textStyle","onClose","closeTimeout","clearTimeout","setTimeout","useNativeDriver","reason","closeModal","setValue","panHandlers","getToastStyle","transform","translateX","translateY","Component","propTypes","ViewPropTypes","StyledToastContainer","mapPropsToStyleNames"],"mappings":"u2BACA,4B,2CACA,qC,mDACA,yCAOA,iEAEA,mE,yEACA,2DAEA,4BACA,gCACA,8B,sk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CAPF,CADF,CA4BD,CACD,MAAO,KAAP,CACD,C,4BAnL0B4B,gB,EAsL7B5E,eAAe6E,SAAf,aACKC,0BADL,EAIA,GAAMC,sBAAuB,yCAC3B,2BAD2B,CAE3B,EAF2B,CAG3BC,8BAH2B,EAI3BhF,cAJ2B,CAA7B,C,QAMiCA,c,CAAxB+E,oB","file":"ToastContainer.js","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n Keyboard,\n Platform,\n Animated,\n ViewPropTypes,\n PanResponder\n} from 'react-native';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\nimport { PLATFORM } from '../theme/variables/commonColor';\n\nimport { Text } from './Text';\nimport { Button } from './Button';\nimport { Toast } from './Toast';\n\nconst POSITION = {\n ABSOLUTE: 'absolute',\n BOTTOM: 'bottom',\n TOP: 'top'\n};\n\nclass ToastContainer extends Component {\n static show({ ...config }) {\n this.toastInstance._root.showToast({ config });\n }\n static hide() {\n if (this.toastInstance._root.getModalState()) {\n this.toastInstance._root.closeToast('functionCall');\n }\n }\n constructor(props) {\n super(props);\n\n this.state = {\n fadeAnim: new Animated.Value(0),\n pan: new Animated.ValueXY({ x: 0, y: 0 }),\n keyboardHeight: 0,\n isKeyboardVisible: false,\n modalVisible: false\n };\n\n this.keyboardDidHide = this.keyboardDidHide.bind(this);\n this.keyboardDidShow = this.keyboardDidShow.bind(this);\n this._panResponder = PanResponder.create({\n onMoveShouldSetPanResponderCapture: () => true,\n onPanResponderRelease: (evt, { dx }) => {\n if (dx !== 0) {\n Animated.timing(this.state.pan, {\n toValue: { x: dx, y: 0 },\n duration: 100\n }).start(() => this.closeToast('swipe'));\n }\n }\n });\n }\n\n componentDidMount() {\n Keyboard.addListener('keyboardDidShow', this.keyboardDidShow);\n Keyboard.addListener('keyboardDidHide', this.keyboardDidHide);\n }\n\n getToastStyle() {\n return {\n position: POSITION.ABSOLUTE,\n opacity: this.state.fadeAnim,\n width: '100%',\n elevation: 9,\n paddingHorizontal: Platform.OS === PLATFORM.IOS ? 20 : 0,\n top: this.state.position === POSITION.TOP ? 30 : undefined,\n bottom:\n this.state.position === POSITION.BOTTOM ? this.getTop() : undefined\n };\n }\n\n getTop() {\n if (Platform.OS === PLATFORM.IOS) {\n if (this.state.isKeyboardVisible) {\n return this.state.keyboardHeight;\n }\n return 30;\n }\n return 0;\n }\n\n getButtonText(buttonText) {\n if (buttonText) {\n if (buttonText.trim().length === 0) {\n return undefined;\n }\n return buttonText;\n }\n return undefined;\n }\n getModalState() {\n return this.state.modalVisible;\n }\n\n static toastInstance;\n\n keyboardDidHide() {\n this.setState({\n keyboardHeight: 0,\n isKeyboardVisible: false\n });\n }\n\n keyboardDidShow(e) {\n this.setState({\n keyboardHeight: e.endCoordinates.height,\n isKeyboardVisible: true\n });\n }\n\n showToast({ config }) {\n this.setState({\n modalVisible: true,\n text: config.text,\n buttonText: this.getButtonText(config.buttonText),\n type: config.type,\n position: config.position ? config.position : POSITION.BOTTOM,\n supportedOrientations: config.supportedOrientations,\n style: config.style,\n buttonTextStyle: config.buttonTextStyle,\n buttonStyle: config.buttonStyle,\n textStyle: config.textStyle,\n onClose: config.onClose\n });\n // If we have a toast already open, cut off its close timeout so that it won't affect *this* toast.\n if (this.closeTimeout) {\n clearTimeout(this.closeTimeout);\n }\n // Set the toast to close after the duration.\n if (config.duration !== 0) {\n const duration = config.duration > 0 ? config.duration : 1500;\n this.closeTimeout = setTimeout(\n this.closeToast.bind(this, 'timeout'),\n duration\n );\n }\n // Fade the toast in now.\n Animated.timing(this.state.fadeAnim, {\n toValue: 1,\n duration: 200,\n useNativeDriver: false\n }).start();\n }\n closeModal(reason) {\n this.setState({\n modalVisible: false\n });\n const { onClose } = this.state;\n if (onClose && typeof onClose === 'function') {\n onClose(reason);\n }\n }\n closeToast(reason) {\n clearTimeout(this.closeTimeout);\n Animated.timing(this.state.fadeAnim, {\n toValue: 0,\n duration: 200,\n useNativeDriver: false\n }).start(() => {\n this.closeModal.bind(this, reason);\n this.state.pan.setValue({ x: 0, y: 0 });\n });\n }\n\n render() {\n if (this.state.modalVisible) {\n const { x, y } = this.state.pan;\n return (\n \n \n {this.state.text}\n {this.state.buttonText && (\n this.closeToast('user')}\n >\n \n {this.state.buttonText}\n \n \n )}\n \n \n );\n }\n return null;\n }\n}\n\nToastContainer.propTypes = {\n ...ViewPropTypes\n};\n\nconst StyledToastContainer = connectStyle(\n 'NativeBase.ToastContainer',\n {},\n mapPropsToStyleNames\n)(ToastContainer);\n\nexport { StyledToastContainer as ToastContainer };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/ToastContainer.js"],"names":["POSITION","ABSOLUTE","BOTTOM","TOP","ToastContainer","config","toastInstance","_root","showToast","getModalState","closeToast","props","state","fadeAnim","Animated","Value","pan","ValueXY","x","y","keyboardHeight","isKeyboardVisible","modalVisible","keyboardDidHide","bind","keyboardDidShow","_panResponder","PanResponder","create","onMoveShouldSetPanResponderCapture","onPanResponderRelease","evt","dx","timing","toValue","duration","start","Keyboard","addListener","position","opacity","width","elevation","paddingHorizontal","Platform","OS","PLATFORM","IOS","top","undefined","bottom","getTop","buttonText","trim","length","setState","e","endCoordinates","height","text","getButtonText","type","supportedOrientations","style","buttonTextStyle","buttonStyle","textStyle","onClose","closeTimeout","clearTimeout","setTimeout","useNativeDriver","reason","closeModal","setValue","panHandlers","getToastStyle","transform","translateX","translateY","Component","propTypes","ViewPropTypes","StyledToastContainer","mapPropsToStyleNames"],"mappings":"u2BACA,4B,2CACA,yCAOA,iEAEA,mE,yEACA,2DAEA,4BACA,gCACA,8B,skCAEA,GAAMA,UAAW,CACfC,SAAU,UADK,CAEfC,OAAQ,QAFO,CAGfC,IAAK,KAHU,CAAjB,C,GAMMC,e,kIACuB,IAAVC,OAAU,mCACzB,KAAKC,aAAL,CAAmBC,KAAnB,CAAyBC,SAAzB,CAAmC,CAAEH,aAAF,CAAnC,E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iCA,c,CAAxB+E,oB","file":"ToastContainer.js","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport React, { Component } from 'react';\nimport {\n Keyboard,\n Platform,\n Animated,\n ViewPropTypes,\n PanResponder\n} from 'react-native';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\nimport { PLATFORM } from '../theme/variables/commonColor';\n\nimport { Text } from './Text';\nimport { Button } from './Button';\nimport { Toast } from './Toast';\n\nconst POSITION = {\n ABSOLUTE: 'absolute',\n BOTTOM: 'bottom',\n TOP: 'top'\n};\n\nclass ToastContainer extends Component {\n static show({ ...config }) {\n this.toastInstance._root.showToast({ config });\n }\n static hide() {\n if (this.toastInstance._root.getModalState()) {\n this.toastInstance._root.closeToast('functionCall');\n }\n }\n constructor(props) {\n super(props);\n\n this.state = {\n fadeAnim: new Animated.Value(0),\n pan: new Animated.ValueXY({ x: 0, y: 0 }),\n keyboardHeight: 0,\n isKeyboardVisible: false,\n modalVisible: false\n };\n\n this.keyboardDidHide = this.keyboardDidHide.bind(this);\n this.keyboardDidShow = this.keyboardDidShow.bind(this);\n this._panResponder = PanResponder.create({\n onMoveShouldSetPanResponderCapture: () => true,\n onPanResponderRelease: (evt, { dx }) => {\n if (dx !== 0) {\n Animated.timing(this.state.pan, {\n toValue: { x: dx, y: 0 },\n duration: 100\n }).start(() => this.closeToast('swipe'));\n }\n }\n });\n }\n\n componentDidMount() {\n Keyboard.addListener('keyboardDidShow', this.keyboardDidShow);\n Keyboard.addListener('keyboardDidHide', this.keyboardDidHide);\n }\n\n getToastStyle() {\n return {\n position: POSITION.ABSOLUTE,\n opacity: this.state.fadeAnim,\n width: '100%',\n elevation: 9,\n paddingHorizontal: Platform.OS === PLATFORM.IOS ? 20 : 0,\n top: this.state.position === POSITION.TOP ? 30 : undefined,\n bottom:\n this.state.position === POSITION.BOTTOM ? this.getTop() : undefined\n };\n }\n\n getTop() {\n if (Platform.OS === PLATFORM.IOS) {\n if (this.state.isKeyboardVisible) {\n return this.state.keyboardHeight;\n }\n return 30;\n }\n return 0;\n }\n\n getButtonText(buttonText) {\n if (buttonText) {\n if (buttonText.trim().length === 0) {\n return undefined;\n }\n return buttonText;\n }\n return undefined;\n }\n getModalState() {\n return this.state.modalVisible;\n }\n\n static toastInstance;\n\n keyboardDidHide() {\n this.setState({\n keyboardHeight: 0,\n isKeyboardVisible: false\n });\n }\n\n keyboardDidShow(e) {\n this.setState({\n keyboardHeight: e.endCoordinates.height,\n isKeyboardVisible: true\n });\n }\n\n showToast({ config }) {\n this.setState({\n modalVisible: true,\n text: config.text,\n buttonText: this.getButtonText(config.buttonText),\n type: config.type,\n position: config.position ? config.position : POSITION.BOTTOM,\n supportedOrientations: config.supportedOrientations,\n style: config.style,\n buttonTextStyle: config.buttonTextStyle,\n buttonStyle: config.buttonStyle,\n textStyle: config.textStyle,\n onClose: config.onClose\n });\n // If we have a toast already open, cut off its close timeout so that it won't affect *this* toast.\n if (this.closeTimeout) {\n clearTimeout(this.closeTimeout);\n }\n // Set the toast to close after the duration.\n if (config.duration !== 0) {\n const duration = config.duration > 0 ? config.duration : 1500;\n this.closeTimeout = setTimeout(\n this.closeToast.bind(this, 'timeout'),\n duration\n );\n }\n // Fade the toast in now.\n Animated.timing(this.state.fadeAnim, {\n toValue: 1,\n duration: 200,\n useNativeDriver: false\n }).start();\n }\n closeModal(reason) {\n this.setState({\n modalVisible: false\n });\n const { onClose } = this.state;\n if (onClose && typeof onClose === 'function') {\n onClose(reason);\n }\n }\n closeToast(reason) {\n clearTimeout(this.closeTimeout);\n Animated.timing(this.state.fadeAnim, {\n toValue: 0,\n duration: 200,\n useNativeDriver: false\n }).start(() => {\n this.closeModal.bind(this, reason);\n this.state.pan.setValue({ x: 0, y: 0 });\n });\n }\n\n render() {\n if (this.state.modalVisible) {\n const { x, y } = this.state.pan;\n return (\n \n \n {this.state.text}\n {this.state.buttonText && (\n this.closeToast('user')}\n >\n \n {this.state.buttonText}\n \n \n )}\n \n \n );\n }\n return null;\n }\n}\n\nToastContainer.propTypes = {\n ...ViewPropTypes\n};\n\nconst StyledToastContainer = connectStyle(\n 'NativeBase.ToastContainer',\n {},\n mapPropsToStyleNames\n)(ToastContainer);\n\nexport { StyledToastContainer as ToastContainer };\n"]} \ No newline at end of file diff --git a/dist/src/theme/components/Badge.js b/dist/src/theme/components/Badge.js index 977c3641f..8e005e7b0 100644 --- a/dist/src/theme/components/Badge.js +++ b/dist/src/theme/components/Badge.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});var _platform=require('./../variables/platform');var _platform2=_interopRequireDefault(_platform);var _commonColor=require('./../variables/commonColor');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}exports.default=function(){var variables=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_platform2.default;var badgeTheme={'.primary':{backgroundColor:variables.buttonPrimaryBg},'.warning':{backgroundColor:variables.buttonWarningBg},'.info':{backgroundColor:variables.buttonInfoBg},'.success':{backgroundColor:variables.buttonSuccessBg},'.danger':{backgroundColor:variables.buttonDangerBg},'NativeBase.Text':{color:variables.badgeColor,fontSize:variables.fontSizeBase,lineHeight:variables.lineHeight-1,textAlign:'center',paddingHorizontal:3},backgroundColor:variables.badgeBg,padding:variables.badgePadding,paddingHorizontal:6,alignSelf:'flex-start',justifyContent:'center',borderRadius:13.5,height:27};return badgeTheme;}; +Object.defineProperty(exports,"__esModule",{value:true});var _platform=require('./../variables/platform');var _platform2=_interopRequireDefault(_platform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}exports.default=function(){var variables=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_platform2.default;var badgeTheme={'.primary':{backgroundColor:variables.buttonPrimaryBg},'.warning':{backgroundColor:variables.buttonWarningBg},'.info':{backgroundColor:variables.buttonInfoBg},'.success':{backgroundColor:variables.buttonSuccessBg},'.danger':{backgroundColor:variables.buttonDangerBg},'NativeBase.Text':{color:variables.badgeColor,fontSize:variables.fontSizeBase,lineHeight:variables.lineHeight-1,textAlign:'center',paddingHorizontal:3},backgroundColor:variables.badgeBg,padding:variables.badgePadding,paddingHorizontal:6,alignSelf:'flex-start',justifyContent:'center',borderRadius:13.5,height:27};return badgeTheme;}; //# sourceMappingURL=Badge.js.map \ No newline at end of file diff --git a/dist/src/theme/components/Badge.js.map b/dist/src/theme/components/Badge.js.map index 756a2bf82..3b6c7b966 100644 --- a/dist/src/theme/components/Badge.js.map +++ b/dist/src/theme/components/Badge.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../../src/theme/components/Badge.js"],"names":["variables","variable","badgeTheme","backgroundColor","buttonPrimaryBg","buttonWarningBg","buttonInfoBg","buttonSuccessBg","buttonDangerBg","color","badgeColor","fontSize","fontSizeBase","lineHeight","textAlign","paddingHorizontal","badgeBg","padding","badgePadding","alignSelf","justifyContent","borderRadius","height"],"mappings":"yDAEA,iD,iDACA,uD,mGAEe,UAAoC,IAAnCA,UAAmC,2DAAbC,kBAAa,CACjD,GAAMC,YAAa,CACjB,WAAY,CACVC,gBAAiBH,UAAUI,eADjB,CADK,CAIjB,WAAY,CACVD,gBAAiBH,UAAUK,eADjB,CAJK,CAOjB,QAAS,CACPF,gBAAiBH,UAAUM,YADpB,CAPQ,CAUjB,WAAY,CACVH,gBAAiBH,UAAUO,eADjB,CAVK,CAajB,UAAW,CACTJ,gBAAiBH,UAAUQ,cADlB,CAbM,CAgBjB,kBAAmB,CACjBC,MAAOT,UAAUU,UADA,CAEjBC,SAAUX,UAAUY,YAFH,CAGjBC,WAAYb,UAAUa,UAAV,CAAuB,CAHlB,CAIjBC,UAAW,QAJM,CAKjBC,kBAAmB,CALF,CAhBF,CAuBjBZ,gBAAiBH,UAAUgB,OAvBV,CAwBjBC,QAASjB,UAAUkB,YAxBF,CAyBjBH,kBAAmB,CAzBF,CA0BjBI,UAAW,YA1BM,CA2BjBC,eAAgB,QA3BC,CA4BjBC,aAAc,IA5BG,CA6BjBC,OAAQ,EA7BS,CAAnB,CA+BA,MAAOpB,WAAP,CACD,C","file":"Badge.js","sourcesContent":["// @flow\n\nimport variable from './../variables/platform';\nimport { PLATFORM } from './../variables/commonColor';\n\nexport default (variables /* : * */ = variable) => {\n const badgeTheme = {\n '.primary': {\n backgroundColor: variables.buttonPrimaryBg\n },\n '.warning': {\n backgroundColor: variables.buttonWarningBg\n },\n '.info': {\n backgroundColor: variables.buttonInfoBg\n },\n '.success': {\n backgroundColor: variables.buttonSuccessBg\n },\n '.danger': {\n backgroundColor: variables.buttonDangerBg\n },\n 'NativeBase.Text': {\n color: variables.badgeColor,\n fontSize: variables.fontSizeBase,\n lineHeight: variables.lineHeight - 1,\n textAlign: 'center',\n paddingHorizontal: 3\n },\n backgroundColor: variables.badgeBg,\n padding: variables.badgePadding,\n paddingHorizontal: 6,\n alignSelf: 'flex-start',\n justifyContent: 'center',\n borderRadius: 13.5,\n height: 27\n };\n return badgeTheme;\n};\n"]} \ No newline at end of file +{"version":3,"sources":["../../../../src/theme/components/Badge.js"],"names":["variables","variable","badgeTheme","backgroundColor","buttonPrimaryBg","buttonWarningBg","buttonInfoBg","buttonSuccessBg","buttonDangerBg","color","badgeColor","fontSize","fontSizeBase","lineHeight","textAlign","paddingHorizontal","badgeBg","padding","badgePadding","alignSelf","justifyContent","borderRadius","height"],"mappings":"yDAEA,iD,oJAEe,UAAoC,IAAnCA,UAAmC,2DAAbC,kBAAa,CACjD,GAAMC,YAAa,CACjB,WAAY,CACVC,gBAAiBH,UAAUI,eADjB,CADK,CAIjB,WAAY,CACVD,gBAAiBH,UAAUK,eADjB,CAJK,CAOjB,QAAS,CACPF,gBAAiBH,UAAUM,YADpB,CAPQ,CAUjB,WAAY,CACVH,gBAAiBH,UAAUO,eADjB,CAVK,CAajB,UAAW,CACTJ,gBAAiBH,UAAUQ,cADlB,CAbM,CAgBjB,kBAAmB,CACjBC,MAAOT,UAAUU,UADA,CAEjBC,SAAUX,UAAUY,YAFH,CAGjBC,WAAYb,UAAUa,UAAV,CAAuB,CAHlB,CAIjBC,UAAW,QAJM,CAKjBC,kBAAmB,CALF,CAhBF,CAuBjBZ,gBAAiBH,UAAUgB,OAvBV,CAwBjBC,QAASjB,UAAUkB,YAxBF,CAyBjBH,kBAAmB,CAzBF,CA0BjBI,UAAW,YA1BM,CA2BjBC,eAAgB,QA3BC,CA4BjBC,aAAc,IA5BG,CA6BjBC,OAAQ,EA7BS,CAAnB,CA+BA,MAAOpB,WAAP,CACD,C","file":"Badge.js","sourcesContent":["// @flow\n\nimport variable from './../variables/platform';\n\nexport default (variables /* : * */ = variable) => {\n const badgeTheme = {\n '.primary': {\n backgroundColor: variables.buttonPrimaryBg\n },\n '.warning': {\n backgroundColor: variables.buttonWarningBg\n },\n '.info': {\n backgroundColor: variables.buttonInfoBg\n },\n '.success': {\n backgroundColor: variables.buttonSuccessBg\n },\n '.danger': {\n backgroundColor: variables.buttonDangerBg\n },\n 'NativeBase.Text': {\n color: variables.badgeColor,\n fontSize: variables.fontSizeBase,\n lineHeight: variables.lineHeight - 1,\n textAlign: 'center',\n paddingHorizontal: 3\n },\n backgroundColor: variables.badgeBg,\n padding: variables.badgePadding,\n paddingHorizontal: 6,\n alignSelf: 'flex-start',\n justifyContent: 'center',\n borderRadius: 13.5,\n height: 27\n };\n return badgeTheme;\n};\n"]} \ No newline at end of file diff --git a/package.json b/package.json index ba86f7b6d..d2b293c76 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "license": "Apache-2.0", "private": false, "dependencies": { - "@react-native-community/picker": "^1.6.1", "blueimp-md5": "^2.5.0", "clamp": "^1.0.1", "color": "~3.1.2", @@ -51,6 +50,7 @@ "tween-functions": "^1.0.1" }, "devDependencies": { + "@react-native-community/picker": "^1.6.3", "babel-cli": "^6.18.0", "babel-eslint": "^7.2.3", "babel-jest": "^24.8.0", @@ -77,6 +77,7 @@ "typings": "./index.d.ts", "optionalDependencies": {}, "peerDependencies": { + "@react-native-community/picker": ">=1.6.3", "react": ">=16.4.1", "react-native": ">=0.56.0" }, diff --git a/yarn.lock b/yarn.lock index 0b39e3470..ad0e52092 100644 --- a/yarn.lock +++ b/yarn.lock @@ -927,10 +927,10 @@ shell-quote "1.6.1" ws "^1.1.0" -"@react-native-community/picker@^1.6.1": - version "1.6.1" - resolved "https://registry.yarnpkg.com/@react-native-community/picker/-/picker-1.6.1.tgz#f893bf4982e549c954696d08a47e1d8e72762310" - integrity sha512-JuCOtim1tZhB3KoJhbuPj3pFweUnj4XgukktJk0MyUOB8wA3uCEHW+xsGYu8ZDYiyR0M6qXctz7Fz2qYFuTUSQ== +"@react-native-community/picker@^1.6.3": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@react-native-community/picker/-/picker-1.6.3.tgz#4aed45449476b18f43008f3a790537c4a959ee34" + integrity sha512-8oPcwimsz14BDu0a8smuqw52uuaXgWrUKAVhv1mXMFvZq3Spt23UVH8Q0Zogi4t7WNlwx4dNXB08iUUP8ltKzg== "@types/babel__core@^7.1.0": version "7.1.2"