From f9c69322c3a4c9d39c7f60802934e5b2acb3f373 Mon Sep 17 00:00:00 2001 From: Shivraj Date: Tue, 21 Nov 2017 17:23:14 +0530 Subject: [PATCH] PropTypes issue - fix for #1348 --- dist/src/basic/Actionsheet.js | 54 +-- dist/src/basic/Actionsheet.js.map | 2 +- dist/src/basic/Badge.js | 15 +- dist/src/basic/Badge.js.map | 2 +- dist/src/basic/Body.js | 15 +- dist/src/basic/Body.js.map | 2 +- dist/src/basic/Card.js | 17 +- dist/src/basic/Card.js.map | 2 +- dist/src/basic/DeckSwiper.js | 82 ++-- dist/src/basic/DeckSwiper.js.map | 2 +- dist/src/basic/Footer.js | 19 +- dist/src/basic/Footer.js.map | 2 +- dist/src/basic/FooterTab.js | 17 +- dist/src/basic/FooterTab.js.map | 2 +- dist/src/basic/Form.js | 15 +- dist/src/basic/Form.js.map | 2 +- dist/src/basic/Header.js | 31 +- dist/src/basic/Header.js.map | 2 +- dist/src/basic/InputGroup.js | 15 +- dist/src/basic/InputGroup.js.map | 2 +- dist/src/basic/Left.js | 15 +- dist/src/basic/Left.js.map | 2 +- dist/src/basic/Picker.ios.js | 79 ++-- dist/src/basic/Picker.ios.js.map | 2 +- dist/src/basic/Right.js | 15 +- dist/src/basic/Right.js.map | 2 +- dist/src/basic/Root.js | 22 +- dist/src/basic/Root.js.map | 2 +- dist/src/basic/Segment.js | 17 +- dist/src/basic/Segment.js.map | 2 +- dist/src/basic/Separator.js | 17 +- dist/src/basic/Separator.js.map | 2 +- dist/src/basic/Tab.js | 11 +- dist/src/basic/Tab.js.map | 2 +- dist/src/basic/TabContainer.js | 17 +- dist/src/basic/TabContainer.js.map | 2 +- dist/src/basic/TabHeading.js | 17 +- dist/src/basic/TabHeading.js.map | 2 +- dist/src/basic/Toast.js | 15 +- dist/src/basic/Toast.js.map | 2 +- dist/src/basic/ToastContainer.js | 32 +- dist/src/basic/ToastContainer.js.map | 2 +- dist/src/basic/View.js | 17 +- dist/src/basic/View.js.map | 2 +- src/basic/Actionsheet.js | 264 ++++++------ src/basic/Badge.js | 29 +- src/basic/Body.js | 21 +- src/basic/Card.js | 61 +-- src/basic/DeckSwiper.js | 580 ++++++++++++++------------- src/basic/Footer.js | 23 +- src/basic/FooterTab.js | 31 +- src/basic/Form.js | 21 +- src/basic/Header.js | 71 ++-- src/basic/InputGroup.js | 67 ++-- src/basic/Left.js | 21 +- src/basic/Picker.ios.js | 377 +++++++++-------- src/basic/Right.js | 21 +- src/basic/Root.js | 50 ++- src/basic/Segment.js | 23 +- src/basic/Separator.js | 23 +- src/basic/Tab.js | 25 +- src/basic/TabContainer.js | 23 +- src/basic/TabHeading.js | 23 +- src/basic/Toast.js | 21 +- src/basic/ToastContainer.js | 221 +++++----- src/basic/View.js | 23 +- 66 files changed, 1484 insertions(+), 1133 deletions(-) diff --git a/dist/src/basic/Actionsheet.js b/dist/src/basic/Actionsheet.js index 439dd7826..abd9b324b 100644 --- a/dist/src/basic/Actionsheet.js +++ b/dist/src/basic/Actionsheet.js @@ -1,6 +1,13 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.ActionSheetContainer=undefined;var _extends=Object.assign||function(target){for(var i=1;i {\n\t\t\t\t\treturn item.text;\n\t\t\t\t});\n\t\t\t\tconfig.options = filtered;\n\t\t\t\tActionSheetIOS.showActionSheetWithOptions(config, callback);\n\t\t\t} else {\n\t\t\t\tActionSheetIOS.showActionSheetWithOptions(config, callback);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.setState({\n\t\t\t\titems: config.options,\n\t\t\t\ttitle: config.title,\n\t\t\t\tmessage: config.message,\n\t\t\t\tdestructiveButtonIndex: config.destructiveButtonIndex,\n\t\t\t\tcancelButtonIndex: config.cancelButtonIndex,\n\t\t\t\tmodalVisible: true,\n\t\t\t\tcallback: callback,\n\t\t\t});\n\t\t}\n\t}\n\tcomponentDidMount() {\n\t\tif (!this.props.autoHide && this.props.duration) {\n\t\t\tconsole.warn(`It's not recommended to set autoHide false with duration`);\n\t\t}\n\t}\n\trender() {\n\t\treturn (\n\t\t\t {\n\t\t\t\t\tthis.state.callback(-1);\n\t\t\t\t\tthis.setState({ modalVisible: false });\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t {\n\t\t\t\t\t\tthis.state.callback(-1);\n\t\t\t\t\t\tthis.setState({ modalVisible: false });\n\t\t\t\t\t}}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackgroundColor: \"rgba(0,0,0,0.4)\",\n\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\tjustifyContent: \"flex-end\",\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{this.state.title}\n\t\t\t\t\t\t\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\treturn typeof this.state.items[0] === \"string\"\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\tthis.state.callback(id);\n\t\t\t\t\t\t\t\t\t\t\t\tthis.setState({ modalVisible: false });\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ borderColor: \"transparent\" }}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t{data}\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\tthis.state.callback(id);\n\t\t\t\t\t\t\t\t\t\t\t\tthis.setState({ modalVisible: false });\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ borderColor: \"transparent\" }}\n\t\t\t\t\t\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t{data.text}\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}\n}\n\nActionSheetContainer.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledActionSheetContainer = connectStyle(\"NativeBase.ActionSheetContainer\", {}, mapPropsToStyleNames)(\n\tActionSheetContainer\n);\n\nexport { StyledActionSheetContainer as ActionSheetContainer };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Actionsheet.js"],"names":["ActionSheetContainer","props","state","modalVisible","items","config","callback","OS","options","filtered","map","item","text","showActionSheetWithOptions","setState","title","message","destructiveButtonIndex","cancelButtonIndex","autoHide","duration","console","warn","backgroundColor","flex","justifyContent","height","length","padding","elevation","color","marginHorizontal","marginTop","data","i","id","borderColor","icon","iconColor","undefined","actionsheetInstance","_root","showActionSheet","propTypes","style","oneOfType","object","number","array","StyledActionSheetContainer"],"mappings":"02BAAA,4B;AACA,qC;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mE;;AAEMA,oB;AACJ,8BAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,aAAc,KADH;AAEXC,MAAO,EAFI,CAAb,CAFiB;;AAMlB,C;;;;;AAKeC,M,CAAQC,Q,CAAU;AAChC,GAAI,sBAASC,EAAT,GAAgB,KAApB,CAA2B;AACzB,GAAI,MAAOF,QAAOG,OAAP,CAAe,CAAf,CAAP,EAA4B,QAAhC,CAA0C;AACxC,GAAIA,SAAUH,OAAOG,OAArB;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AUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,4BAA6B;AACjC,iCADiC;AAEjC,EAFiC;;AAIjCjD,oBAJiC,CAAnC,C;;AAMuCA,oB,CAA9BiD,0B","file":"Actionsheet.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n View,\n Modal,\n Platform,\n ActionSheetIOS,\n TouchableOpacity,\n ViewPropTypes\n} from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport { Text } from \"./Text\";\nimport { Button } from \"./Button\";\nimport { ViewNB } from \"./View\";\nimport { Icon } from \"./Icon\";\nimport { Left } from \"./Left\";\nimport { Right } from \"./Right\";\nimport { Body } from \"./Body\";\nimport { List } from \"./List\";\nimport { ListItem } from \"./ListItem\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass ActionSheetContainer extends Component {\n constructor(props) {\n super(props);\n this.state = {\n modalVisible: false,\n items: []\n };\n }\n static actionsheetInstance;\n static show(config, callback) {\n this.actionsheetInstance._root.showActionSheet(config, callback);\n }\n showActionSheet(config, callback) {\n if (Platform.OS === \"ios\") {\n if (typeof config.options[0] == \"object\") {\n let options = config.options;\n let filtered = options.map(item => {\n return item.text;\n });\n config.options = filtered;\n ActionSheetIOS.showActionSheetWithOptions(config, callback);\n } else {\n ActionSheetIOS.showActionSheetWithOptions(config, callback);\n }\n } else {\n this.setState({\n items: config.options,\n title: config.title,\n message: config.message,\n destructiveButtonIndex: config.destructiveButtonIndex,\n cancelButtonIndex: config.cancelButtonIndex,\n modalVisible: true,\n callback: callback\n });\n }\n }\n componentDidMount() {\n if (!this.props.autoHide && this.props.duration) {\n console.warn(`It's not recommended to set autoHide false with duration`);\n }\n }\n render() {\n return (\n {\n this.state.callback(-1);\n this.setState({ modalVisible: false });\n }}\n >\n {\n this.state.callback(-1);\n this.setState({ modalVisible: false });\n }}\n style={{\n backgroundColor: \"rgba(0,0,0,0.4)\",\n flex: 1,\n justifyContent: \"flex-end\"\n }}\n >\n \n {this.state.title}\n {\n return typeof this.state.items[0] === \"string\" ? (\n {\n this.state.callback(id);\n this.setState({ modalVisible: false });\n }}\n style={{ borderColor: \"transparent\" }}\n >\n {data}\n \n ) : (\n {\n this.state.callback(id);\n this.setState({ modalVisible: false });\n }}\n style={{ borderColor: \"transparent\" }}\n icon\n >\n \n \n \n \n {data.text}\n \n \n \n );\n }}\n />\n \n \n \n );\n }\n}\n\nActionSheetContainer.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledActionSheetContainer = connectStyle(\n \"NativeBase.ActionSheetContainer\",\n {},\n mapPropsToStyleNames\n)(ActionSheetContainer);\n\nexport { StyledActionSheetContainer as ActionSheetContainer };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Badge.js b/dist/src/basic/Badge.js index 5fc50667a..ff3632d77 100644 --- a/dist/src/basic/Badge.js +++ b/dist/src/basic/Badge.js @@ -1,7 +1,6 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Badge=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props}>\n\t\t\t\t{this.props.children}\n\t\t\t\n\t\t);\n\t}\n}\n\nBadge.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledBadge = connectStyle(\"NativeBase.Badge\", {}, mapPropsToStyleNames)(Badge);\n\nexport { StyledBadge as Badge };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Badge.js"],"names":["Badge","_root","c","props","children","propTypes","style","oneOfType","object","number","array","StyledBadge"],"mappings":"q1BAAA,4B;AACA,qC;AACA;;AAEA;AACA,qD;AACA,mE;;AAEMA,K;AACK;AACP;AACE,0DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C;AACG,KAAKA,KAAL,CAAWC,QADd,CADF;;;AAKD,C;;;AAGHJ,MAAMK,SAAN;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,aAAc,yCAAa,kBAAb,CAAiC,EAAjC;AAClBX,KADkB,CAApB,C;;;AAIwBA,K,CAAfW,W","file":"Badge.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Badge extends Component {\n render() {\n return (\n (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\nBadge.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledBadge = connectStyle(\"NativeBase.Badge\", {}, mapPropsToStyleNames)(\n Badge\n);\n\nexport { StyledBadge as Badge };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Body.js b/dist/src/basic/Body.js index df6df8c05..a78001259 100644 --- a/dist/src/basic/Body.js +++ b/dist/src/basic/Body.js @@ -1,23 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Body=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nBody.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledBody = connectStyle(\"NativeBase.Body\", {}, mapPropsToStyleNames)(Body);\n\nexport { StyledBody as Body };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Body.js"],"names":["Body","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledBody"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,I;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,mDAAP;AACD,C;;;AAGHH,KAAKI,SAAL;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,YAAa,yCAAa,iBAAb,CAAgC,EAAhC;AACjBV,IADiB,CAAnB,C;;;AAIuBA,I,CAAdU,U","file":"Body.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Body extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nBody.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledBody = connectStyle(\"NativeBase.Body\", {}, mapPropsToStyleNames)(\n Body\n);\n\nexport { StyledBody as Body };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Card.js b/dist/src/basic/Card.js index 35dc723dc..64dc58649 100644 --- a/dist/src/basic/Card.js +++ b/dist/src/basic/Card.js @@ -1,7 +1,6 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Card=undefined;var _extends=Object.assign||function(target){for(var i=1;i r1 !== r2,\n\t\t\t});\n\t\t\tconst dataSource = ds.cloneWithRows(this.props.dataArray);\n\t\t\treturn (\n\t\t\t\t\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t (this._root = c)} {...this.props}>\n\t\t\t\t{this.props.children}\n\t\t\t\n\t\t);\n\t}\n}\n\nCard.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n\tdataArray: PropTypes.array,\n\trenderRow: PropTypes.func,\n};\n\nconst StyledCard = connectStyle(\"NativeBase.Card\", {}, mapPropsToStyleNames)(Card);\n\nexport { StyledCard as Card };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Card.js"],"names":["Card","props","dataArray","renderRow","ds","DataSource","rowHasChanged","r1","r2","dataSource","cloneWithRows","_root","c","children","propTypes","style","oneOfType","object","number","array","func","StyledCard"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,I;AACK;AACP,GAAI,KAAKC,KAAL,CAAWC,SAAX,EAAwB,KAAKD,KAAL,CAAWE,SAAvC,CAAkD;AAChD,GAAMC,IAAK,GAAI,uBAASC,UAAb,CAAwB;AACjCC,cAAe,uBAACC,EAAD,CAAKC,EAAL,QAAYD,MAAOC,EAAnB,EADkB,CAAxB,CAAX;;AAGA,GAAMC,YAAaL,GAAGM,aAAH,CAAiB,KAAKT,KAAL,CAAWC,SAA5B,CAAnB;AACA;AACE;AACM,KAAKD,KADX;AAEE,wBAFF;AAGE,WAAYQ,UAHd;AAIE,UAAW,KAAKR,KAAL,CAAWE,SAJxB,kDADF;;;AAQD;AACD;AACE,0DAAM,IAAK,sBAAM,QAAKQ,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKX,KAA3C;AACG,KAAKA,KAAL,CAAWY,QADd,CADF;;;AAKD,C;;;AAGHb,KAAKc,SAAL;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;AAOEjB,UAAW,oBAAUiB,KAPvB;AAQEhB,UAAW,oBAAUiB,IARvB;;;AAWA,GAAMC,YAAa,yCAAa,iBAAb,CAAgC,EAAhC;AACjBrB,IADiB,CAAnB,C;;;AAIuBA,I,CAAdqB,U","file":"Card.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ListView, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Card extends Component {\n render() {\n if (this.props.dataArray && this.props.renderRow) {\n const ds = new ListView.DataSource({\n rowHasChanged: (r1, r2) => r1 !== r2\n });\n const dataSource = ds.cloneWithRows(this.props.dataArray);\n return (\n \n );\n }\n return (\n (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\nCard.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n dataArray: PropTypes.array,\n renderRow: PropTypes.func\n};\n\nconst StyledCard = connectStyle(\"NativeBase.Card\", {}, mapPropsToStyleNames)(\n Card\n);\n\nexport { StyledCard as Card };\n"]} \ No newline at end of file diff --git a/dist/src/basic/DeckSwiper.js b/dist/src/basic/DeckSwiper.js index 7f7b572d8..ff295184e 100644 --- a/dist/src/basic/DeckSwiper.js +++ b/dist/src/basic/DeckSwiper.js @@ -3,8 +3,7 @@ var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_pro var _reactNative=require("react-native"); var _clamp=require("clamp");var _clamp2=_interopRequireDefault(_clamp); var _nativeBaseShoutemTheme=require("native-base-shoutem-theme"); -var _mapPropsToStyleNames=require("../Utils/mapPropsToStyleNames");var _mapPropsToStyleNames2=_interopRequireDefault(_mapPropsToStyleNames); -var _Utils=require("../Utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}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 _mapPropsToStyleNames=require("../Utils/mapPropsToStyleNames");var _mapPropsToStyleNames2=_interopRequireDefault(_mapPropsToStyleNames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}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 SWIPE_THRESHOLD=120;var @@ -20,7 +19,8 @@ selectedItem2:_this.props.dataSource[1], card1Top:true, card2Top:false, fadeAnim:new _reactNative.Animated.Value(0.8), -looping:typeof _this.props.looping==="undefined"?true:_this.props.looping, +looping: +typeof _this.props.looping==="undefined"?true:_this.props.looping, disabled:_this.props.dataSource.length===0, lastCard:_this.props.dataSource.length===1};return _this; @@ -41,7 +41,8 @@ return; var visibleIndex=dataSource.indexOf(this.state.selectedItem); var currentIndex=visibleIndex<0?visibleIndex+1:visibleIndex; -var nextIndex=currentIndex+1===dataSource.length?0:currentIndex+1; +var nextIndex= +currentIndex+1===dataSource.length?0:currentIndex+1; this.setState({ selectedItem:dataSource[currentIndex], @@ -65,7 +66,10 @@ currentIndex){ var newIdx=currentIndex+1; var newIdx2=currentIndex+2; -if(newIdx2>this.props.dataSource.length-1&&newIdx===this.props.dataSource.length-1){ +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]; @@ -141,7 +145,8 @@ start(_this4._resetState.bind(_this4)); {var _this5=this; this._panResponder=_reactNative.PanResponder.create({ onMoveShouldSetResponderCapture:function onMoveShouldSetResponderCapture(){return true;}, -onMoveShouldSetPanResponderCapture:function onMoveShouldSetPanResponderCapture(evt,gestureState){return Math.abs(gestureState.dx)>5;}, +onMoveShouldSetPanResponderCapture:function onMoveShouldSetPanResponderCapture(evt,gestureState){return( +Math.abs(gestureState.dx)>5);}, onPanResponderGrant:function onPanResponderGrant(e,gestureState){ _this5.state.pan.setOffset({ @@ -153,9 +158,11 @@ _this5.state.pan.setValue({x:0,y:0}); onPanResponderMove:function onPanResponderMove(e,gestureState){ if(gestureState.dx>20){ -if(_this5.props.onSwiping)_this5.props.onSwiping("right",gestureState.dx); +if(_this5.props.onSwiping) +_this5.props.onSwiping("right",gestureState.dx); }else if(gestureState.dx<-20){ -if(_this5.props.onSwiping)_this5.props.onSwiping("left",gestureState.dx); +if(_this5.props.onSwiping) +_this5.props.onSwiping("left",gestureState.dx); } var val=Math.abs(gestureState.dx*0.0013); var opa=Math.abs(gestureState.dx*0.0022); @@ -182,10 +189,14 @@ velocity=(0,_clamp2.default)(vx*-1,4.5,10)*-1; if(Math.abs(_this5.state.pan.x._value)>SWIPE_THRESHOLD){ if(velocity>0){ -_this5.props.onSwipeRight?_this5.props.onSwipeRight(_this5.state.selectedItem):undefined; +_this5.props.onSwipeRight? +_this5.props.onSwipeRight(_this5.state.selectedItem): +undefined; _this5.selectNext(); }else{ -_this5.props.onSwipeLeft?_this5.props.onSwipeLeft(_this5.state.selectedItem):undefined; +_this5.props.onSwipeLeft? +_this5.props.onSwipeLeft(_this5.state.selectedItem): +undefined; _this5.selectNext(); } @@ -244,53 +255,55 @@ return[animatedCardStyles,animatedCardStyles2]; if(this.state.disabled){ return( -_react2.default.createElement(_reactNative.View,{style:{position:"relative",flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:247}}, - -_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:249}}, -this.props.renderEmpty&&this.props.renderEmpty()))); - - +_react2.default.createElement(_reactNative.View,{style:{position:"relative",flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:258}}, +_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:259}},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:258}}, +_react2.default.createElement(_reactNative.View,{style:{position:"relative",flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:265}}, this.state.selectedItem===undefined? -_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:260}}): -_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:261}}, +_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:267}}): + +_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:269}}, _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:262}}), +this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:270}}), 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:272}}), +style:[ +this.getCardStyles()[0], +this.getInitialStyle().topCard]}, + +this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:280}}), this.props.renderItem(this.state.selectedItem))))); + } return( -_react2.default.createElement(_reactNative.View,{style:{position:"relative",flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:283}}, +_react2.default.createElement(_reactNative.View,{style:{position:"relative",flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:295}}, this.state.selectedItem===undefined? -_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:285}}): -_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:286}}, +_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:297}}): + +_react2.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:299}}, _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:287}}), +this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:300}}), this.props.renderBottom? this.props.renderBottom(this.state.selectedItem2): @@ -298,7 +311,7 @@ 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:299}}), +this._panResponder.panHandlers,{__source:{fileName:_jsxFileName,lineNumber:312}}), this.props.renderTop? this.props.renderTop(this.state.selectedItem): @@ -307,16 +320,25 @@ this.props.renderItem(this.state.selectedItem))))); + }}]);return DeckSwiper;}(_react.Component); -DeckSwiper.propTypes=_extends({},_Utils.ViewPropTypes,{ +DeckSwiper.propTypes=_extends({},_reactNative.ViewPropTypes,{ + +style:_propTypes2.default.oneOfType([ +_propTypes2.default.object, +_propTypes2.default.number, +_propTypes2.default.array]), -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. +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 89db6b7ea..20dfab7c1 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","state","pan","ValueXY","pan2","enter","Value","selectedItem","dataSource","selectedItem2","card1Top","card2Top","fadeAnim","looping","disabled","length","lastCard","setState","undefined","visibleIndex","indexOf","currentIndex","nextIndex","topCard","position","top","right","left","newIdx","newIdx2","setTimeout","nextIndexes","findNextIndexes","onSwiping","timing","toValue","start","spring","friction","selectNext","decay","velocity","x","y","deceleration","_resetState","bind","_panResponder","create","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","evt","gestureState","Math","abs","dx","onPanResponderGrant","e","setOffset","_value","setValue","onPanResponderMove","val","opa","event","onPanResponderRelease","vx","vy","onSwipeRight","onSwipeLeft","translateX","translateY","rotate","interpolate","inputRange","outputRange","opacity","scale","animatedCardStyles","transform","animatedCardStyles2","flexDirection","renderEmpty","getCardStyles","getInitialStyle","panHandlers","renderItem","renderBottom","renderTop","propTypes","style","oneOfType","object","number","array","StyledDeckSwiper"],"mappings":"+1BAAA,4B;AACA,qC;AACA;AACA,4B;AACA;AACA,mE;AACA,+B;;AAEA,GAAMA,iBAAkB,GAAxB,C;;AAEMC,U;AACL,oBAAYC,KAAZ,CAAmB;AACZA,KADY;AAElB,MAAKC,KAAL,CAAa;AACZC,IAAK,GAAI,uBAASC,OAAb,EADO;AAEZC,KAAM,GAAI,uBAASD,OAAb,EAFM;AAGZE,MAAO,GAAI,uBAASC,KAAb,CAAmB,GAAnB,CAHK;AAIZC,aAA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F,KAAL,CAAWwF,SAAX;AACE,KAAKxF,KAAL,CAAWwF,SAAX,CAAqB,KAAKvF,KAAL,CAAWM,YAAhC,CADF;AAEE,KAAKP,KAAL,CAAWsF,UAAX,CAAsB,KAAKrF,KAAL,CAAWM,YAAjC,CANJ,CAbA,CAHJ,CADD;;;;;AA4BA,C;;;AAGFR,WAAW0F,SAAX;;AAECC,MAAO,oBAAUC,SAAV,CAAoB,CAAC,oBAAUC,MAAX,CAAmB,oBAAUC,MAA7B,CAAqC,oBAAUC,KAA/C,CAApB,CAFR;AAGCtF,WAAY,oBAAUsF,KAHvB;;;AAMA,GAAMC,kBAAmB,yCAAa,uBAAb,CAAsC,EAAtC,iCAAgEhG,UAAhE,CAAzB,C;;AAE6BA,U,CAApBgG,gB","file":"DeckSwiper.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, Animated, PanResponder } from \"react-native\";\nimport clamp from \"clamp\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\nimport { ViewPropTypes } from '../Utils';\n\nconst SWIPE_THRESHOLD = 120;\n\nclass DeckSwiper extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tpan: new Animated.ValueXY(),\n\t\t\tpan2: new Animated.ValueXY(),\n\t\t\tenter: new Animated.Value(0.8),\n\t\t\tselectedItem: this.props.dataSource[0],\n\t\t\tselectedItem2: this.props.dataSource[1],\n\t\t\tcard1Top: true,\n\t\t\tcard2Top: false,\n\t\t\tfadeAnim: new Animated.Value(0.8),\n\t\t\tlooping: typeof this.props.looping === \"undefined\" ? true : this.props.looping,\n\t\t\tdisabled: this.props.dataSource.length === 0,\n\t\t\tlastCard: this.props.dataSource.length === 1,\n\t\t};\n\t}\n\n\tcomponentWillReceiveProps({ dataSource }) {\n\t\tif (dataSource.length !== this.props.dataSource.length) {\n\t\t\tif (dataSource.length <= 1) {\n\t\t\t\tthis.setState({\n\t\t\t\t\t...this.state,\n\t\t\t\t\tselectedItem: dataSource[0],\n\t\t\t\t\tselectedItem2: undefined,\n\t\t\t\t\tdisabled: dataSource.length === 0,\n\t\t\t\t\tlastCard: dataSource.length === 1,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst visibleIndex = dataSource.indexOf(this.state.selectedItem);\n\t\t\tconst currentIndex = visibleIndex < 0 ? visibleIndex + 1 : visibleIndex;\n\t\t\tconst nextIndex = currentIndex + 1 === dataSource.length ? 0 : currentIndex + 1;\n\n\t\t\tthis.setState({\n\t\t\t\tselectedItem: dataSource[currentIndex],\n\t\t\t\tselectedItem2: dataSource[nextIndex],\n\t\t\t});\n\t\t}\n\t}\n\n\tgetInitialStyle() {\n\t\treturn {\n\t\t\ttopCard: {\n\t\t\t\tposition: \"absolute\",\n\t\t\t\ttop: 0,\n\t\t\t\tright: 0,\n\t\t\t\tleft: 0,\n\t\t\t},\n\t\t};\n\t}\n\n\tfindNextIndexes(currentIndex) {\n\t\tconst newIdx = currentIndex + 1;\n\t\tconst newIdx2 = currentIndex + 2;\n\n\t\tif (newIdx2 > this.props.dataSource.length - 1 && newIdx === this.props.dataSource.length - 1) {\n\t\t\treturn [newIdx, 0];\n\t\t} else if (newIdx > this.props.dataSource.length - 1) {\n\t\t\treturn [0, 1];\n\t\t}\n\t\treturn [newIdx, newIdx2];\n\t}\n\n\tselectNext() {\n\t\tconst dataSource = this.props.dataSource;\n\t\tconst currentIndex = dataSource.indexOf(this.state.selectedItem);\n\n\t\t// if not looping, check for these conditionals and if true return from selectNext()\n\t\tif (!this.state.looping) {\n\t\t\t// reached end -> only display static renderEmpty() -> no swiping\n\t\t\tif (currentIndex === dataSource.length - 1) {\n\t\t\t\treturn this.setState({\n\t\t\t\t\tdisabled: true,\n\t\t\t\t});\n\t\t\t} else if (currentIndex === dataSource.length - 2) {\n\t\t\t\t// show last card with renderEmpty() component behind it\n\t\t\t\treturn setTimeout(() => {\n\t\t\t\t\tthis.setState({\n\t\t\t\t\t\tselectedItem: dataSource[currentIndex + 1],\n\t\t\t\t\t});\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tlastCard: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 350);\n\t\t\t\t}, 50);\n\t\t\t}\n\t\t}\n\n\t\tconst nextIndexes = this.findNextIndexes(currentIndex);\n\t\tsetTimeout(() => {\n\t\t\tthis.setState({\n\t\t\t\tselectedItem: this.props.dataSource[nextIndexes[0]],\n\t\t\t});\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.setState({\n\t\t\t\t\tselectedItem2: this.props.dataSource[nextIndexes[1]],\n\t\t\t\t});\n\t\t\t}, 350);\n\t\t}, 50);\n\t}\n\n\tswipeRight() {\n\t\tif (this.props.onSwiping) this.props.onSwiping(\"right\");\n\t\tsetTimeout(() => {\n\t\t\tAnimated.timing(this.state.fadeAnim, { toValue: 1 }).start();\n\t\t\tAnimated.spring(this.state.enter, { toValue: 1, friction: 7 }).start();\n\t\t\tthis.selectNext();\n\t\t\tAnimated.decay(this.state.pan, {\n\t\t\t\tvelocity: { x: 8, y: 1 },\n\t\t\t\tdeceleration: 0.98,\n\t\t\t}).start(this._resetState.bind(this));\n\t\t}, 300);\n\t}\n\n\tswipeLeft() {\n\t\tif (this.props.onSwiping) this.props.onSwiping(\"left\");\n\t\tsetTimeout(() => {\n\t\t\tAnimated.timing(this.state.fadeAnim, { toValue: 1 }).start();\n\t\t\tAnimated.spring(this.state.enter, { toValue: 1, friction: 7 }).start();\n\t\t\tthis.selectNext();\n\t\t\tAnimated.decay(this.state.pan, {\n\t\t\t\tvelocity: { x: -8, y: 1 },\n\t\t\t\tdeceleration: 0.98,\n\t\t\t}).start(this._resetState.bind(this));\n\t\t}, 300);\n\t}\n\n\tcomponentWillMount() {\n\t\tthis._panResponder = PanResponder.create({\n\t\t\tonMoveShouldSetResponderCapture: () => true,\n\t\t\tonMoveShouldSetPanResponderCapture: (evt, gestureState) => Math.abs(gestureState.dx) > 5,\n\n\t\t\tonPanResponderGrant: (e, gestureState) => {\n\t\t\t\tthis.state.pan.setOffset({\n\t\t\t\t\tx: this.state.pan.x._value,\n\t\t\t\t\ty: this.state.pan.y._value,\n\t\t\t\t});\n\t\t\t\tthis.state.pan.setValue({ x: 0, y: 0 });\n\t\t\t},\n\n\t\t\tonPanResponderMove: (e, gestureState) => {\n\t\t\t\tif (gestureState.dx > 20) {\n\t\t\t\t\tif (this.props.onSwiping) this.props.onSwiping(\"right\", gestureState.dx);\n\t\t\t\t} else if (gestureState.dx < -20) {\n\t\t\t\t\tif (this.props.onSwiping) this.props.onSwiping(\"left\", gestureState.dx);\n\t\t\t\t}\n\t\t\t\tlet val = Math.abs(gestureState.dx * 0.0013);\n\t\t\t\tconst opa = Math.abs(gestureState.dx * 0.0022);\n\t\t\t\tif (val > 0.2) {\n\t\t\t\t\tval = 0.2;\n\t\t\t\t}\n\t\t\t\tAnimated.timing(this.state.fadeAnim, { toValue: 0.8 + val }).start();\n\t\t\t\tAnimated.spring(this.state.enter, {\n\t\t\t\t\ttoValue: 0.8 + val,\n\t\t\t\t\tfriction: 7,\n\t\t\t\t}).start();\n\t\t\t\tAnimated.event([null, { dx: this.state.pan.x }])(e, gestureState);\n\t\t\t},\n\n\t\t\tonPanResponderRelease: (e, { vx, vy }) => {\n\t\t\t\tif (this.props.onSwiping) this.props.onSwiping(null);\n\t\t\t\tlet velocity;\n\n\t\t\t\tif (vx >= 0) {\n\t\t\t\t\tvelocity = clamp(vx, 4.5, 10);\n\t\t\t\t} else if (vx < 0) {\n\t\t\t\t\tvelocity = clamp(vx * -1, 4.5, 10) * -1;\n\t\t\t\t}\n\n\t\t\t\tif (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) {\n\t\t\t\t\tif (velocity > 0) {\n\t\t\t\t\t\tthis.props.onSwipeRight ? this.props.onSwipeRight(this.state.selectedItem) : undefined;\n\t\t\t\t\t\tthis.selectNext();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.props.onSwipeLeft ? this.props.onSwipeLeft(this.state.selectedItem) : undefined;\n\t\t\t\t\t\tthis.selectNext();\n\t\t\t\t\t}\n\n\t\t\t\t\tAnimated.decay(this.state.pan, {\n\t\t\t\t\t\tvelocity: { x: velocity, y: vy },\n\t\t\t\t\t\tdeceleration: 0.98,\n\t\t\t\t\t}).start(this._resetState.bind(this));\n\t\t\t\t} else {\n\t\t\t\t\tAnimated.spring(this.state.pan, {\n\t\t\t\t\t\ttoValue: { x: 0, y: 0 },\n\t\t\t\t\t\tfriction: 4,\n\t\t\t\t\t}).start();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t_resetState() {\n\t\tthis.state.pan.setValue({ x: 0, y: 0 });\n\t\tthis.state.enter.setValue(0.8);\n\t\tthis.state.fadeAnim.setValue(0.8);\n\t\tthis.setState({\n\t\t\tcard1Top: !this.state.card1Top,\n\t\t\tcard2Top: !this.state.card2Top,\n\t\t});\n\t\tif (this.props.onSwiping) this.props.onSwiping(null);\n\t}\n\n\tgetCardStyles() {\n\t\tconst { pan, pan2, enter } = this.state;\n\n\t\tconst [translateX, translateY] = [pan.x, pan.y];\n\t\t// let [translateX, translateY] = [pan2.x, pan2.y];\n\n\t\tconst rotate = pan.x.interpolate({\n\t\t\tinputRange: [-700, 0, 700],\n\t\t\toutputRange: [\"-10deg\", \"0deg\", \"10deg\"],\n\t\t});\n\n\t\tconst opacity = pan.x.interpolate({\n\t\t\tinputRange: [-320, 0, 320],\n\t\t\toutputRange: [0.9, 1, 0.9],\n\t\t});\n\t\tconst scale = enter;\n\n\t\tconst animatedCardStyles = {\n\t\t\ttransform: [{ translateX }, { translateY }, { rotate }],\n\t\t\topacity,\n\t\t};\n\t\tconst animatedCardStyles2 = { transform: [{ scale }] };\n\n\t\treturn [animatedCardStyles, animatedCardStyles2];\n\t}\n\n\trender() {\n\t\tif (this.state.disabled) {\n\t\t\t// disable swiping and renderEmpty\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{this.props.renderEmpty && this.props.renderEmpty()}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t);\n\t\t} else if (this.state.lastCard) {\n\t\t\t// display renderEmpty underneath last viable card\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{this.state.selectedItem === undefined\n\t\t\t\t\t\t? \n\t\t\t\t\t\t: \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{this.props.renderEmpty && this.props.renderEmpty()}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{this.props.renderItem(this.state.selectedItem)}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t\n\t\t\t\t{this.state.selectedItem === undefined\n\t\t\t\t\t? \n\t\t\t\t\t: \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{this.props.renderBottom\n\t\t\t\t\t\t\t\t\t? this.props.renderBottom(this.state.selectedItem2)\n\t\t\t\t\t\t\t\t\t: this.props.renderItem(this.state.selectedItem2)}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{this.props.renderTop\n\t\t\t\t\t\t\t\t\t? this.props.renderTop(this.state.selectedItem)\n\t\t\t\t\t\t\t\t\t: this.props.renderItem(this.state.selectedItem)}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\n\t\t);\n\t}\n}\n\nDeckSwiper.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n\tdataSource: PropTypes.array,\n};\n\nconst StyledDeckSwiper = connectStyle(\"NativeBase.DeckSwiper\", {}, mapPropsToStyleNames)(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","state","pan","ValueXY","pan2","enter","Value","selectedItem","dataSource","selectedItem2","card1Top","card2Top","fadeAnim","looping","disabled","length","lastCard","setState","undefined","visibleIndex","indexOf","currentIndex","nextIndex","topCard","position","top","right","left","newIdx","newIdx2","setTimeout","nextIndexes","findNextIndexes","onSwiping","timing","toValue","start","spring","friction","selectNext","decay","velocity","x","y","deceleration","_resetState","bind","_panResponder","create","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","evt","gestureState","Math","abs","dx","onPanResponderGrant","e","setOffset","_value","setValue","onPanResponderMove","val","opa","event","onPanResponderRelease","vx","vy","onSwipeRight","onSwipeLeft","translateX","translateY","rotate","interpolate","inputRange","outputRange","opacity","scale","animatedCardStyles","transform","animatedCardStyles2","flexDirection","renderEmpty","getCardStyles","getInitialStyle","panHandlers","renderItem","renderBottom","renderTop","propTypes","style","oneOfType","object","number","array","StyledDeckSwiper"],"mappings":"+1BAAA,4B;AACA,qC;AACA;AACA,4B;AACA;AACA,mE;;AAEA,GAAMA,iBAAkB,GAAxB,C;;AAEMC,U;AACJ,oBAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,IAAK,GAAI,uBAASC,OAAb,EADM;AAEXC,KAAM,GAAI,uBAASD,OAAb,EAFK;AAGXE,MAAO,GAAI,uBAASC,KAAb,CAAmB,GAAnB,CAHI;AAIXC,aAAc,MAAKP,KAAL,CAAWQ,UAAX,CAAsB,CAAtB,CAJH;AAKXC,cAAe,MAAKT,KAAL,CAAWQ,UAAX,CAAsB,CAAtB,CALJ;AAMXE,SAAU,IANC;AAOXC,SAAU,KAPC;AAQXC,SAAU,GAAI,uBAASN,KAAb,CAAmB,GAAnB,CARC;AASXO;AACE,MAAO,OAAKb,KAAL,CAAWa,OAAlB,GAA8B,WAA9B,CA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;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;AAOEtF,WAAY,oBAAUsF,KAPxB;;;AAUA,GAAMC,kBAAmB;AACvB,uBADuB;AAEvB,EAFuB;;AAIvBhG,UAJuB,CAAzB,C;;AAM6BA,U,CAApBgG,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\";\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 }\n\n componentWillReceiveProps({ 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 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 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\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 componentWillMount() {\n this._panResponder = PanResponder.create({\n onMoveShouldSetResponderCapture: () => true,\n onMoveShouldSetPanResponderCapture: (evt, gestureState) =>\n Math.abs(gestureState.dx) > 5,\n\n onPanResponderGrant: (e, gestureState) => {\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 const opa = Math.abs(gestureState.dx * 0.0022);\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 getCardStyles() {\n const { pan, pan2, 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 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 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/Footer.js b/dist/src/basic/Footer.js index 031bffae6..4d8271549 100644 --- a/dist/src/basic/Footer.js +++ b/dist/src/basic/Footer.js @@ -3,20 +3,27 @@ var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_pro var _reactNative=require("react-native"); var _lodash=require("lodash");var _lodash2=_interopRequireDefault(_lodash); var _nativeBaseShoutemTheme=require("native-base-shoutem-theme"); -var _mapPropsToStyleNames=require("../Utils/mapPropsToStyleNames");var _mapPropsToStyleNames2=_interopRequireDefault(_mapPropsToStyleNames); -var _Utils=require("../Utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}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 +var _mapPropsToStyleNames=require("../Utils/mapPropsToStyleNames");var _mapPropsToStyleNames2=_interopRequireDefault(_mapPropsToStyleNames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}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 Footer=function(_Component){_inherits(Footer,_Component);function Footer(){_classCallCheck(this,Footer);return _possibleConstructorReturn(this,(Footer.__proto__||Object.getPrototypeOf(Footer)).apply(this,arguments));}_createClass(Footer,[{key:"render",value:function render() {var _this2=this; -return _react2.default.createElement(_reactNative.View,_extends({ref:function ref(c){return _this2._root=c;}},this.props,{__source:{fileName:_jsxFileName,lineNumber:11}})); +return _react2.default.createElement(_reactNative.View,_extends({ref:function ref(c){return _this2._root=c;}},this.props,{__source:{fileName:_jsxFileName,lineNumber:10}})); }}]);return Footer;}(_react.Component); -Footer.propTypes=_extends({},_Utils.ViewPropTypes,{ +Footer.propTypes=_extends({},_reactNative.ViewPropTypes,{ -style:_propTypes2.default.oneOfType([_propTypes2.default.object,_propTypes2.default.number,_propTypes2.default.array])}); +style:_propTypes2.default.oneOfType([ +_propTypes2.default.object, +_propTypes2.default.number, +_propTypes2.default.array])}); -var StyledFooter=(0,_nativeBaseShoutemTheme.connectStyle)("NativeBase.Footer",{},_mapPropsToStyleNames2.default)(Footer);exports. + +var StyledFooter=(0,_nativeBaseShoutemTheme.connectStyle)( +"NativeBase.Footer", +{},_mapPropsToStyleNames2.default)( + +Footer);exports. Footer=StyledFooter; //# sourceMappingURL=Footer.js.map \ No newline at end of file diff --git a/dist/src/basic/Footer.js.map b/dist/src/basic/Footer.js.map index 0fabf237f..1490d7b70 100644 --- a/dist/src/basic/Footer.js.map +++ b/dist/src/basic/Footer.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/basic/Footer.js"],"names":["Footer","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledFooter"],"mappings":"u1BAAA,4B;AACA,qC;AACA;AACA,8B;AACA;AACA,mE;AACA,+B;;AAEMA,M;AACI;AACR,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,mDAAP;AACA,C;;;AAGFH,OAAOI,SAAP;;AAECC,MAAO,oBAAUC,SAAV,CAAoB,CAAC,oBAAUC,MAAX,CAAmB,oBAAUC,MAA7B,CAAqC,oBAAUC,KAA/C,CAApB,CAFR;;;AAKA,GAAMC,cAAe,yCAAa,mBAAb,CAAkC,EAAlC,iCAA4DV,MAA5D,CAArB,C;AACyBA,M,CAAhBU,Y","file":"Footer.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View } from \"react-native\";\nimport _ from \"lodash\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\nimport { ViewPropTypes } from '../Utils';\n\nclass Footer extends Component {\n\trender() {\n\t\treturn (this._root = c)} {...this.props} />;\n\t}\n}\n\nFooter.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledFooter = connectStyle(\"NativeBase.Footer\", {}, mapPropsToStyleNames)(Footer);\nexport { StyledFooter as Footer };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Footer.js"],"names":["Footer","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledFooter"],"mappings":"u1BAAA,4B;AACA,qC;AACA;AACA,8B;AACA;AACA,mE;;AAEMA,M;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,mDAAP;AACD,C;;;AAGHH,OAAOI,SAAP;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,cAAe;AACnB,mBADmB;AAEnB,EAFmB;;AAInBV,MAJmB,CAArB,C;AAKyBA,M,CAAhBU,Y","file":"Footer.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\nimport _ from \"lodash\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Footer extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nFooter.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledFooter = connectStyle(\n \"NativeBase.Footer\",\n {},\n mapPropsToStyleNames\n)(Footer);\nexport { StyledFooter as Footer };\n"]} \ No newline at end of file diff --git a/dist/src/basic/FooterTab.js b/dist/src/basic/FooterTab.js index 6c2f654ab..bd398c276 100644 --- a/dist/src/basic/FooterTab.js +++ b/dist/src/basic/FooterTab.js @@ -1,7 +1,6 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.FooterTab=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props}>\n\t\t\t\t{this.props.children}\n\t\t\t\n\t\t);\n\t}\n}\n\nFooterTab.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledFooterTab = connectStyle(\"NativeBase.FooterTab\", {}, mapPropsToStyleNames)(FooterTab);\n\nexport { StyledFooterTab as FooterTab };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/FooterTab.js"],"names":["FooterTab","_root","c","props","children","propTypes","style","oneOfType","object","number","array","StyledFooterTab"],"mappings":"61BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,S;AACK;AACP;AACE,0DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C;AACG,KAAKA,KAAL,CAAWC,QADd,CADF;;;AAKD,C;;;AAGHJ,UAAUK,SAAV;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,iBAAkB;AACtB,sBADsB;AAEtB,EAFsB;;AAItBX,SAJsB,CAAxB,C;;AAM4BA,S,CAAnBW,e","file":"FooterTab.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass FooterTab extends Component {\n render() {\n return (\n (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\nFooterTab.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledFooterTab = connectStyle(\n \"NativeBase.FooterTab\",\n {},\n mapPropsToStyleNames\n)(FooterTab);\n\nexport { StyledFooterTab as FooterTab };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Form.js b/dist/src/basic/Form.js index e7cf3c826..84e50c1f4 100644 --- a/dist/src/basic/Form.js +++ b/dist/src/basic/Form.js @@ -1,23 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Form=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nForm.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledForm = connectStyle(\"NativeBase.Form\", {}, mapPropsToStyleNames)(Form);\n\nexport { StyledForm as Form };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Form.js"],"names":["Form","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledForm"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,I;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,mDAAP;AACD,C;;;AAGHH,KAAKI,SAAL;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,YAAa,yCAAa,iBAAb,CAAgC,EAAhC;AACjBV,IADiB,CAAnB,C;;;AAIuBA,I,CAAdU,U","file":"Form.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Form extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nForm.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledForm = connectStyle(\"NativeBase.Form\", {}, mapPropsToStyleNames)(\n Form\n);\n\nexport { StyledForm as Form };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Header.js b/dist/src/basic/Header.js index e28c9c876..a44e5465f 100644 --- a/dist/src/basic/Header.js +++ b/dist/src/basic/Header.js @@ -1,7 +1,6 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Header=undefined;var _extends=Object.assign||function(target){for(var i=1;i\n\t\t\t\t\n\t\t\t\t (this._root = c)} {...this.props} />\n\t\t\t\n\t\t);\n\t}\n}\n\nHeader.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n\tsearchBar: PropTypes.bool,\n\trounded: PropTypes.bool,\n};\n\nconst StyledHeader = connectStyle(\"NativeBase.Header\", {}, mapPropsToStyleNames)(Header);\nexport { StyledHeader as Header };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Header.js"],"names":["Header","variables","context","theme","platformStyle","props","androidStatusBarColor","statusBarColor","iosBarStyle","iosStatusbar","_root","c","contextTypes","object","propTypes","style","oneOfType","number","array","searchBar","bool","rounded","StyledHeader"],"mappings":"u1BAAA,4B;AACA,qC;AACA;AACA;AACA,mE;AACA,qD;AACA,8B;;AAEMA,M;;;;;AAKK;AACP,GAAMC,WAAY,KAAKC,OAAL,CAAaC,KAAb;AACd,KAAKD,OAAL,CAAaC,KAAb,CAAmB,4BAAnB,EAAiDF,SADnC,mBAAlB;;AAGA,GAAMG,eAAgBH,UAAUG,aAAhC;;AAEA;AACE;AACE;AACE;AACE,KAAKC,KAAL,CAAWC,qBAAX;AACI,KAAKD,KAAL,CAAWC,qBADf;AAEIL,UAAUM,cAJlB;;AAME;AACE,KAAKF,KAAL,CAAWG,WAAX;AACI,KAAKH,KAAL,CAAWG,WADf;AAEIJ,gBAAkB,UAAlB;AACE,eADF;AAEEH,UAAUQ,YAXpB,iDADF;;;AAeE,0DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKN,KAA3C,mDAfF,CADF;;;AAmBD,C,sCA9BGL,M,CACGY,Y,CAAe,CACpBT,MAAO,oBAAUU,MADG,C;;;AAgCxBb,OAAOc,SAAP;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUH,MADe;AAEzB,oBAAUI,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;AAOEC,UAAW,oBAAUC,IAPvB;AAQEC,QAAS,oBAAUD,IARrB;;;AAWA,GAAME,cAAe;AACnB,mBADmB;AAEnB,EAFmB;;AAInBtB,MAJmB,CAArB,C;AAKyBA,M,CAAhBsB,Y","file":"Header.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, StatusBar, ViewPropTypes } from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\nimport variable from \"../theme/variables/platform\";\nimport _ from \"lodash\";\n\nclass Header extends Component {\n static contextTypes = {\n theme: PropTypes.object\n };\n\n render() {\n const variables = this.context.theme\n ? this.context.theme[\"@@shoutem.theme/themeStyle\"].variables\n : variable;\n const platformStyle = variables.platformStyle;\n\n return (\n \n \n (this._root = c)} {...this.props} />\n \n );\n }\n}\n\nHeader.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n searchBar: PropTypes.bool,\n rounded: PropTypes.bool\n};\n\nconst StyledHeader = connectStyle(\n \"NativeBase.Header\",\n {},\n mapPropsToStyleNames\n)(Header);\nexport { StyledHeader as Header };\n"]} \ No newline at end of file diff --git a/dist/src/basic/InputGroup.js b/dist/src/basic/InputGroup.js index 20949f929..2d38eb126 100644 --- a/dist/src/basic/InputGroup.js +++ b/dist/src/basic/InputGroup.js @@ -1,7 +1,6 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.InputGroup=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.prepareRootProps()}>\n\t\t\t\t{this.props.children}\n\t\t\t\n\t\t);\n\t}\n}\n\nInputGroup.propTypes = {\n\t...ViewPropTypes,\n\tregular: PropTypes.bool,\n\tunderline: PropTypes.bool,\n\trounded: PropTypes.bool,\n\tsuccess: PropTypes.bool,\n\terror: PropTypes.bool,\n\tdisabled: PropTypes.bool,\n};\n\nconst StyledInputGroup = connectStyle(\"NativeBase.InputGroup\", {}, mapPropsToStyleNames)(InputGroup);\n\nexport { StyledInputGroup as InputGroup };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/InputGroup.js"],"names":["InputGroup","roundedInputGroup","borderWidth","props","rounded","undefined","borderRadius","inputGroupRoundedBorderRadius","defaultProps","style","getInitialStyle","_root","c","prepareRootProps","children","propTypes","regular","bool","underline","success","error","disabled","StyledInputGroup"],"mappings":"+1BAAA,4B;AACA,qC;AACA;;AAEA,qD;AACA;AACA,mD;AACA,mE;;AAEMA,U;AACc;AAChB,MAAO;AACLC,kBAAmB;AACjBC,YAAa,KAAKC,KAAL,CAAWC,OAAX,CAAqB,CAArB,CAAyBC,SADrB;AAEjBC,aAAc,KAAKH,KAAL,CAAWC,OAAX;AACV,mBAAUG,6BADA;AAEVF,SAJa,CADd,CAAP;;;AAQD,C;;AAEkB;AACjB,GAAMG,cAAe;AACnBC,MAAO,KAAKC,eAAL,GAAuBT,iBADX,CAArB;;;AAIA,MAAO,2BAAa,KAAKE,KAAlB,CAAyBK,YAAzB,CAAP;AACD,C;AACQ;AACP;AACE,0DAAM,IAAK,sBAAM,QAAKG,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,gBAAL,EAAtC;AACG,KAAKV,KAAL,CAAWW,QADd,CADF;;;AAKD,C;;;AAGHd,WAAWe,SAAX;;AAEEC,QAAS,oBAAUC,IAFrB;AAGEC,UAAW,oBAAUD,IAHvB;AAIEb,QAAS,oBAAUa,IAJrB;AAKEE,QAAS,oBAAUF,IALrB;AAMEG,MAAO,oBAAUH,IANnB;AAOEI,SAAU,oBAAUJ,IAPtB;;;AAUA,GAAMK,kBAAmB;AACvB,uBADuB;AAEvB,EAFuB;;AAIvBtB,UAJuB,CAAzB,C;;AAM6BA,U,CAApBsB,gB","file":"InputGroup.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport variables from \"../theme/variables/platform\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport computeProps from \"../Utils/computeProps\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass InputGroup extends Component {\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? 1 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n (this._root = c)} {...this.prepareRootProps()}>\n {this.props.children}\n \n );\n }\n}\n\nInputGroup.propTypes = {\n ...ViewPropTypes,\n regular: PropTypes.bool,\n underline: PropTypes.bool,\n rounded: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool,\n disabled: PropTypes.bool\n};\n\nconst StyledInputGroup = connectStyle(\n \"NativeBase.InputGroup\",\n {},\n mapPropsToStyleNames\n)(InputGroup);\n\nexport { StyledInputGroup as InputGroup };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Left.js b/dist/src/basic/Left.js index 1026fd2df..8f626af38 100644 --- a/dist/src/basic/Left.js +++ b/dist/src/basic/Left.js @@ -1,23 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Left=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nLeft.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledLeft = connectStyle(\"NativeBase.Left\", {}, mapPropsToStyleNames)(Left);\n\nexport { StyledLeft as Left };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Left.js"],"names":["Left","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledLeft"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,I;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,mDAAP;AACD,C;;;AAGHH,KAAKI,SAAL;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,YAAa,yCAAa,iBAAb,CAAgC,EAAhC;AACjBV,IADiB,CAAnB,C;;;AAIuBA,I,CAAdU,U","file":"Left.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Left extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nLeft.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledLeft = connectStyle(\"NativeBase.Left\", {}, mapPropsToStyleNames)(\n Left\n);\n\nexport { StyledLeft as Left };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Picker.ios.js b/dist/src/basic/Picker.ios.js index ddb606af2..1a52003f1 100644 --- a/dist/src/basic/Picker.ios.js +++ b/dist/src/basic/Picker.ios.js @@ -2,7 +2,6 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.PickerNB=undefi var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes); var _createReactClass=require("create-react-class");var _createReactClass2=_interopRequireDefault(_createReactClass); var _reactNative=require("react-native"); -var _Utils=require("../Utils"); var _lodash=require("lodash");var _lodash2=_interopRequireDefault(_lodash); var _Text=require("./Text"); var _List=require("./List"); @@ -72,12 +71,18 @@ return(0,_computeProps2.default)(this.props,defaultProps); }},{key:"getLabel",value:function getLabel( props){ -var item=_lodash2.default.find(props.children,function(child){return child.props.value===props.selectedValue;}); +var item=_lodash2.default.find( +props.children, +function(child){return child.props.value===props.selectedValue;}); + return _lodash2.default.get(item,"props.label"); }},{key:"getSelectedItem",value:function getSelectedItem() {var _this2=this; -return _lodash2.default.find(this.props.children,function(child){return child.props.value===_this2.props.selectedValue;}); +return _lodash2.default.find( +this.props.children, +function(child){return child.props.value===_this2.props.selectedValue;}); + }},{key:"renderIcon",value:function renderIcon() { @@ -90,7 +95,9 @@ style:{fontSize:22,lineHeight:26,color:"#7a7a7a"}}); var onPress=function onPress(){ _this3._setModalVisible(true); }; -var text=this.state.currentLabel?this.state.currentLabel:this.props.placeholder; +var text=this.state.currentLabel? +this.state.currentLabel: +this.props.placeholder; if(this.props.renderButton){ return this.props.renderButton({ onPress:onPress, @@ -100,14 +107,25 @@ selectedItem:this.getSelectedItem()}); } return( -_react2.default.createElement(_Button.Button,{style:this.props.style,dark:true,picker:true,transparent:true,onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:103}}, +_react2.default.createElement(_Button.Button,{ +style:this.props.style, +dark:true, +picker:true, +transparent:true, +onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:110}}, + this.state.currentLabel? -_react2.default.createElement(_Text.Text,{style:this.props.textStyle,note:this.props.note,__source:{fileName:_jsxFileName,lineNumber:105}}, +_react2.default.createElement(_Text.Text,{style:this.props.textStyle,note:this.props.note,__source:{fileName:_jsxFileName,lineNumber:118}}, this.state.currentLabel): -_react2.default.createElement(_Text.Text,{style:this.props.textStyle,note:this.props.note===false?false:true,__source:{fileName:_jsxFileName,lineNumber:108}}, + +_react2.default.createElement(_Text.Text,{ +style:this.props.textStyle, +note:this.props.note===false?false:true,__source:{fileName:_jsxFileName,lineNumber:122}}, + this.props.placeholder), + this.props.iosIcon===undefined?null:this.renderIcon())); @@ -116,8 +134,9 @@ this.props.iosIcon===undefined?null:this.renderIcon())); {var _this4=this; return this.props.renderHeader? this.props.renderHeader(function(){return _this4._setModalVisible(false);}): -_react2.default.createElement(_Header.Header,{style:this.props.headerStyle,__source:{fileName:_jsxFileName,lineNumber:119}}, -_react2.default.createElement(_Left.Left,{__source:{fileName:_jsxFileName,lineNumber:120}}, + +_react2.default.createElement(_Header.Header,{style:this.props.headerStyle,__source:{fileName:_jsxFileName,lineNumber:138}}, +_react2.default.createElement(_Left.Left,{__source:{fileName:_jsxFileName,lineNumber:139}}, _react2.default.createElement(_Button.Button,{ style:_extends({ shadowOffset:null, @@ -129,25 +148,26 @@ this.props.headerBackButtonStyle), transparent:true, onPress:function onPress(){ _this4._setModalVisible(false); -},__source:{fileName:_jsxFileName,lineNumber:121}}, +},__source:{fileName:_jsxFileName,lineNumber:140}}, -_react2.default.createElement(_Text.Text,{style:this.props.headerBackButtonTextStyle,__source:{fileName:_jsxFileName,lineNumber:134}}, +_react2.default.createElement(_Text.Text,{style:this.props.headerBackButtonTextStyle,__source:{fileName:_jsxFileName,lineNumber:153}}, this.props.headerBackButtonText||"Back"))), -_react2.default.createElement(_Body.Body,{__source:{fileName:_jsxFileName,lineNumber:139}}, -_react2.default.createElement(_Title.Title,{style:this.props.headerTitleStyle,__source:{fileName:_jsxFileName,lineNumber:140}}, +_react2.default.createElement(_Body.Body,{__source:{fileName:_jsxFileName,lineNumber:158}}, +_react2.default.createElement(_Title.Title,{style:this.props.headerTitleStyle,__source:{fileName:_jsxFileName,lineNumber:159}}, this.props.iosHeader||"Select One")), -_react2.default.createElement(_Right.Right,{__source:{fileName:_jsxFileName,lineNumber:144}})); +_react2.default.createElement(_Right.Right,{__source:{fileName:_jsxFileName,lineNumber:163}})); + }},{key:"render",value:function render() {var _this5=this; return( -_react2.default.createElement(_reactNative.View,{ref:function ref(c){return _this5._root=c;},__source:{fileName:_jsxFileName,lineNumber:150}}, +_react2.default.createElement(_reactNative.View,{ref:function ref(c){return _this5._root=c;},__source:{fileName:_jsxFileName,lineNumber:170}}, this.renderButton(), _react2.default.createElement(_reactNative.Modal,{ supportedOrientations:this.props.supportedOrientations||null, @@ -156,11 +176,11 @@ transparent:false, visible:this.state.modalVisible, onRequestClose:function onRequestClose(){ _this5._setModalVisible(false); -},__source:{fileName:_jsxFileName,lineNumber:152}}, +},__source:{fileName:_jsxFileName,lineNumber:172}}, -_react2.default.createElement(_Container.Container,{__source:{fileName:_jsxFileName,lineNumber:161}}, +_react2.default.createElement(_Container.Container,{__source:{fileName:_jsxFileName,lineNumber:181}}, this.renderHeader(), -_react2.default.createElement(_Content.Content,{__source:{fileName:_jsxFileName,lineNumber:163}}, +_react2.default.createElement(_Content.Content,{__source:{fileName:_jsxFileName,lineNumber:183}}, _react2.default.createElement(_List.List,{ dataArray:this.state.dataSource, renderRow:function renderRow(child){return( @@ -172,15 +192,18 @@ onPress:function onPress(){ _this5._setModalVisible(false); _this5.props.onValueChange(child.props.value); _this5.setState({current:child.props.label}); -},__source:{fileName:_jsxFileName,lineNumber:167}}, +},__source:{fileName:_jsxFileName,lineNumber:187}}, -_react2.default.createElement(_Text.Text,{style:_this5.props.itemTextStyle,__source:{fileName:_jsxFileName,lineNumber:177}}, +_react2.default.createElement(_Text.Text,{style:_this5.props.itemTextStyle,__source:{fileName:_jsxFileName,lineNumber:197}}, child.props.label), -_react2.default.createElement(_Right.Right,{__source:{fileName:_jsxFileName,lineNumber:180}}, +_react2.default.createElement(_Right.Right,{__source:{fileName:_jsxFileName,lineNumber:200}}, child.props.value===_this5.props.selectedValue? -_react2.default.createElement(_Radio.Radio,{selected:true,__source:{fileName:_jsxFileName,lineNumber:182}}): -_react2.default.createElement(_Radio.Radio,{selected:false,__source:{fileName:_jsxFileName,lineNumber:183}}))));},__source:{fileName:_jsxFileName,lineNumber:164}})))))); +_react2.default.createElement(_Radio.Radio,{selected:true,__source:{fileName:_jsxFileName,lineNumber:202}}): + +_react2.default.createElement(_Radio.Radio,{selected:false,__source:{fileName:_jsxFileName,lineNumber:204}}))));},__source:{fileName:_jsxFileName,lineNumber:184}})))))); + + @@ -194,16 +217,20 @@ _react2.default.createElement(_Radio.Radio,{selected:false,__source:{fileName:_j PickerNB.Item=(0,_createReactClass2.default)({displayName:"Item", render:function render(){ -return _react2.default.createElement(_reactNative.Picker.Item,_extends({},this.props(),{__source:{fileName:_jsxFileName,lineNumber:197}})); +return _react2.default.createElement(_reactNative.Picker.Item,_extends({},this.props(),{__source:{fileName:_jsxFileName,lineNumber:220}})); }}); -PickerNB.propTypes=_extends({},_Utils.ViewPropTypes,{ +PickerNB.propTypes=_extends({},_reactNative.ViewPropTypes,{ renderButton:_propTypes2.default.func}); -var StyledPickerNB=(0,_nativeBaseShoutemTheme.connectStyle)("NativeBase.PickerNB",{},_mapPropsToStyleNames2.default)(PickerNB);exports. +var StyledPickerNB=(0,_nativeBaseShoutemTheme.connectStyle)( +"NativeBase.PickerNB", +{},_mapPropsToStyleNames2.default)( + +PickerNB);exports. PickerNB=StyledPickerNB; //# sourceMappingURL=Picker.ios.js.map \ No newline at end of file diff --git a/dist/src/basic/Picker.ios.js.map b/dist/src/basic/Picker.ios.js.map index 93e689df8..e39b0d198 100644 --- a/dist/src/basic/Picker.ios.js.map +++ b/dist/src/basic/Picker.ios.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/basic/Picker.ios.js"],"names":["PickerNB","props","state","modalVisible","currentLabel","getLabel","dataSource","children","nextProps","nextLabel","currentDS","nextDS","setState","picker","pickerItem","visible","defaultProps","style","getInitialStyle","itemStyle","item","find","child","value","selectedValue","get","cloneElement","iosIcon","fontSize","lineHeight","color","onPress","_setModalVisible","text","placeholder","renderButton","selectedItem","getSelectedItem","textStyle","note","undefined","renderIcon","renderHeader","headerStyle","shadowOffset","shadowColor","shadowRadius","shadowOpacity","headerBackButtonStyle","headerBackButtonTextStyle","headerBackButtonText","headerTitleStyle","iosHeader","_root","c","supportedOrientations","onValueChange","current","label","itemTextStyle","Item","render","propTypes","func","StyledPickerNB"],"mappings":"61BAAA,4B;AACA,qC;AACA,oD;AACA;AACA;AACA,8B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mD;;AAEA,mE;;AAEMA,Q;AACL,kBAAYC,KAAZ,CAAmB;AACZA,KADY;AAElB,MAAKC,KAAL,CAAa;AACZC,aAAc,KADF;AAEZC,aAAc,MAAKC,QAAL,CAAcJ,KAAd,CAFF;AAGZK,WAAYL,MAAMM,QAHN,CAAb,CAFkB;;AAOlB,C;;AAEyBC,S,CAAW;AACpC,GAAMJ,cAAe,KAAKF,KAAL,CAAWE,YAAhC;AACA,GAAMK,WAAY,KAAKJ,QAAL,CAAcG,SAAd,CAAlB;AACA,GAAME,WAAY,KAAKR,KAAL,CAAWI,UAA7B;AACA,GAAMK,QAASH,UAAUD,QAAzB;;AAEA,GAAIH,eAAiBK,SAArB,CAAgC;AAC/B,KAAKG,QAAL,CAAc;AACbR,aAAcK,SADD,CAAd;;AAGA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FxB,SAAS4D,IAAT,CAAgB,+BAAiB;AAChCC,MADgC,kBACvB;AACR,MAAO,mDAAQ,IAAR,aAAiB,KAAK5D,KAAL,EAAjB,oDAAP;AACA,CAH+B,CAAjB,CAAhB;;;AAMAD,SAAS8D,SAAT;;AAEC3B,aAAc,oBAAU4B,IAFzB;;;AAKA,GAAMC,gBAAiB,yCAAa,qBAAb,CAAoC,EAApC,iCAA8DhE,QAA9D,CAAvB,C;;AAE2BA,Q,CAAlBgE,c","file":"Picker.ios.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport createReactClass from \"create-react-class\";\nimport { Picker, Modal, View, ListView } from \"react-native\";\nimport { ViewPropTypes } from '../Utils';\nimport _ from \"lodash\";\nimport { Text } from \"./Text\";\nimport { List } from \"./List\";\nimport { IconNB as Icon } from \"./IconNB\";\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\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport computeProps from \"../Utils/computeProps\";\n\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass PickerNB extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tmodalVisible: false,\n\t\t\tcurrentLabel: this.getLabel(props),\n\t\t\tdataSource: props.children,\n\t\t};\n\t}\n\n\tcomponentWillReceiveProps(nextProps) {\n\t\tconst currentLabel = this.state.currentLabel;\n\t\tconst nextLabel = this.getLabel(nextProps);\n\t\tconst currentDS = this.state.dataSource;\n\t\tconst nextDS = nextProps.children;\n\n\t\tif (currentLabel !== nextLabel) {\n\t\t\tthis.setState({\n\t\t\t\tcurrentLabel: nextLabel,\n\t\t\t});\n\t\t}\n\t\tif (currentDS !== nextDS) {\n\t\t\tthis.setState({\n\t\t\t\tdataSource: nextDS,\n\t\t\t});\n\t\t}\n\t}\n\n\tgetInitialStyle() {\n\t\treturn {\n\t\t\tpicker: {\n\t\t\t\t// alignItems: 'flex-end'\n\t\t\t},\n\t\t\tpickerItem: {},\n\t\t};\n\t}\n\t_setModalVisible(visible) {\n\t\tthis.setState({ modalVisible: visible });\n\t}\n\n\tprepareRootProps() {\n\t\tconst defaultProps = {\n\t\t\tstyle: this.getInitialStyle().picker,\n\t\t\titemStyle: this.getInitialStyle().pickerItem,\n\t\t};\n\n\t\treturn computeProps(this.props, defaultProps);\n\t}\n\n\tgetLabel(props) {\n\t\tconst item = _.find(props.children, child => child.props.value === props.selectedValue);\n\t\treturn _.get(item, \"props.label\");\n\t}\n\n\tgetSelectedItem() {\n\t\treturn _.find(this.props.children, child => child.props.value === this.props.selectedValue);\n\t}\n\n\trenderIcon() {\n\t\treturn React.cloneElement(this.props.iosIcon, {\n\t\t\tstyle: { fontSize: 22, lineHeight: 26, color: \"#7a7a7a\" },\n\t\t});\n\t}\n\n\trenderButton() {\n\t\tconst onPress = () => {\n\t\t\tthis._setModalVisible(true);\n\t\t};\n\t\tconst text = this.state.currentLabel ? this.state.currentLabel : this.props.placeholder;\n\t\tif (this.props.renderButton) {\n\t\t\treturn this.props.renderButton({\n\t\t\t\tonPress,\n\t\t\t\ttext,\n\t\t\t\tpicker: this,\n\t\t\t\tselectedItem: this.getSelectedItem(),\n\t\t\t});\n\t\t}\n\t\treturn (\n\t\t\t\n\t\t);\n\t}\n\n\trenderHeader() {\n\t\treturn this.props.renderHeader\n\t\t\t? this.props.renderHeader(() => this._setModalVisible(false))\n\t\t\t:
\n\t\t\t\t\t\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\tthis._setModalVisible(false);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{this.props.headerBackButtonText || \"Back\"}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{this.props.iosHeader || \"Select One\"}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
;\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t (this._root = c)}>\n\t\t\t\t{this.renderButton()}\n\t\t\t\t {\n\t\t\t\t\t\tthis._setModalVisible(false);\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t\n\t\t\t\t\t\t{this.renderHeader()}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t\t\tthis._setModalVisible(false);\n\t\t\t\t\t\t\t\t\t\t\tthis.props.onValueChange(child.props.value);\n\t\t\t\t\t\t\t\t\t\t\tthis.setState({ current: child.props.label });\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{child.props.label}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{child.props.value === this.props.selectedValue\n\t\t\t\t\t\t\t\t\t\t\t\t? \n\t\t\t\t\t\t\t\t\t\t\t\t: }\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}\n}\n\nPickerNB.Item = createReactClass({\n\trender() {\n\t\treturn ;\n\t},\n});\n\nPickerNB.propTypes = {\n\t...ViewPropTypes,\n\trenderButton: PropTypes.func,\n};\n\nconst StyledPickerNB = connectStyle(\"NativeBase.PickerNB\", {}, mapPropsToStyleNames)(PickerNB);\n\nexport { StyledPickerNB as PickerNB };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Picker.ios.js"],"names":["PickerNB","props","state","modalVisible","currentLabel","getLabel","dataSource","children","nextProps","nextLabel","currentDS","nextDS","setState","picker","pickerItem","visible","defaultProps","style","getInitialStyle","itemStyle","item","find","child","value","selectedValue","get","cloneElement","iosIcon","fontSize","lineHeight","color","onPress","_setModalVisible","text","placeholder","renderButton","selectedItem","getSelectedItem","textStyle","note","undefined","renderIcon","renderHeader","headerStyle","shadowOffset","shadowColor","shadowRadius","shadowOpacity","headerBackButtonStyle","headerBackButtonTextStyle","headerBackButtonText","headerTitleStyle","iosHeader","_root","c","supportedOrientations","onValueChange","current","label","itemTextStyle","Item","render","propTypes","func","StyledPickerNB"],"mappings":"61BAAA,4B;AACA,qC;AACA,oD;AACA;AACA,8B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mD;;AAEA,mE;;AAEMA,Q;AACJ,kBAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,aAAc,KADH;AAEXC,aAAc,MAAKC,QAAL,CAAcJ,KAAd,CAFH;AAGXK,WAAYL,MAAMM,QAHP,CAAb,CAFiB;;AAOlB,C;;AAEyBC,S,CAAW;AACnC,GAAMJ,cAAe,KAAKF,KAAL,CAAWE,YAAhC;AACA,GAAMK,WAAY,KAAKJ,QAAL,CAAcG,SAAd,CAAlB;AACA,GAAME,WAAY,KAAKR,KAAL,CAAWI,UAA7B;AACA,GAAMK,QAASH,UAAUD,QAAzB;;AAEA,GAAIH,eAAiBK,SAArB,CAAgC;AAC9B,KAAKG,QAAL,CAAc;AACZR,aAAcK,SADF,CAAd;;AAGD;AACD,GAAIC,YAAcC,MAAlB,CAA0B;AACxB,KAAKC,QAAL,CAAc;AACZN,WAAYK,MADA,CAAd;;AAGD;AACF,C;;AAEiB;AAChB,MAAO;AACLE,OAAQ,EADH;;;AAILC,WAAY,EAJP,CAAP;;AAMD,C;AACgBC,O,CAAS;AACx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KA,GAAMC,gBAAiB;AACrB,qBADqB;AAErB,EAFqB;;AAIrBhE,QAJqB,CAAvB,C;;AAM2BA,Q,CAAlBgE,c","file":"Picker.ios.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport createReactClass from \"create-react-class\";\nimport { Picker, Modal, View, ListView, ViewPropTypes } from \"react-native\";\nimport _ from \"lodash\";\nimport { Text } from \"./Text\";\nimport { List } from \"./List\";\nimport { IconNB as Icon } from \"./IconNB\";\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\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport computeProps from \"../Utils/computeProps\";\n\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass PickerNB extends Component {\n constructor(props) {\n super(props);\n this.state = {\n modalVisible: false,\n currentLabel: this.getLabel(props),\n dataSource: props.children\n };\n }\n\n componentWillReceiveProps(nextProps) {\n const currentLabel = this.state.currentLabel;\n const nextLabel = this.getLabel(nextProps);\n const currentDS = this.state.dataSource;\n const nextDS = 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 getInitialStyle() {\n return {\n picker: {\n // alignItems: 'flex-end'\n },\n pickerItem: {}\n };\n }\n _setModalVisible(visible) {\n this.setState({ modalVisible: visible });\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 getLabel(props) {\n const item = _.find(\n props.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 renderIcon() {\n return React.cloneElement(this.props.iosIcon, {\n style: { fontSize: 22, lineHeight: 26, color: \"#7a7a7a\" }\n });\n }\n\n renderButton() {\n const onPress = () => {\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 render() {\n return (\n (this._root = c)}>\n {this.renderButton()}\n {\n this._setModalVisible(false);\n }}\n >\n \n {this.renderHeader()}\n \n (\n {\n this._setModalVisible(false);\n this.props.onValueChange(child.props.value);\n this.setState({ current: child.props.label });\n }}\n >\n \n {child.props.label}\n \n \n {child.props.value === this.props.selectedValue ? (\n \n ) : (\n \n )}\n \n \n )}\n />\n \n \n \n \n );\n }\n}\n\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/Right.js b/dist/src/basic/Right.js index 3fada203a..8f6c13635 100644 --- a/dist/src/basic/Right.js +++ b/dist/src/basic/Right.js @@ -1,23 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Right=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nRight.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledRight = connectStyle(\"NativeBase.Right\", {}, mapPropsToStyleNames)(Right);\n\nexport { StyledRight as Right };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Right.js"],"names":["Right","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledRight"],"mappings":"q1BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,K;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,mDAAP;AACD,C;;;AAGHH,MAAMI,SAAN;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,aAAc,yCAAa,kBAAb,CAAiC,EAAjC;AAClBV,KADkB,CAApB,C;;;AAIwBA,K,CAAfU,W","file":"Right.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Right extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nRight.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledRight = connectStyle(\"NativeBase.Right\", {}, mapPropsToStyleNames)(\n Right\n);\n\nexport { StyledRight as Right };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Root.js b/dist/src/basic/Root.js index 674885d27..4f1d87e8d 100644 --- a/dist/src/basic/Root.js +++ b/dist/src/basic/Root.js @@ -1,6 +1,5 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Root=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} style={{ flex: 1 }}>\n\t\t\t\t{this.props.children}\n\t\t\t\t {\n\t\t\t\t\t\tif (!Toast.toastInstance) Toast.toastInstance = c;\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t {\n\t\t\t\t\t\tif (!ActionSheet.actionsheetInstance) ActionSheet.actionsheetInstance = c;\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\n\t\t);\n\t}\n}\n\nRoot.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledRoot = connectStyle(\"NativeBase.Root\", {}, mapPropsToStyleNames)(Root);\n\nexport { StyledRoot as Root };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Root.js"],"names":["Root","_root","c","props","flex","children","toastInstance","actionsheetInstance","propTypes","style","oneOfType","object","number","array","StyledRoot"],"mappings":"m1BAAA,4B;AACA;AACA,qC;AACA;AACA,mE;AACA;AACA;AACA,4B;;AAEMA,I;AACK;AACP;AACE,0DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,EAAkD,MAAO,CAAEC,KAAM,CAAR,CAAzD;AACG,KAAKD,KAAL,CAAWE,QADd;AAEE;AACE,IAAK,eAAK;AACR,GAAI,CAAC,+BAAMC,aAAX,CAA0B,+BAAMA,aAAN,CAAsBJ,CAAtB;AAC3B,CAHH,iDAFF;;AAOE;AACE,IAAK,eAAK;AACR,GAAI,CAAC,kCAAYK,mBAAjB;AACE,kCAAYA,mBAAZ,CAAkCL,CAAlC;AACH,CAJH,iDAPF,CADF;;;;AAgBD,C;;;AAGHF,KAAKQ,SAAL;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,YAAa,yCAAa,iBAAb,CAAgC,EAAhC;AACjBd,IADiB,CAAnB,C;;;AAIuBA,I,CAAdc,U","file":"Root.js","sourcesContent":["import React, { Component } from \"react\";\nimport { View, ViewPropTypes } from \"react-native\";\nimport PropTypes from \"prop-types\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\nimport { ToastContainer as Toast } from \"./ToastContainer\";\nimport { ActionSheetContainer as ActionSheet } from \"./Actionsheet\";\nimport { Text } from \"./Text\";\n\nclass Root extends Component {\n render() {\n return (\n (this._root = c)} {...this.props} style={{ flex: 1 }}>\n {this.props.children}\n {\n if (!Toast.toastInstance) Toast.toastInstance = c;\n }}\n />\n {\n if (!ActionSheet.actionsheetInstance)\n ActionSheet.actionsheetInstance = c;\n }}\n />\n \n );\n }\n}\n\nRoot.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledRoot = connectStyle(\"NativeBase.Root\", {}, mapPropsToStyleNames)(\n Root\n);\n\nexport { StyledRoot as Root };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Segment.js b/dist/src/basic/Segment.js index 15230af30..23b520ec8 100644 --- a/dist/src/basic/Segment.js +++ b/dist/src/basic/Segment.js @@ -1,21 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Segment=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nSegment.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledSegment = connectStyle(\"NativeBase.Segment\", {}, mapPropsToStyleNames)(Segment);\nexport { StyledSegment as Segment };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Segment.js"],"names":["Segment","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledSegment"],"mappings":"y1BAAA,4B;AACA,qC;AACA;AACA;AACA,mE;;AAEMA,O;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,kDAAP;AACD,C;;;AAGHH,QAAQI,SAAR;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,eAAgB;AACpB,oBADoB;AAEpB,EAFoB;;AAIpBV,OAJoB,CAAtB,C;AAK0BA,O,CAAjBU,a","file":"Segment.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Segment extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nSegment.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledSegment = connectStyle(\n \"NativeBase.Segment\",\n {},\n mapPropsToStyleNames\n)(Segment);\nexport { StyledSegment as Segment };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Separator.js b/dist/src/basic/Separator.js index f2d97775d..be455d351 100644 --- a/dist/src/basic/Separator.js +++ b/dist/src/basic/Separator.js @@ -1,23 +1,30 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Separator=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nSeparator.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledSeparator = connectStyle(\"NativeBase.Separator\", {}, mapPropsToStyleNames)(Separator);\n\nexport { StyledSeparator as Separator };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Separator.js"],"names":["Separator","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledSeparator"],"mappings":"61BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,S;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,mDAAP;AACD,C;;;AAGHH,UAAUI,SAAV;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,iBAAkB;AACtB,sBADsB;AAEtB,EAFsB;;AAItBV,SAJsB,CAAxB,C;;AAM4BA,S,CAAnBU,e","file":"Separator.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Separator extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nSeparator.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledSeparator = connectStyle(\n \"NativeBase.Separator\",\n {},\n mapPropsToStyleNames\n)(Separator);\n\nexport { StyledSeparator as Separator };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Tab.js b/dist/src/basic/Tab.js index 113850c01..38b1a5b4a 100644 --- a/dist/src/basic/Tab.js +++ b/dist/src/basic/Tab.js @@ -1,7 +1,6 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Tab=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props}>\n\t\t\t\t{this.props.children}\n\t\t\t\n\t\t);\n\t}\n}\n\nTab.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledTab = connectStyle(\"NativeBase.Tab\", {}, mapPropsToStyleNames)(Tab);\n\nexport { StyledTab as Tab };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Tab.js"],"names":["Tab","_root","c","props","children","propTypes","style","oneOfType","object","number","array","StyledTab"],"mappings":"i1BAAA,4B;AACA,qC;AACA;;AAEA;AACA,mE;;AAEMA,G;AACK;AACP;AACE,0DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C;AACG,KAAKA,KAAL,CAAWC,QADd,CADF;;;AAKD,C;;;AAGHJ,IAAIK,SAAJ;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,WAAY,yCAAa,gBAAb,CAA+B,EAA/B,iCAAyDX,GAAzD,CAAlB,C;;AAEsBA,G,CAAbW,S","file":"Tab.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Tab extends Component {\n render() {\n return (\n (this._root = c)} {...this.props}>\n {this.props.children}\n \n );\n }\n}\n\nTab.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledTab = connectStyle(\"NativeBase.Tab\", {}, mapPropsToStyleNames)(Tab);\n\nexport { StyledTab as Tab };\n"]} \ No newline at end of file diff --git a/dist/src/basic/TabContainer.js b/dist/src/basic/TabContainer.js index ab67ad916..90190a5f1 100644 --- a/dist/src/basic/TabContainer.js +++ b/dist/src/basic/TabContainer.js @@ -1,21 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.TabContainer=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nTabContainer.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledTabContainer = connectStyle(\"NativeBase.TabContainer\", {}, mapPropsToStyleNames)(TabContainer);\nexport { StyledTabContainer as TabContainer };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/TabContainer.js"],"names":["TabContainer","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledTabContainer"],"mappings":"m2BAAA,4B;AACA,qC;AACA;AACA;AACA,mE;;AAEMA,Y;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,kDAAP;AACD,C;;;AAGHH,aAAaI,SAAb;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,oBAAqB;AACzB,yBADyB;AAEzB,EAFyB;;AAIzBV,YAJyB,CAA3B,C;AAK+BA,Y,CAAtBU,kB","file":"TabContainer.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass TabContainer extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nTabContainer.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledTabContainer = connectStyle(\n \"NativeBase.TabContainer\",\n {},\n mapPropsToStyleNames\n)(TabContainer);\nexport { StyledTabContainer as TabContainer };\n"]} \ No newline at end of file diff --git a/dist/src/basic/TabHeading.js b/dist/src/basic/TabHeading.js index 76b8bb87f..b2fc594bd 100644 --- a/dist/src/basic/TabHeading.js +++ b/dist/src/basic/TabHeading.js @@ -1,21 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.TabHeading=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nTabHeadingNB.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledTabHeadingNB = connectStyle(\"NativeBase.TabHeading\", {}, mapPropsToStyleNames)(TabHeadingNB);\nexport { StyledTabHeadingNB as TabHeading };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/TabHeading.js"],"names":["TabHeadingNB","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledTabHeadingNB","TabHeading"],"mappings":"+1BAAA,4B;AACA,qC;AACA;AACA;AACA,mE;;AAEMA,Y;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,kDAAP;AACD,C;;;AAGHH,aAAaI,SAAb;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,oBAAqB;AACzB,uBADyB;AAEzB,EAFyB;;AAIzBV,YAJyB,CAA3B,C;AAK+BW,U,CAAtBD,kB","file":"TabHeading.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass TabHeadingNB extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nTabHeadingNB.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledTabHeadingNB = connectStyle(\n \"NativeBase.TabHeading\",\n {},\n mapPropsToStyleNames\n)(TabHeadingNB);\nexport { StyledTabHeadingNB as TabHeading };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Toast.js b/dist/src/basic/Toast.js index c06204e78..1edfaf351 100644 --- a/dist/src/basic/Toast.js +++ b/dist/src/basic/Toast.js @@ -1,21 +1,26 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.Toast=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nToast.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledToast = connectStyle(\"NativeBase.Toast\", {}, mapPropsToStyleNames)(Toast);\nexport { StyledToast as Toast };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Toast.js"],"names":["Toast","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledToast"],"mappings":"q1BAAA,4B;AACA,qC;AACA;AACA;AACA,mE;;AAEMA,K;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,kDAAP;AACD,C;;;AAGHH,MAAMI,SAAN;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,aAAc,yCAAa,kBAAb,CAAiC,EAAjC;AAClBV,KADkB,CAApB,C;;AAGwBA,K,CAAfU,W","file":"Toast.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass Toast extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nToast.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledToast = connectStyle(\"NativeBase.Toast\", {}, mapPropsToStyleNames)(\n Toast\n);\nexport { StyledToast as Toast };\n"]} \ No newline at end of file diff --git a/dist/src/basic/ToastContainer.js b/dist/src/basic/ToastContainer.js index 8d0488b3b..1ad629423 100644 --- a/dist/src/basic/ToastContainer.js +++ b/dist/src/basic/ToastContainer.js @@ -1,7 +1,6 @@ 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 - ToastContainer=function(_Component){_inherits(ToastContainer,_Component); function ToastContainer(props){_classCallCheck(this,ToastContainer);var _this=_possibleConstructorReturn(this,(ToastContainer.__proto__||Object.getPrototypeOf(ToastContainer)).call(this, props)); @@ -92,35 +90,45 @@ modalVisible:false}); {var _this4=this; if(this.state.modalVisible){ return( -_react2.default.createElement(_reactNative.Animated.View,{style:this.getToastStyle(),__source:{fileName:_jsxFileName,lineNumber:95}}, +_react2.default.createElement(_reactNative.Animated.View,{style:this.getToastStyle(),__source:{fileName:_jsxFileName,lineNumber:93}}, _react2.default.createElement(_Toast.Toast,{ style:this.state.style, danger:this.state.type=="danger"?true:false, success:this.state.type=="success"?true:false, -warning:this.state.type=="warning"?true:false,__source:{fileName:_jsxFileName,lineNumber:96}}, - -_react2.default.createElement(_Text.Text,{style:this.state.textStyle,__source:{fileName:_jsxFileName,lineNumber:102}}, -this.state.text), +warning:this.state.type=="warning"?true:false,__source:{fileName:_jsxFileName,lineNumber:94}}, +_react2.default.createElement(_Text.Text,{style:this.state.textStyle,__source:{fileName:_jsxFileName,lineNumber:100}},this.state.text), this.state.buttonText&& -_react2.default.createElement(_Button.Button,{style:this.state.buttonStyle,onPress:function onPress(){return _this4.closeToast();},__source:{fileName:_jsxFileName,lineNumber:106}}, -_react2.default.createElement(_Text.Text,{style:this.state.buttonTextStyle,__source:{fileName:_jsxFileName,lineNumber:107}}, +_react2.default.createElement(_Button.Button,{ +style:this.state.buttonStyle, +onPress:function onPress(){return _this4.closeToast();},__source:{fileName:_jsxFileName,lineNumber:102}}, + +_react2.default.createElement(_Text.Text,{style:this.state.buttonTextStyle,__source:{fileName:_jsxFileName,lineNumber:106}}, this.state.buttonText))))); + }else return null; }}],[{key:"show",value:function show(_ref2){var config=_objectWithoutProperties(_ref2,[]);this.toastInstance._root.showToast({config:config});}}]);return ToastContainer;}(_react.Component); -ToastContainer.propTypes=_extends({},_Utils.ViewPropTypes,{ +ToastContainer.propTypes=_extends({},_reactNative.ViewPropTypes,{ + +style:_propTypes2.default.oneOfType([ +_propTypes2.default.object, +_propTypes2.default.number, +_propTypes2.default.array])}); + -style:_propTypes2.default.oneOfType([_propTypes2.default.object,_propTypes2.default.number,_propTypes2.default.array])}); +var StyledToastContainer=(0,_nativeBaseShoutemTheme.connectStyle)( +"NativeBase.ToastContainer", +{},_mapPropsToStyleNames2.default)( -var StyledToastContainer=(0,_nativeBaseShoutemTheme.connectStyle)("NativeBase.ToastContainer",{},_mapPropsToStyleNames2.default)(ToastContainer);exports. +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 655bf1ecf..2d9e5aed6 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":["ToastContainer","props","state","modalVisible","fadeAnim","Value","position","opacity","width","elevation","paddingHorizontal","OS","top","getTop","undefined","bottom","config","setState","text","buttonText","type","supportedOrientations","style","buttonTextStyle","buttonStyle","textStyle","onClose","duration","setTimeout","timing","toValue","start","getToastStyle","closeToast","toastInstance","_root","showToast","propTypes","oneOfType","object","number","array","StyledToastContainer"],"mappings":"u2BAAA,4B;AACA,qC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mE;;;AAGMA,c;AACL,wBAAYC,KAAZ,CAAmB;AACZA,KADY;AAElB,MAAKC,KAAL,CAAa;AACZC,aAAc,KADF;AAEZC,SAAU,GAAI,uBAASC,KAAb,CAAmB,CAAnB,CAFE,CAAb,CAFkB;;AAMlB,C;;;;;AAKe;AACf,MAAO;AACNC,SAAU,UADJ;AAENC,QAAS,KAAKL,KAAL,CAAWE,QAFd;AAGNI,MAAO,MAHD;AAINC,UAAW,CAJL;AAKNC,kBAAmB,sBAASC,EAAT,GAAgB,KAAhB,CAAwB,EAAxB,CAA6B,CAL1C;AAMNC,IAAK,KAAKV,KAAL,CAAWI,QAAX,GAAwB,KAAxB,CAAgC,KAAKO,MAAL,EAAhC,CAAgDC,SAN/C;AAONC,OAAQ,KAAKb,KAAL,CAAWI,QAAX,GAAwB,QAAxB,CAAmC,KAAKO,MAAL,EAAnC,CAAmDC,SAPrD,CAAP;;AASA,C;AACQ;AACR,GAAI,sBAASH,EAAT,GAAgB,KAApB,CAA2B;AAC1B,MAAO,GAAP;AACA,CAFD,IAEO;AACN,MAAO,EAAP;AACA;AACD,C;AACqB,oBAAVK,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AAC5B;AACC,oDAAU,IAAV,EAAe,MAAO,KAAK6B,aAAL,EAAtB;AACC;AACC,MAAO,KAAK9B,KAAL,CAAWoB,KADnB;AAEC,OAAQ,KAAKpB,KAAL,CAAWkB,IAAX,EAAmB,QAAnB,CAA8B,IAA9B,CAAqC,KAF9C;AAGC,QAAS,KAAKlB,KAAL,CAAWkB,IAAX,EAAmB,SAAnB,CAA+B,IAA/B,CAAsC,KAHhD;AAIC,QAAS,KAAKlB,KAAL,CAAWkB,IAAX,EAAmB,SAAnB,CAA+B,IAA/B,CAAsC,KAJhD;;AAMC,0CAAM,MAAO,KAAKlB,KAAL,CAAWuB,SAAxB;AACE,KAAKvB,KAAL,CAAWgB,IADb,CAND;;AASE,KAAKhB,KAAL,CAAWiB,UAAX;AACA,8CAAQ,MAAO,KAAKjB,KAAL,CAAWsB,WAA1B,CAAuC,QAAS,yBAAM,QAAKS,UAAL,EAAN,EAAhD;AACC,0CAAM,MAAO,KAAK/B,KAAL,CAAWqB,eAAxB;AACE,KAAKrB,KAAL,CAAWiB,UADb,CADD,CAVF,CADD,CADD;;;;;;AAoBA,CArBD,IAqBO,OAAO,KAAP;AACP,C,0CA7F0B,IAAVH,OAAU,oCAC1B,KAAKkB,aAAL,CAAmBC,KAAnB,CAAyBC,SAAzB,CAAmC,CAAEpB,aAAF,CAAnC,EACA,C;;;AA8FFhB,eAAeqC,SAAf;;AAECf,MAAO,oBAAUgB,SAAV,CAAoB,CAAC,oBAAUC,MAAX,CAAmB,oBAAUC,MAA7B,CAAqC,oBAAUC,KAA/C,CAApB,CAFR;;;AAKA,GAAMC,sBAAuB,yCAAa,2BAAb,CAA0C,EAA1C,iCAAoE1C,cAApE,CAA7B,C;;AAEiCA,c,CAAxB0C,oB","file":"ToastContainer.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, Modal, Platform, Animated } from \"react-native\";\nimport { ViewPropTypes } from '../Utils';\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport { Text } from \"./Text\";\nimport { Button } from \"./Button\";\nimport { ViewNB } from \"./View\";\nimport { Toast } from \"./Toast\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\n\nclass ToastContainer extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tmodalVisible: false,\n\t\t\tfadeAnim: new Animated.Value(0),\n\t\t};\n\t}\n\tstatic toastInstance;\n\tstatic show({ ...config }) {\n\t\tthis.toastInstance._root.showToast({ config });\n\t}\n\tgetToastStyle() {\n\t\treturn {\n\t\t\tposition: \"absolute\",\n\t\t\topacity: this.state.fadeAnim,\n\t\t\twidth: \"100%\",\n\t\t\televation: 9,\n\t\t\tpaddingHorizontal: Platform.OS === \"ios\" ? 20 : 0,\n\t\t\ttop: this.state.position === \"top\" ? this.getTop() : undefined,\n\t\t\tbottom: this.state.position === \"bottom\" ? this.getTop() : undefined,\n\t\t};\n\t}\n\tgetTop() {\n\t\tif (Platform.OS === \"ios\") {\n\t\t\treturn 30;\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t}\n\tshowToast({ config }) {\n\t\tthis.setState({\n\t\t\tmodalVisible: true,\n\t\t\ttext: config.text,\n\t\t\tbuttonText: config.buttonText,\n\t\t\ttype: config.type,\n\t\t\tposition: config.position ? config.position : \"bottom\",\n\t\t\tsupportedOrientations: config.supportedOrientations,\n\t\t\tstyle: config.style,\n\t\t\tbuttonTextStyle: config.buttonTextStyle,\n\t\t\tbuttonStyle: config.buttonStyle,\n\t\t\ttextStyle: config.textStyle,\n\t\t\tonClose: config.onClose\n\t\t});\n\t\tif (config.duration > 0) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tAnimated.timing(this.state.fadeAnim, {\n\t\t\t\t\ttoValue: 0,\n\t\t\t\t\tduration: 200,\n\t\t\t\t}).start();\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.setState({\n\t\t\t\t\t\tmodalVisible: false,\n\t\t\t\t\t});\n\t\t\t\t}, 500);\n\t\t\t}, config.duration);\n\t\t}\n\t\tAnimated.timing(this.state.fadeAnim, {\n\t\t\ttoValue: 1,\n\t\t\tduration: 200,\n\t\t}).start();\n\t}\n\tcloseToast() {\n\t\tconst { onClose } = this.state;\n\n\t\tif(onClose && typeof onClose === \"function\") {\n\t\t\tonClose();\n\t\t}\n\n\t\tAnimated.timing(this.state.fadeAnim, {\n\t\t\ttoValue: 0,\n\t\t\tduration: 200,\n\t\t}).start();\n\t\tsetTimeout(() => {\n\t\t\tthis.setState({\n\t\t\t\tmodalVisible: false,\n\t\t\t});\n\t\t}, 500);\n\t}\n\trender() {\n\t\tif (this.state.modalVisible) {\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{this.state.text}\n\t\t\t\t\t\t\n\t\t\t\t\t\t{this.state.buttonText &&\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t);\n\t\t} else return null;\n\t}\n}\n\nToastContainer.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledToastContainer = connectStyle(\"NativeBase.ToastContainer\", {}, mapPropsToStyleNames)(ToastContainer);\n\nexport { StyledToastContainer as ToastContainer };\n\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/ToastContainer.js"],"names":["ToastContainer","props","state","modalVisible","fadeAnim","Value","position","opacity","width","elevation","paddingHorizontal","OS","top","getTop","undefined","bottom","config","setState","text","buttonText","type","supportedOrientations","style","buttonTextStyle","buttonStyle","textStyle","onClose","duration","setTimeout","timing","toValue","start","getToastStyle","closeToast","toastInstance","_root","showToast","propTypes","oneOfType","object","number","array","StyledToastContainer"],"mappings":"u2BAAA,4B;AACA,qC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mE;;AAEMA,c;AACJ,wBAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MA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B,KAAL,CAAWqB,eAAxB;AACG,KAAKrB,KAAL,CAAWiB,UADd,CAJF,CARJ,CADF,CADF;;;;;;;AAsBD,CAvBD,IAuBO,OAAO,KAAP;AACR,C,0CA/F0B,IAAVH,OAAU,oCACzB,KAAKkB,aAAL,CAAmBC,KAAnB,CAAyBC,SAAzB,CAAmC,CAAEpB,aAAF,CAAnC,EACD,C;;;AAgGHhB,eAAeqC,SAAf;;AAEEf,MAAO,oBAAUgB,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,sBAAuB;AAC3B,2BAD2B;AAE3B,EAF2B;;AAI3B1C,cAJ2B,CAA7B,C;;AAMiCA,c,CAAxB0C,oB","file":"ToastContainer.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, Modal, Platform, Animated, ViewPropTypes } from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport { Text } from \"./Text\";\nimport { Button } from \"./Button\";\nimport { ViewNB } from \"./View\";\nimport { Toast } from \"./Toast\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass ToastContainer extends Component {\n constructor(props) {\n super(props);\n this.state = {\n modalVisible: false,\n fadeAnim: new Animated.Value(0)\n };\n }\n static toastInstance;\n static show({ ...config }) {\n this.toastInstance._root.showToast({ config });\n }\n getToastStyle() {\n return {\n position: \"absolute\",\n opacity: this.state.fadeAnim,\n width: \"100%\",\n elevation: 9,\n paddingHorizontal: Platform.OS === \"ios\" ? 20 : 0,\n top: this.state.position === \"top\" ? this.getTop() : undefined,\n bottom: this.state.position === \"bottom\" ? this.getTop() : undefined\n };\n }\n getTop() {\n if (Platform.OS === \"ios\") {\n return 30;\n } else {\n return 0;\n }\n }\n showToast({ config }) {\n this.setState({\n modalVisible: true,\n text: config.text,\n buttonText: config.buttonText,\n type: config.type,\n position: config.position ? config.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 (config.duration > 0) {\n setTimeout(() => {\n Animated.timing(this.state.fadeAnim, {\n toValue: 0,\n duration: 200\n }).start();\n setTimeout(() => {\n this.setState({\n modalVisible: false\n });\n }, 500);\n }, config.duration);\n }\n Animated.timing(this.state.fadeAnim, {\n toValue: 1,\n duration: 200\n }).start();\n }\n closeToast() {\n const { onClose } = this.state;\n\n if (onClose && typeof onClose === \"function\") {\n onClose();\n }\n\n Animated.timing(this.state.fadeAnim, {\n toValue: 0,\n duration: 200\n }).start();\n setTimeout(() => {\n this.setState({\n modalVisible: false\n });\n }, 500);\n }\n render() {\n if (this.state.modalVisible) {\n return (\n \n \n {this.state.text}\n {this.state.buttonText && (\n this.closeToast()}\n >\n \n {this.state.buttonText}\n \n \n )}\n \n \n );\n } else return null;\n }\n}\n\nToastContainer.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\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/basic/View.js b/dist/src/basic/View.js index 3c834fee9..970ebeae4 100644 --- a/dist/src/basic/View.js +++ b/dist/src/basic/View.js @@ -1,21 +1,28 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.ViewNB=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n\t}\n}\n\nViewNB.propTypes = {\n\t...ViewPropTypes,\n\tstyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),\n};\n\nconst StyledViewNB = connectStyle(\"NativeBase.ViewNB\", {}, mapPropsToStyleNames)(ViewNB);\nexport { StyledViewNB as ViewNB };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/View.js"],"names":["ViewNB","_root","c","props","propTypes","style","oneOfType","object","number","array","StyledViewNB"],"mappings":"q1BAAA,4B;AACA,qC;AACA;AACA;AACA,mE;;AAEMA,M;AACK;AACP,MAAO,2DAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaC,CAAnB,EAAX,EAAsC,KAAKC,KAA3C,kDAAP;AACD,C;;;AAGHH,OAAOI,SAAP;;AAEEC,MAAO,oBAAUC,SAAV,CAAoB;AACzB,oBAAUC,MADe;AAEzB,oBAAUC,MAFe;AAGzB,oBAAUC,KAHe,CAApB,CAFT;;;;AASA,GAAMC,cAAe;AACnB,mBADmB;AAEnB,EAFmB;;AAInBV,MAJmB,CAArB,C;AAKyBA,M,CAAhBU,Y","file":"View.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, ViewPropTypes } from \"react-native\";\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport mapPropsToStyleNames from \"../Utils/mapPropsToStyleNames\";\n\nclass ViewNB extends Component {\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nViewNB.propTypes = {\n ...ViewPropTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ])\n};\n\nconst StyledViewNB = connectStyle(\n \"NativeBase.ViewNB\",\n {},\n mapPropsToStyleNames\n)(ViewNB);\nexport { StyledViewNB as ViewNB };\n"]} \ No newline at end of file diff --git a/src/basic/Actionsheet.js b/src/basic/Actionsheet.js index a4aa12d78..4d1981019 100644 --- a/src/basic/Actionsheet.js +++ b/src/basic/Actionsheet.js @@ -1,6 +1,13 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View, Modal, Platform, ActionSheetIOS, TouchableOpacity } from "react-native"; +import { + View, + Modal, + Platform, + ActionSheetIOS, + TouchableOpacity, + ViewPropTypes +} from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import { Text } from "./Text"; import { Button } from "./Button"; @@ -12,139 +19,140 @@ import { Body } from "./Body"; import { List } from "./List"; import { ListItem } from "./ListItem"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; -import { ViewPropTypes } from '../Utils'; class ActionSheetContainer extends Component { - constructor(props) { - super(props); - this.state = { - modalVisible: false, - items: [], - }; - } - static actionsheetInstance; - static show(config, callback) { - this.actionsheetInstance._root.showActionSheet(config, callback); - } - showActionSheet(config, callback) { - if (Platform.OS === "ios") { - if (typeof config.options[0] == "object") { - let options = config.options; - let filtered = options.map(item => { - return item.text; - }); - config.options = filtered; - ActionSheetIOS.showActionSheetWithOptions(config, callback); - } else { - ActionSheetIOS.showActionSheetWithOptions(config, callback); - } - } else { - this.setState({ - items: config.options, - title: config.title, - message: config.message, - destructiveButtonIndex: config.destructiveButtonIndex, - cancelButtonIndex: config.cancelButtonIndex, - modalVisible: true, - callback: callback, - }); - } - } - componentDidMount() { - if (!this.props.autoHide && this.props.duration) { - console.warn(`It's not recommended to set autoHide false with duration`); - } - } - render() { - return ( - { - this.state.callback(-1); - this.setState({ modalVisible: false }); - }} - > - { - this.state.callback(-1); - this.setState({ modalVisible: false }); - }} - style={{ - backgroundColor: "rgba(0,0,0,0.4)", - flex: 1, - justifyContent: "flex-end", - }} - > - - - {this.state.title} - - { - return typeof this.state.items[0] === "string" - ? { - this.state.callback(id); - this.setState({ modalVisible: false }); - }} - style={{ borderColor: "transparent" }} - > - - {data} - - - : { - this.state.callback(id); - this.setState({ modalVisible: false }); - }} - style={{ borderColor: "transparent" }} - icon - > - - - - - - {data.text} - - - - ; - }} - /> - - - - ); - } + constructor(props) { + super(props); + this.state = { + modalVisible: false, + items: [] + }; + } + static actionsheetInstance; + static show(config, callback) { + this.actionsheetInstance._root.showActionSheet(config, callback); + } + showActionSheet(config, callback) { + if (Platform.OS === "ios") { + if (typeof config.options[0] == "object") { + let options = config.options; + let filtered = options.map(item => { + return item.text; + }); + config.options = filtered; + ActionSheetIOS.showActionSheetWithOptions(config, callback); + } else { + ActionSheetIOS.showActionSheetWithOptions(config, callback); + } + } else { + this.setState({ + items: config.options, + title: config.title, + message: config.message, + destructiveButtonIndex: config.destructiveButtonIndex, + cancelButtonIndex: config.cancelButtonIndex, + modalVisible: true, + callback: callback + }); + } + } + componentDidMount() { + if (!this.props.autoHide && this.props.duration) { + console.warn(`It's not recommended to set autoHide false with duration`); + } + } + render() { + return ( + { + this.state.callback(-1); + this.setState({ modalVisible: false }); + }} + > + { + this.state.callback(-1); + this.setState({ modalVisible: false }); + }} + style={{ + backgroundColor: "rgba(0,0,0,0.4)", + flex: 1, + justifyContent: "flex-end" + }} + > + + {this.state.title} + { + return typeof this.state.items[0] === "string" ? ( + { + this.state.callback(id); + this.setState({ modalVisible: false }); + }} + style={{ borderColor: "transparent" }} + > + {data} + + ) : ( + { + this.state.callback(id); + this.setState({ modalVisible: false }); + }} + style={{ borderColor: "transparent" }} + icon + > + + + + + {data.text} + + + + ); + }} + /> + + + + ); + } } ActionSheetContainer.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledActionSheetContainer = connectStyle("NativeBase.ActionSheetContainer", {}, mapPropsToStyleNames)( - ActionSheetContainer -); +const StyledActionSheetContainer = connectStyle( + "NativeBase.ActionSheetContainer", + {}, + mapPropsToStyleNames +)(ActionSheetContainer); export { StyledActionSheetContainer as ActionSheetContainer }; diff --git a/src/basic/Badge.js b/src/basic/Badge.js index dd0697ed0..544ceceae 100644 --- a/src/basic/Badge.js +++ b/src/basic/Badge.js @@ -1,27 +1,32 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import variables from "../theme/variables/platform"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Badge extends Component { - render() { - return ( - (this._root = c)} {...this.props}> - {this.props.children} - - ); - } + render() { + return ( + (this._root = c)} {...this.props}> + {this.props.children} + + ); + } } Badge.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledBadge = connectStyle("NativeBase.Badge", {}, mapPropsToStyleNames)(Badge); +const StyledBadge = connectStyle("NativeBase.Badge", {}, mapPropsToStyleNames)( + Badge +); export { StyledBadge as Badge }; diff --git a/src/basic/Body.js b/src/basic/Body.js index ad7d3c5d9..3f6479b5b 100644 --- a/src/basic/Body.js +++ b/src/basic/Body.js @@ -1,22 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Body extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Body.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledBody = connectStyle("NativeBase.Body", {}, mapPropsToStyleNames)(Body); +const StyledBody = connectStyle("NativeBase.Body", {}, mapPropsToStyleNames)( + Body +); export { StyledBody as Body }; diff --git a/src/basic/Card.js b/src/basic/Card.js index 48062a996..943a57165 100644 --- a/src/basic/Card.js +++ b/src/basic/Card.js @@ -1,42 +1,47 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View, ListView } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ListView, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Card extends Component { - render() { - if (this.props.dataArray && this.props.renderRow) { - const ds = new ListView.DataSource({ - rowHasChanged: (r1, r2) => r1 !== r2, - }); - const dataSource = ds.cloneWithRows(this.props.dataArray); - return ( - - ); - } - return ( - (this._root = c)} {...this.props}> - {this.props.children} - - ); - } + render() { + if (this.props.dataArray && this.props.renderRow) { + const ds = new ListView.DataSource({ + rowHasChanged: (r1, r2) => r1 !== r2 + }); + const dataSource = ds.cloneWithRows(this.props.dataArray); + return ( + + ); + } + return ( + (this._root = c)} {...this.props}> + {this.props.children} + + ); + } } Card.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), - dataArray: PropTypes.array, - renderRow: PropTypes.func, + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]), + dataArray: PropTypes.array, + renderRow: PropTypes.func }; -const StyledCard = connectStyle("NativeBase.Card", {}, mapPropsToStyleNames)(Card); +const StyledCard = connectStyle("NativeBase.Card", {}, mapPropsToStyleNames)( + Card +); export { StyledCard as Card }; diff --git a/src/basic/DeckSwiper.js b/src/basic/DeckSwiper.js index 55714c4ca..ac7d3eab3 100644 --- a/src/basic/DeckSwiper.js +++ b/src/basic/DeckSwiper.js @@ -1,321 +1,343 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View, Animated, PanResponder } from "react-native"; +import { View, Animated, PanResponder, ViewPropTypes } from "react-native"; import clamp from "clamp"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; -import { ViewPropTypes } from '../Utils'; const SWIPE_THRESHOLD = 120; class DeckSwiper extends Component { - constructor(props) { - super(props); - this.state = { - pan: new Animated.ValueXY(), - pan2: new Animated.ValueXY(), - enter: new Animated.Value(0.8), - selectedItem: this.props.dataSource[0], - selectedItem2: this.props.dataSource[1], - card1Top: true, - card2Top: false, - fadeAnim: new Animated.Value(0.8), - looping: typeof this.props.looping === "undefined" ? true : this.props.looping, - disabled: this.props.dataSource.length === 0, - lastCard: this.props.dataSource.length === 1, - }; - } + constructor(props) { + super(props); + this.state = { + pan: new Animated.ValueXY(), + pan2: new Animated.ValueXY(), + enter: new Animated.Value(0.8), + selectedItem: this.props.dataSource[0], + selectedItem2: this.props.dataSource[1], + card1Top: true, + card2Top: false, + fadeAnim: new Animated.Value(0.8), + looping: + typeof this.props.looping === "undefined" ? true : this.props.looping, + disabled: this.props.dataSource.length === 0, + lastCard: this.props.dataSource.length === 1 + }; + } - componentWillReceiveProps({ dataSource }) { - if (dataSource.length !== this.props.dataSource.length) { - if (dataSource.length <= 1) { - this.setState({ - ...this.state, - selectedItem: dataSource[0], - selectedItem2: undefined, - disabled: dataSource.length === 0, - lastCard: dataSource.length === 1, - }); - return; - } + componentWillReceiveProps({ dataSource }) { + if (dataSource.length !== this.props.dataSource.length) { + if (dataSource.length <= 1) { + this.setState({ + ...this.state, + selectedItem: dataSource[0], + selectedItem2: undefined, + disabled: dataSource.length === 0, + lastCard: dataSource.length === 1 + }); + return; + } - const visibleIndex = dataSource.indexOf(this.state.selectedItem); - const currentIndex = visibleIndex < 0 ? visibleIndex + 1 : visibleIndex; - const nextIndex = currentIndex + 1 === dataSource.length ? 0 : currentIndex + 1; + const visibleIndex = dataSource.indexOf(this.state.selectedItem); + const currentIndex = visibleIndex < 0 ? visibleIndex + 1 : visibleIndex; + const nextIndex = + currentIndex + 1 === dataSource.length ? 0 : currentIndex + 1; - this.setState({ - selectedItem: dataSource[currentIndex], - selectedItem2: dataSource[nextIndex], - }); - } - } + this.setState({ + selectedItem: dataSource[currentIndex], + selectedItem2: dataSource[nextIndex] + }); + } + } - getInitialStyle() { - return { - topCard: { - position: "absolute", - top: 0, - right: 0, - left: 0, - }, - }; - } + getInitialStyle() { + return { + topCard: { + position: "absolute", + top: 0, + right: 0, + left: 0 + } + }; + } - findNextIndexes(currentIndex) { - const newIdx = currentIndex + 1; - const newIdx2 = currentIndex + 2; + findNextIndexes(currentIndex) { + const newIdx = currentIndex + 1; + const 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]; - } + 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]; + } - selectNext() { - const dataSource = this.props.dataSource; - const currentIndex = dataSource.indexOf(this.state.selectedItem); + selectNext() { + const dataSource = this.props.dataSource; + const currentIndex = dataSource.indexOf(this.state.selectedItem); - // if not looping, check for these conditionals and if true return from selectNext() - if (!this.state.looping) { - // reached end -> only display static renderEmpty() -> no swiping - if (currentIndex === dataSource.length - 1) { - return this.setState({ - disabled: true, - }); - } else if (currentIndex === dataSource.length - 2) { - // show last card with renderEmpty() component behind it - return setTimeout(() => { - this.setState({ - selectedItem: dataSource[currentIndex + 1], - }); - setTimeout(() => { - this.setState({ - lastCard: true, - }); - }, 350); - }, 50); - } - } + // if not looping, check for these conditionals and if true return from selectNext() + if (!this.state.looping) { + // reached end -> only display static renderEmpty() -> no swiping + if (currentIndex === dataSource.length - 1) { + return this.setState({ + disabled: true + }); + } else if (currentIndex === dataSource.length - 2) { + // show last card with renderEmpty() component behind it + return setTimeout(() => { + this.setState({ + selectedItem: dataSource[currentIndex + 1] + }); + setTimeout(() => { + this.setState({ + lastCard: true + }); + }, 350); + }, 50); + } + } - const nextIndexes = this.findNextIndexes(currentIndex); - setTimeout(() => { - this.setState({ - selectedItem: this.props.dataSource[nextIndexes[0]], - }); - setTimeout(() => { - this.setState({ - selectedItem2: this.props.dataSource[nextIndexes[1]], - }); - }, 350); - }, 50); - } + const nextIndexes = this.findNextIndexes(currentIndex); + setTimeout(() => { + this.setState({ + selectedItem: this.props.dataSource[nextIndexes[0]] + }); + setTimeout(() => { + this.setState({ + selectedItem2: this.props.dataSource[nextIndexes[1]] + }); + }, 350); + }, 50); + } - swipeRight() { - if (this.props.onSwiping) this.props.onSwiping("right"); - setTimeout(() => { - Animated.timing(this.state.fadeAnim, { toValue: 1 }).start(); - Animated.spring(this.state.enter, { toValue: 1, friction: 7 }).start(); - this.selectNext(); - Animated.decay(this.state.pan, { - velocity: { x: 8, y: 1 }, - deceleration: 0.98, - }).start(this._resetState.bind(this)); - }, 300); - } + swipeRight() { + if (this.props.onSwiping) this.props.onSwiping("right"); + setTimeout(() => { + Animated.timing(this.state.fadeAnim, { toValue: 1 }).start(); + Animated.spring(this.state.enter, { toValue: 1, friction: 7 }).start(); + this.selectNext(); + Animated.decay(this.state.pan, { + velocity: { x: 8, y: 1 }, + deceleration: 0.98 + }).start(this._resetState.bind(this)); + }, 300); + } - swipeLeft() { - if (this.props.onSwiping) this.props.onSwiping("left"); - setTimeout(() => { - Animated.timing(this.state.fadeAnim, { toValue: 1 }).start(); - Animated.spring(this.state.enter, { toValue: 1, friction: 7 }).start(); - this.selectNext(); - Animated.decay(this.state.pan, { - velocity: { x: -8, y: 1 }, - deceleration: 0.98, - }).start(this._resetState.bind(this)); - }, 300); - } + swipeLeft() { + if (this.props.onSwiping) this.props.onSwiping("left"); + setTimeout(() => { + Animated.timing(this.state.fadeAnim, { toValue: 1 }).start(); + Animated.spring(this.state.enter, { toValue: 1, friction: 7 }).start(); + this.selectNext(); + Animated.decay(this.state.pan, { + velocity: { x: -8, y: 1 }, + deceleration: 0.98 + }).start(this._resetState.bind(this)); + }, 300); + } - componentWillMount() { - this._panResponder = PanResponder.create({ - onMoveShouldSetResponderCapture: () => true, - onMoveShouldSetPanResponderCapture: (evt, gestureState) => Math.abs(gestureState.dx) > 5, + componentWillMount() { + this._panResponder = PanResponder.create({ + onMoveShouldSetResponderCapture: () => true, + onMoveShouldSetPanResponderCapture: (evt, gestureState) => + Math.abs(gestureState.dx) > 5, - onPanResponderGrant: (e, gestureState) => { - this.state.pan.setOffset({ - x: this.state.pan.x._value, - y: this.state.pan.y._value, - }); - this.state.pan.setValue({ x: 0, y: 0 }); - }, + onPanResponderGrant: (e, gestureState) => { + this.state.pan.setOffset({ + x: this.state.pan.x._value, + y: this.state.pan.y._value + }); + this.state.pan.setValue({ x: 0, y: 0 }); + }, - onPanResponderMove: (e, gestureState) => { - if (gestureState.dx > 20) { - if (this.props.onSwiping) this.props.onSwiping("right", gestureState.dx); - } else if (gestureState.dx < -20) { - if (this.props.onSwiping) this.props.onSwiping("left", gestureState.dx); - } - let val = Math.abs(gestureState.dx * 0.0013); - const opa = Math.abs(gestureState.dx * 0.0022); - if (val > 0.2) { - val = 0.2; - } - Animated.timing(this.state.fadeAnim, { toValue: 0.8 + val }).start(); - Animated.spring(this.state.enter, { - toValue: 0.8 + val, - friction: 7, - }).start(); - Animated.event([null, { dx: this.state.pan.x }])(e, gestureState); - }, + onPanResponderMove: (e, gestureState) => { + if (gestureState.dx > 20) { + if (this.props.onSwiping) + this.props.onSwiping("right", gestureState.dx); + } else if (gestureState.dx < -20) { + if (this.props.onSwiping) + this.props.onSwiping("left", gestureState.dx); + } + let val = Math.abs(gestureState.dx * 0.0013); + const opa = Math.abs(gestureState.dx * 0.0022); + if (val > 0.2) { + val = 0.2; + } + Animated.timing(this.state.fadeAnim, { toValue: 0.8 + val }).start(); + Animated.spring(this.state.enter, { + toValue: 0.8 + val, + friction: 7 + }).start(); + Animated.event([null, { dx: this.state.pan.x }])(e, gestureState); + }, - onPanResponderRelease: (e, { vx, vy }) => { - if (this.props.onSwiping) this.props.onSwiping(null); - let velocity; + onPanResponderRelease: (e, { vx, vy }) => { + if (this.props.onSwiping) this.props.onSwiping(null); + let velocity; - if (vx >= 0) { - velocity = clamp(vx, 4.5, 10); - } else if (vx < 0) { - velocity = clamp(vx * -1, 4.5, 10) * -1; - } + if (vx >= 0) { + velocity = clamp(vx, 4.5, 10); + } else if (vx < 0) { + velocity = clamp(vx * -1, 4.5, 10) * -1; + } - if (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) { - if (velocity > 0) { - this.props.onSwipeRight ? this.props.onSwipeRight(this.state.selectedItem) : undefined; - this.selectNext(); - } else { - this.props.onSwipeLeft ? this.props.onSwipeLeft(this.state.selectedItem) : undefined; - this.selectNext(); - } + if (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) { + if (velocity > 0) { + this.props.onSwipeRight + ? this.props.onSwipeRight(this.state.selectedItem) + : undefined; + this.selectNext(); + } else { + this.props.onSwipeLeft + ? this.props.onSwipeLeft(this.state.selectedItem) + : undefined; + this.selectNext(); + } - Animated.decay(this.state.pan, { - velocity: { x: velocity, y: vy }, - deceleration: 0.98, - }).start(this._resetState.bind(this)); - } else { - Animated.spring(this.state.pan, { - toValue: { x: 0, y: 0 }, - friction: 4, - }).start(); - } - }, - }); - } + Animated.decay(this.state.pan, { + velocity: { x: velocity, y: vy }, + deceleration: 0.98 + }).start(this._resetState.bind(this)); + } else { + Animated.spring(this.state.pan, { + toValue: { x: 0, y: 0 }, + friction: 4 + }).start(); + } + } + }); + } - _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); - } + _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); + } - getCardStyles() { - const { pan, pan2, enter } = this.state; + getCardStyles() { + const { pan, pan2, enter } = this.state; - const [translateX, translateY] = [pan.x, pan.y]; - // let [translateX, translateY] = [pan2.x, pan2.y]; + const [translateX, translateY] = [pan.x, pan.y]; + // let [translateX, translateY] = [pan2.x, pan2.y]; - const rotate = pan.x.interpolate({ - inputRange: [-700, 0, 700], - outputRange: ["-10deg", "0deg", "10deg"], - }); + const rotate = pan.x.interpolate({ + inputRange: [-700, 0, 700], + outputRange: ["-10deg", "0deg", "10deg"] + }); - const opacity = pan.x.interpolate({ - inputRange: [-320, 0, 320], - outputRange: [0.9, 1, 0.9], - }); - const scale = enter; + const opacity = pan.x.interpolate({ + inputRange: [-320, 0, 320], + outputRange: [0.9, 1, 0.9] + }); + const scale = enter; - const animatedCardStyles = { - transform: [{ translateX }, { translateY }, { rotate }], - opacity, - }; - const animatedCardStyles2 = { transform: [{ scale }] }; + const animatedCardStyles = { + transform: [{ translateX }, { translateY }, { rotate }], + opacity + }; + const animatedCardStyles2 = { transform: [{ scale }] }; - return [animatedCardStyles, animatedCardStyles2]; - } + return [animatedCardStyles, animatedCardStyles2]; + } - render() { - if (this.state.disabled) { - // disable swiping and renderEmpty - return ( - - { - - {this.props.renderEmpty && this.props.renderEmpty()} - - } - - ); - } else if (this.state.lastCard) { - // display renderEmpty underneath last viable card - return ( - - {this.state.selectedItem === undefined - ? - : - - {this.props.renderEmpty && this.props.renderEmpty()} - - - {this.props.renderItem(this.state.selectedItem)} - - } - - ); - } - return ( - - {this.state.selectedItem === undefined - ? - : - - {this.props.renderBottom - ? this.props.renderBottom(this.state.selectedItem2) - : this.props.renderItem(this.state.selectedItem2)} - - - {this.props.renderTop - ? this.props.renderTop(this.state.selectedItem) - : this.props.renderItem(this.state.selectedItem)} - - } - - ); - } + render() { + if (this.state.disabled) { + // disable swiping and renderEmpty + return ( + + {{this.props.renderEmpty && this.props.renderEmpty()}} + + ); + } else if (this.state.lastCard) { + // display renderEmpty underneath last viable card + return ( + + {this.state.selectedItem === undefined ? ( + + ) : ( + + + {this.props.renderEmpty && this.props.renderEmpty()} + + + {this.props.renderItem(this.state.selectedItem)} + + + )} + + ); + } + return ( + + {this.state.selectedItem === undefined ? ( + + ) : ( + + + {this.props.renderBottom + ? this.props.renderBottom(this.state.selectedItem2) + : this.props.renderItem(this.state.selectedItem2)} + + + {this.props.renderTop + ? this.props.renderTop(this.state.selectedItem) + : this.props.renderItem(this.state.selectedItem)} + + + )} + + ); + } } DeckSwiper.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), - dataSource: PropTypes.array, + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]), + dataSource: PropTypes.array }; -const StyledDeckSwiper = connectStyle("NativeBase.DeckSwiper", {}, mapPropsToStyleNames)(DeckSwiper); +const StyledDeckSwiper = connectStyle( + "NativeBase.DeckSwiper", + {}, + mapPropsToStyleNames +)(DeckSwiper); export { StyledDeckSwiper as DeckSwiper }; diff --git a/src/basic/Footer.js b/src/basic/Footer.js index ae36a831f..09202bc1d 100644 --- a/src/basic/Footer.js +++ b/src/basic/Footer.js @@ -1,21 +1,28 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; +import { View, ViewPropTypes } from "react-native"; import _ from "lodash"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; -import { ViewPropTypes } from '../Utils'; class Footer extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Footer.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledFooter = connectStyle("NativeBase.Footer", {}, mapPropsToStyleNames)(Footer); +const StyledFooter = connectStyle( + "NativeBase.Footer", + {}, + mapPropsToStyleNames +)(Footer); export { StyledFooter as Footer }; diff --git a/src/basic/FooterTab.js b/src/basic/FooterTab.js index d30be0ae7..663483c29 100644 --- a/src/basic/FooterTab.js +++ b/src/basic/FooterTab.js @@ -1,26 +1,33 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class FooterTab extends Component { - render() { - return ( - (this._root = c)} {...this.props}> - {this.props.children} - - ); - } + render() { + return ( + (this._root = c)} {...this.props}> + {this.props.children} + + ); + } } FooterTab.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledFooterTab = connectStyle("NativeBase.FooterTab", {}, mapPropsToStyleNames)(FooterTab); +const StyledFooterTab = connectStyle( + "NativeBase.FooterTab", + {}, + mapPropsToStyleNames +)(FooterTab); export { StyledFooterTab as FooterTab }; diff --git a/src/basic/Form.js b/src/basic/Form.js index f5ad67aad..3a400dd87 100644 --- a/src/basic/Form.js +++ b/src/basic/Form.js @@ -1,22 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Form extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Form.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledForm = connectStyle("NativeBase.Form", {}, mapPropsToStyleNames)(Form); +const StyledForm = connectStyle("NativeBase.Form", {}, mapPropsToStyleNames)( + Form +); export { StyledForm as Form }; diff --git a/src/basic/Header.js b/src/basic/Header.js index 1a443a72c..4a8b29c0e 100644 --- a/src/basic/Header.js +++ b/src/basic/Header.js @@ -1,45 +1,58 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View, StatusBar } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, StatusBar, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; import variable from "../theme/variables/platform"; import _ from "lodash"; class Header extends Component { - static contextTypes = { - theme: PropTypes.object, - }; + static contextTypes = { + theme: PropTypes.object + }; - render() { - const variables = this.context.theme ? this.context.theme["@@shoutem.theme/themeStyle"].variables : variable; - const platformStyle = variables.platformStyle; + render() { + const variables = this.context.theme + ? this.context.theme["@@shoutem.theme/themeStyle"].variables + : variable; + const platformStyle = variables.platformStyle; - return ( - - - (this._root = c)} {...this.props} /> - - ); - } + return ( + + + (this._root = c)} {...this.props} /> + + ); + } } Header.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), - searchBar: PropTypes.bool, - rounded: PropTypes.bool, + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]), + searchBar: PropTypes.bool, + rounded: PropTypes.bool }; -const StyledHeader = connectStyle("NativeBase.Header", {}, mapPropsToStyleNames)(Header); +const StyledHeader = connectStyle( + "NativeBase.Header", + {}, + mapPropsToStyleNames +)(Header); export { StyledHeader as Header }; diff --git a/src/basic/InputGroup.js b/src/basic/InputGroup.js index 09e86dbab..fdf5e3ea6 100644 --- a/src/basic/InputGroup.js +++ b/src/basic/InputGroup.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import variables from "../theme/variables/platform"; import { connectStyle } from "native-base-shoutem-theme"; @@ -9,41 +8,47 @@ import computeProps from "../Utils/computeProps"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class InputGroup extends Component { - getInitialStyle() { - return { - roundedInputGroup: { - borderWidth: this.props.rounded ? 1 : undefined, - borderRadius: this.props.rounded ? variables.inputGroupRoundedBorderRadius : undefined, - }, - }; - } + getInitialStyle() { + return { + roundedInputGroup: { + borderWidth: this.props.rounded ? 1 : undefined, + borderRadius: this.props.rounded + ? variables.inputGroupRoundedBorderRadius + : undefined + } + }; + } - prepareRootProps() { - const defaultProps = { - style: this.getInitialStyle().roundedInputGroup, - }; + prepareRootProps() { + const defaultProps = { + style: this.getInitialStyle().roundedInputGroup + }; - return computeProps(this.props, defaultProps); - } - render() { - return ( - (this._root = c)} {...this.prepareRootProps()}> - {this.props.children} - - ); - } + return computeProps(this.props, defaultProps); + } + render() { + return ( + (this._root = c)} {...this.prepareRootProps()}> + {this.props.children} + + ); + } } InputGroup.propTypes = { - ...ViewPropTypes, - regular: PropTypes.bool, - underline: PropTypes.bool, - rounded: PropTypes.bool, - success: PropTypes.bool, - error: PropTypes.bool, - disabled: PropTypes.bool, + ...ViewPropTypes, + regular: PropTypes.bool, + underline: PropTypes.bool, + rounded: PropTypes.bool, + success: PropTypes.bool, + error: PropTypes.bool, + disabled: PropTypes.bool }; -const StyledInputGroup = connectStyle("NativeBase.InputGroup", {}, mapPropsToStyleNames)(InputGroup); +const StyledInputGroup = connectStyle( + "NativeBase.InputGroup", + {}, + mapPropsToStyleNames +)(InputGroup); export { StyledInputGroup as InputGroup }; diff --git a/src/basic/Left.js b/src/basic/Left.js index 9a7a800c0..0321a59b4 100644 --- a/src/basic/Left.js +++ b/src/basic/Left.js @@ -1,22 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Left extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Left.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledLeft = connectStyle("NativeBase.Left", {}, mapPropsToStyleNames)(Left); +const StyledLeft = connectStyle("NativeBase.Left", {}, mapPropsToStyleNames)( + Left +); export { StyledLeft as Left }; diff --git a/src/basic/Picker.ios.js b/src/basic/Picker.ios.js index 4474c8973..824723da0 100644 --- a/src/basic/Picker.ios.js +++ b/src/basic/Picker.ios.js @@ -1,8 +1,7 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; import createReactClass from "create-react-class"; -import { Picker, Modal, View, ListView } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { Picker, Modal, View, ListView, ViewPropTypes } from "react-native"; import _ from "lodash"; import { Text } from "./Text"; import { List } from "./List"; @@ -23,186 +22,214 @@ import computeProps from "../Utils/computeProps"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class PickerNB extends Component { - constructor(props) { - super(props); - this.state = { - modalVisible: false, - currentLabel: this.getLabel(props), - dataSource: props.children, - }; - } - - componentWillReceiveProps(nextProps) { - const currentLabel = this.state.currentLabel; - const nextLabel = this.getLabel(nextProps); - const currentDS = this.state.dataSource; - const nextDS = nextProps.children; - - if (currentLabel !== nextLabel) { - this.setState({ - currentLabel: nextLabel, - }); - } - if (currentDS !== nextDS) { - this.setState({ - dataSource: nextDS, - }); - } - } - - getInitialStyle() { - return { - picker: { - // alignItems: 'flex-end' - }, - pickerItem: {}, - }; - } - _setModalVisible(visible) { - this.setState({ modalVisible: visible }); - } - - prepareRootProps() { - const defaultProps = { - style: this.getInitialStyle().picker, - itemStyle: this.getInitialStyle().pickerItem, - }; - - return computeProps(this.props, defaultProps); - } - - getLabel(props) { - const item = _.find(props.children, child => child.props.value === props.selectedValue); - return _.get(item, "props.label"); - } - - getSelectedItem() { - return _.find(this.props.children, child => child.props.value === this.props.selectedValue); - } - - renderIcon() { - return React.cloneElement(this.props.iosIcon, { - style: { fontSize: 22, lineHeight: 26, color: "#7a7a7a" }, - }); - } - - renderButton() { - const onPress = () => { - this._setModalVisible(true); - }; - const text = this.state.currentLabel ? this.state.currentLabel : this.props.placeholder; - if (this.props.renderButton) { - return this.props.renderButton({ - onPress, - text, - picker: this, - selectedItem: this.getSelectedItem(), - }); - } - return ( - - ); - } - - renderHeader() { - return this.props.renderHeader - ? this.props.renderHeader(() => this._setModalVisible(false)) - :
- - - - - - {this.props.iosHeader || "Select One"} - - - -
; - } - - render() { - return ( - (this._root = c)}> - {this.renderButton()} - { - this._setModalVisible(false); - }} - > - - {this.renderHeader()} - - - { - this._setModalVisible(false); - this.props.onValueChange(child.props.value); - this.setState({ current: child.props.label }); - }} - > - - {child.props.label} - - - {child.props.value === this.props.selectedValue - ? - : } - - } - /> - - - - - ); - } + constructor(props) { + super(props); + this.state = { + modalVisible: false, + currentLabel: this.getLabel(props), + dataSource: props.children + }; + } + + componentWillReceiveProps(nextProps) { + const currentLabel = this.state.currentLabel; + const nextLabel = this.getLabel(nextProps); + const currentDS = this.state.dataSource; + const nextDS = nextProps.children; + + if (currentLabel !== nextLabel) { + this.setState({ + currentLabel: nextLabel + }); + } + if (currentDS !== nextDS) { + this.setState({ + dataSource: nextDS + }); + } + } + + getInitialStyle() { + return { + picker: { + // alignItems: 'flex-end' + }, + pickerItem: {} + }; + } + _setModalVisible(visible) { + this.setState({ modalVisible: visible }); + } + + prepareRootProps() { + const defaultProps = { + style: this.getInitialStyle().picker, + itemStyle: this.getInitialStyle().pickerItem + }; + + return computeProps(this.props, defaultProps); + } + + getLabel(props) { + const item = _.find( + props.children, + child => child.props.value === props.selectedValue + ); + return _.get(item, "props.label"); + } + + getSelectedItem() { + return _.find( + this.props.children, + child => child.props.value === this.props.selectedValue + ); + } + + renderIcon() { + return React.cloneElement(this.props.iosIcon, { + style: { fontSize: 22, lineHeight: 26, color: "#7a7a7a" } + }); + } + + renderButton() { + const onPress = () => { + this._setModalVisible(true); + }; + const text = this.state.currentLabel + ? this.state.currentLabel + : this.props.placeholder; + if (this.props.renderButton) { + return this.props.renderButton({ + onPress, + text, + picker: this, + selectedItem: this.getSelectedItem() + }); + } + return ( + + ); + } + + renderHeader() { + return this.props.renderHeader ? ( + this.props.renderHeader(() => this._setModalVisible(false)) + ) : ( +
+ + + + + + {this.props.iosHeader || "Select One"} + + + +
+ ); + } + + render() { + return ( + (this._root = c)}> + {this.renderButton()} + { + this._setModalVisible(false); + }} + > + + {this.renderHeader()} + + ( + { + this._setModalVisible(false); + this.props.onValueChange(child.props.value); + this.setState({ current: child.props.label }); + }} + > + + {child.props.label} + + + {child.props.value === this.props.selectedValue ? ( + + ) : ( + + )} + + + )} + /> + + + + + ); + } } PickerNB.Item = createReactClass({ - render() { - return ; - }, + render() { + return ; + } }); PickerNB.propTypes = { - ...ViewPropTypes, - renderButton: PropTypes.func, + ...ViewPropTypes, + renderButton: PropTypes.func }; -const StyledPickerNB = connectStyle("NativeBase.PickerNB", {}, mapPropsToStyleNames)(PickerNB); +const StyledPickerNB = connectStyle( + "NativeBase.PickerNB", + {}, + mapPropsToStyleNames +)(PickerNB); export { StyledPickerNB as PickerNB }; diff --git a/src/basic/Right.js b/src/basic/Right.js index 82e1c9d37..293794b99 100644 --- a/src/basic/Right.js +++ b/src/basic/Right.js @@ -1,22 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Right extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Right.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledRight = connectStyle("NativeBase.Right", {}, mapPropsToStyleNames)(Right); +const StyledRight = connectStyle("NativeBase.Right", {}, mapPropsToStyleNames)( + Right +); export { StyledRight as Right }; diff --git a/src/basic/Root.js b/src/basic/Root.js index ec027be22..1a93b62ac 100644 --- a/src/basic/Root.js +++ b/src/basic/Root.js @@ -1,6 +1,5 @@ import React, { Component } from "react"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import PropTypes from "prop-types"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; @@ -9,30 +8,37 @@ import { ActionSheetContainer as ActionSheet } from "./Actionsheet"; import { Text } from "./Text"; class Root extends Component { - render() { - return ( - (this._root = c)} {...this.props} style={{ flex: 1 }}> - {this.props.children} - { - if (!Toast.toastInstance) Toast.toastInstance = c; - }} - /> - { - if (!ActionSheet.actionsheetInstance) ActionSheet.actionsheetInstance = c; - }} - /> - - ); - } + render() { + return ( + (this._root = c)} {...this.props} style={{ flex: 1 }}> + {this.props.children} + { + if (!Toast.toastInstance) Toast.toastInstance = c; + }} + /> + { + if (!ActionSheet.actionsheetInstance) + ActionSheet.actionsheetInstance = c; + }} + /> + + ); + } } Root.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledRoot = connectStyle("NativeBase.Root", {}, mapPropsToStyleNames)(Root); +const StyledRoot = connectStyle("NativeBase.Root", {}, mapPropsToStyleNames)( + Root +); export { StyledRoot as Root }; diff --git a/src/basic/Segment.js b/src/basic/Segment.js index 120044587..e92def418 100644 --- a/src/basic/Segment.js +++ b/src/basic/Segment.js @@ -1,20 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Segment extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Segment.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledSegment = connectStyle("NativeBase.Segment", {}, mapPropsToStyleNames)(Segment); +const StyledSegment = connectStyle( + "NativeBase.Segment", + {}, + mapPropsToStyleNames +)(Segment); export { StyledSegment as Segment }; diff --git a/src/basic/Separator.js b/src/basic/Separator.js index 5afb7f304..2192d64cf 100644 --- a/src/basic/Separator.js +++ b/src/basic/Separator.js @@ -1,22 +1,29 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Separator extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Separator.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledSeparator = connectStyle("NativeBase.Separator", {}, mapPropsToStyleNames)(Separator); +const StyledSeparator = connectStyle( + "NativeBase.Separator", + {}, + mapPropsToStyleNames +)(Separator); export { StyledSeparator as Separator }; diff --git a/src/basic/Tab.js b/src/basic/Tab.js index 8123e545e..a865e39c9 100644 --- a/src/basic/Tab.js +++ b/src/basic/Tab.js @@ -1,24 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Tab extends Component { - render() { - return ( - (this._root = c)} {...this.props}> - {this.props.children} - - ); - } + render() { + return ( + (this._root = c)} {...this.props}> + {this.props.children} + + ); + } } Tab.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; const StyledTab = connectStyle("NativeBase.Tab", {}, mapPropsToStyleNames)(Tab); diff --git a/src/basic/TabContainer.js b/src/basic/TabContainer.js index 753618a5d..4c3840f04 100644 --- a/src/basic/TabContainer.js +++ b/src/basic/TabContainer.js @@ -1,20 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class TabContainer extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } TabContainer.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledTabContainer = connectStyle("NativeBase.TabContainer", {}, mapPropsToStyleNames)(TabContainer); +const StyledTabContainer = connectStyle( + "NativeBase.TabContainer", + {}, + mapPropsToStyleNames +)(TabContainer); export { StyledTabContainer as TabContainer }; diff --git a/src/basic/TabHeading.js b/src/basic/TabHeading.js index 3936caa60..872909b53 100644 --- a/src/basic/TabHeading.js +++ b/src/basic/TabHeading.js @@ -1,20 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class TabHeadingNB extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } TabHeadingNB.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledTabHeadingNB = connectStyle("NativeBase.TabHeading", {}, mapPropsToStyleNames)(TabHeadingNB); +const StyledTabHeadingNB = connectStyle( + "NativeBase.TabHeading", + {}, + mapPropsToStyleNames +)(TabHeadingNB); export { StyledTabHeadingNB as TabHeading }; diff --git a/src/basic/Toast.js b/src/basic/Toast.js index f8869fdd6..1da81d28d 100644 --- a/src/basic/Toast.js +++ b/src/basic/Toast.js @@ -1,20 +1,25 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class Toast extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } Toast.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledToast = connectStyle("NativeBase.Toast", {}, mapPropsToStyleNames)(Toast); +const StyledToast = connectStyle("NativeBase.Toast", {}, mapPropsToStyleNames)( + Toast +); export { StyledToast as Toast }; diff --git a/src/basic/ToastContainer.js b/src/basic/ToastContainer.js index 99782e211..1c13470fa 100644 --- a/src/basic/ToastContainer.js +++ b/src/basic/ToastContainer.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View, Modal, Platform, Animated } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, Modal, Platform, Animated, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import { Text } from "./Text"; import { Button } from "./Button"; @@ -9,118 +8,126 @@ import { ViewNB } from "./View"; import { Toast } from "./Toast"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; - class ToastContainer extends Component { - constructor(props) { - super(props); - this.state = { - modalVisible: false, - fadeAnim: new Animated.Value(0), - }; - } - static toastInstance; - static show({ ...config }) { - this.toastInstance._root.showToast({ config }); - } - getToastStyle() { - return { - position: "absolute", - opacity: this.state.fadeAnim, - width: "100%", - elevation: 9, - paddingHorizontal: Platform.OS === "ios" ? 20 : 0, - top: this.state.position === "top" ? this.getTop() : undefined, - bottom: this.state.position === "bottom" ? this.getTop() : undefined, - }; - } - getTop() { - if (Platform.OS === "ios") { - return 30; - } else { - return 0; - } - } - showToast({ config }) { - this.setState({ - modalVisible: true, - text: config.text, - buttonText: config.buttonText, - type: config.type, - position: config.position ? config.position : "bottom", - supportedOrientations: config.supportedOrientations, - style: config.style, - buttonTextStyle: config.buttonTextStyle, - buttonStyle: config.buttonStyle, - textStyle: config.textStyle, - onClose: config.onClose - }); - if (config.duration > 0) { - setTimeout(() => { - Animated.timing(this.state.fadeAnim, { - toValue: 0, - duration: 200, - }).start(); - setTimeout(() => { - this.setState({ - modalVisible: false, - }); - }, 500); - }, config.duration); - } - Animated.timing(this.state.fadeAnim, { - toValue: 1, - duration: 200, - }).start(); - } - closeToast() { - const { onClose } = this.state; + constructor(props) { + super(props); + this.state = { + modalVisible: false, + fadeAnim: new Animated.Value(0) + }; + } + static toastInstance; + static show({ ...config }) { + this.toastInstance._root.showToast({ config }); + } + getToastStyle() { + return { + position: "absolute", + opacity: this.state.fadeAnim, + width: "100%", + elevation: 9, + paddingHorizontal: Platform.OS === "ios" ? 20 : 0, + top: this.state.position === "top" ? this.getTop() : undefined, + bottom: this.state.position === "bottom" ? this.getTop() : undefined + }; + } + getTop() { + if (Platform.OS === "ios") { + return 30; + } else { + return 0; + } + } + showToast({ config }) { + this.setState({ + modalVisible: true, + text: config.text, + buttonText: config.buttonText, + type: config.type, + position: config.position ? config.position : "bottom", + supportedOrientations: config.supportedOrientations, + style: config.style, + buttonTextStyle: config.buttonTextStyle, + buttonStyle: config.buttonStyle, + textStyle: config.textStyle, + onClose: config.onClose + }); + if (config.duration > 0) { + setTimeout(() => { + Animated.timing(this.state.fadeAnim, { + toValue: 0, + duration: 200 + }).start(); + setTimeout(() => { + this.setState({ + modalVisible: false + }); + }, 500); + }, config.duration); + } + Animated.timing(this.state.fadeAnim, { + toValue: 1, + duration: 200 + }).start(); + } + closeToast() { + const { onClose } = this.state; - if(onClose && typeof onClose === "function") { - onClose(); - } + if (onClose && typeof onClose === "function") { + onClose(); + } - Animated.timing(this.state.fadeAnim, { - toValue: 0, - duration: 200, - }).start(); - setTimeout(() => { - this.setState({ - modalVisible: false, - }); - }, 500); - } - render() { - if (this.state.modalVisible) { - return ( - - - - {this.state.text} - - {this.state.buttonText && - } - - - ); - } else return null; - } + Animated.timing(this.state.fadeAnim, { + toValue: 0, + duration: 200 + }).start(); + setTimeout(() => { + this.setState({ + modalVisible: false + }); + }, 500); + } + render() { + if (this.state.modalVisible) { + return ( + + + {this.state.text} + {this.state.buttonText && ( + + )} + + + ); + } else return null; + } } ToastContainer.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledToastContainer = connectStyle("NativeBase.ToastContainer", {}, mapPropsToStyleNames)(ToastContainer); +const StyledToastContainer = connectStyle( + "NativeBase.ToastContainer", + {}, + mapPropsToStyleNames +)(ToastContainer); export { StyledToastContainer as ToastContainer }; - diff --git a/src/basic/View.js b/src/basic/View.js index 21f3e69dc..842af1ed6 100644 --- a/src/basic/View.js +++ b/src/basic/View.js @@ -1,20 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View } from "react-native"; -import { ViewPropTypes } from '../Utils'; +import { View, ViewPropTypes } from "react-native"; import { connectStyle } from "native-base-shoutem-theme"; import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames"; class ViewNB extends Component { - render() { - return (this._root = c)} {...this.props} />; - } + render() { + return (this._root = c)} {...this.props} />; + } } ViewNB.propTypes = { - ...ViewPropTypes, - style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + ...ViewPropTypes, + style: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + PropTypes.array + ]) }; -const StyledViewNB = connectStyle("NativeBase.ViewNB", {}, mapPropsToStyleNames)(ViewNB); +const StyledViewNB = connectStyle( + "NativeBase.ViewNB", + {}, + mapPropsToStyleNames +)(ViewNB); export { StyledViewNB as ViewNB };