diff --git a/Fonts/AntDesign.ttf b/Fonts/AntDesign.ttf old mode 100644 new mode 100755 diff --git a/Fonts/Entypo.ttf b/Fonts/Entypo.ttf old mode 100644 new mode 100755 diff --git a/Fonts/EvilIcons.ttf b/Fonts/EvilIcons.ttf old mode 100644 new mode 100755 index b270f9851..6868f7bb6 Binary files a/Fonts/EvilIcons.ttf and b/Fonts/EvilIcons.ttf differ diff --git a/Fonts/Feather.ttf b/Fonts/Feather.ttf old mode 100644 new mode 100755 index 244854c54..852c7135a Binary files a/Fonts/Feather.ttf and b/Fonts/Feather.ttf differ diff --git a/Fonts/FontAwesome.ttf b/Fonts/FontAwesome.ttf old mode 100644 new mode 100755 diff --git a/Fonts/FontAwesome5_Brands.ttf b/Fonts/FontAwesome5_Brands.ttf old mode 100644 new mode 100755 index 953d567b2..5f72e9127 Binary files a/Fonts/FontAwesome5_Brands.ttf and b/Fonts/FontAwesome5_Brands.ttf differ diff --git a/Fonts/FontAwesome5_Regular.ttf b/Fonts/FontAwesome5_Regular.ttf old mode 100644 new mode 100755 index 235101c2d..a309313d5 Binary files a/Fonts/FontAwesome5_Regular.ttf and b/Fonts/FontAwesome5_Regular.ttf differ diff --git a/Fonts/FontAwesome5_Solid.ttf b/Fonts/FontAwesome5_Solid.ttf old mode 100644 new mode 100755 index 7c92e986f..7ece3282a Binary files a/Fonts/FontAwesome5_Solid.ttf and b/Fonts/FontAwesome5_Solid.ttf differ diff --git a/Fonts/Fontisto.ttf b/Fonts/Fontisto.ttf new file mode 100755 index 000000000..96e2e81a3 Binary files /dev/null and b/Fonts/Fontisto.ttf differ diff --git a/Fonts/Foundation.ttf b/Fonts/Foundation.ttf old mode 100644 new mode 100755 diff --git a/Fonts/Ionicons.ttf b/Fonts/Ionicons.ttf old mode 100644 new mode 100755 index 307ad889a..67bd84202 Binary files a/Fonts/Ionicons.ttf and b/Fonts/Ionicons.ttf differ diff --git a/Fonts/MaterialCommunityIcons.ttf b/Fonts/MaterialCommunityIcons.ttf old mode 100644 new mode 100755 index 82524a0c1..9cc8db166 Binary files a/Fonts/MaterialCommunityIcons.ttf and b/Fonts/MaterialCommunityIcons.ttf differ diff --git a/Fonts/MaterialIcons.ttf b/Fonts/MaterialIcons.ttf old mode 100644 new mode 100755 diff --git a/Fonts/Octicons.ttf b/Fonts/Octicons.ttf old mode 100644 new mode 100755 index 09f5a96c0..ceac75d75 Binary files a/Fonts/Octicons.ttf and b/Fonts/Octicons.ttf differ diff --git a/Fonts/SimpleLineIcons.ttf b/Fonts/SimpleLineIcons.ttf old mode 100644 new mode 100755 diff --git a/Fonts/Zocial.ttf b/Fonts/Zocial.ttf old mode 100644 new mode 100755 diff --git a/dist/src/basic/IconNB.js b/dist/src/basic/IconNB.js index fc2838fb9..8baf03b72 100644 --- a/dist/src/basic/IconNB.js +++ b/dist/src/basic/IconNB.js @@ -1,2 +1,2 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.IconNB=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = c)} {...this.props} />;\n }\n}\n\nIconNB.propTypes = {\n type: PropTypes.oneOf([\n 'AntDesign',\n 'Entypo',\n 'EvilIcons',\n 'Feather',\n 'FontAwesome',\n 'FontAwesome5',\n 'Foundation',\n 'Ionicons',\n 'MaterialCommunityIcons',\n 'MaterialIcons',\n 'Octicons',\n 'SimpleLineIcons',\n 'Zocial'\n ])\n};\n\nconst StyledIconNB = connectStyle(\n 'NativeBase.IconNB',\n {},\n mapPropsToStyleNames\n)(IconNB);\n\nexport { StyledIconNB as IconNB };\n"]} +{"version":3,"sources":["../../../src/basic/IconNB.js"],"names":["IconNB","props","setIcon","type","nextProps","iconType","undefined","context","theme","variables","iconFamily","Icon","AntDesign","Entypo","EvilIcons","Feather","FontAwesome","FontAwesome5","Foundation","Ionicons","MaterialCommunityIcons","MaterialIcons","Octicons","SimpleLineIcons","Zocial","_root","c","Component","contextTypes","PropTypes","object","propTypes","oneOf","StyledIconNB","mapPropsToStyleNames"],"mappings":"u1BAAA,4B,2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,CACA,MACF,IAAK,iBAAL,CACE,KAAKX,IAAL,CAAYY,yBAAZ,CACA,MACF,IAAK,QAAL,CACE,KAAKZ,IAAL,CAAYa,gBAAZ,CACA,MACF,QACE,KAAKb,IAAL,CAAYQ,kBAAZ,CAzCF,CA2CD,C,uCAEQ,iBACP,MAAO,oCAAM,IAAN,WAAW,IAAK,sBAAM,QAAKM,KAAL,CAAaC,CAAnB,EAAhB,EAA2C,KAAKzB,KAAhD,mDAAP,CACD,C,oBArEkB0B,gB,EAAf3B,M,CACG4B,Y,CAAe,CACpBpB,MAAOqB,oBAAUC,MADG,C,CAuExB9B,OAAO+B,SAAP,CAAmB,CACjB5B,KAAM0B,oBAAUG,KAAV,CAAgB,CACpB,WADoB,CAEpB,QAFoB,CAGpB,WAHoB,CAIpB,SAJoB,CAKpB,aALoB,CAMpB,cANoB,CAOpB,YAPoB,CAQpB,UARoB,CASpB,wBAToB,CAUpB,eAVoB,CAWpB,UAXoB,CAYpB,iBAZoB,CAapB,QAboB,CAAhB,CADW,CAAnB,CAkBA,GAAMC,cAAe,yCACnB,mBADmB,CAEnB,EAFmB,CAGnBC,8BAHmB,EAInBlC,MAJmB,CAArB,C,QAMyBA,M,CAAhBiC,Y","file":"IconNB.js","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connectStyle } from 'native-base-shoutem-theme';\nimport { get } from 'lodash';\nimport AntDesign from 'react-native-vector-icons/AntDesign';\nimport Entypo from 'react-native-vector-icons/Entypo';\nimport EvilIcons from 'react-native-vector-icons/EvilIcons';\nimport Feather from 'react-native-vector-icons/Feather';\nimport FontAwesome from 'react-native-vector-icons/FontAwesome';\nimport FontAwesome5 from 'react-native-vector-icons/FontAwesome5';\nimport Foundation from 'react-native-vector-icons/Foundation';\nimport Ionicons from 'react-native-vector-icons/Ionicons';\nimport MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';\nimport MaterialIcons from 'react-native-vector-icons/MaterialIcons';\nimport Octicons from 'react-native-vector-icons/Octicons';\nimport SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons';\nimport Zocial from 'react-native-vector-icons/Zocial';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nclass IconNB extends Component {\n static contextTypes = {\n theme: PropTypes.object\n };\n\n constructor(props) {\n super(props);\n this.setIcon(props.type);\n }\n\n componentDidUpdate(nextProps) {\n if (nextProps.type && this.props.type !== nextProps.type) {\n this.setIcon(nextProps.type);\n }\n }\n\n setIcon(iconType) {\n if (iconType === undefined && get(this, 'context.theme')) {\n // eslint-disable-next-line\n iconType = this.context.theme['@@shoutem.theme/themeStyle'].variables\n .iconFamily;\n }\n switch (iconType) {\n case 'AntDesign':\n this.Icon = AntDesign;\n break;\n case 'Entypo':\n this.Icon = Entypo;\n break;\n case 'EvilIcons':\n this.Icon = EvilIcons;\n break;\n case 'Feather':\n this.Icon = Feather;\n break;\n case 'FontAwesome':\n this.Icon = FontAwesome;\n break;\n case 'FontAwesome5':\n this.Icon = FontAwesome5;\n break;\n case 'Foundation':\n this.Icon = Foundation;\n break;\n case 'Ionicons':\n this.Icon = Ionicons;\n break;\n case 'MaterialCommunityIcons':\n this.Icon = MaterialCommunityIcons;\n break;\n case 'MaterialIcons':\n this.Icon = MaterialIcons;\n break;\n case 'Octicons':\n this.Icon = Octicons;\n break;\n case 'SimpleLineIcons':\n this.Icon = SimpleLineIcons;\n break;\n case 'Zocial':\n this.Icon = Zocial;\n break;\n default:\n this.Icon = Ionicons;\n }\n }\n\n render() {\n return (this._root = c)} {...this.props} />;\n }\n}\n\nIconNB.propTypes = {\n type: PropTypes.oneOf([\n 'AntDesign',\n 'Entypo',\n 'EvilIcons',\n 'Feather',\n 'FontAwesome',\n 'FontAwesome5',\n 'Foundation',\n 'Ionicons',\n 'MaterialCommunityIcons',\n 'MaterialIcons',\n 'Octicons',\n 'SimpleLineIcons',\n 'Zocial'\n ])\n};\n\nconst StyledIconNB = connectStyle(\n 'NativeBase.IconNB',\n {},\n mapPropsToStyleNames\n)(IconNB);\n\nexport { StyledIconNB as IconNB };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Item.js b/dist/src/basic/Item.js index 842f8df09..aec88151d 100644 --- a/dist/src/basic/Item.js +++ b/dist/src/basic/Item.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.Item=undefined;var _extends=Object.assign||function(target){for(var i=1;i {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n return null;\n });\n\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n return null;\n });\n\n let image = [];\n image = _.remove(childrenArray, item => {\n if (item.type === Thumbnail) {\n return item;\n }\n return null;\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i + 1) {\n if (\n this.props.children[i].props.name &&\n this.props.children[i].type.displayName !== 'Styled(Input)'\n ) {\n isIcon = true;\n newChildren.push(\n \n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n \n \n \n );\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n if (inputProps.onFocus) {\n inputProps.onFocus();\n }\n }}\n onBlur={e => {\n if (inputProps.value) {\n this.setState({\n isFocused: true\n });\n } else if (!this.state.text.length) {\n this.setState({ isFocused: false });\n }\n\n if (inputProps.onBlur) {\n inputProps.onBlur(e);\n }\n }}\n onChangeText={text => {\n this.setState({ text });\n if (inputProps.onChangeText) {\n inputProps.onChangeText(text);\n }\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel && image.length) {\n let isImage = false;\n for (let i = 0; i < this.props.children.length; i + 1) {\n if (this.props.children[i].type.displayName === 'Styled(Thumbnail)') {\n isImage = true;\n newChildren.push(\n \n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n \n \n \n );\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n style={{\n left:\n this.props.last && isImage\n ? 10\n : this.props.last\n ? 4\n : isImage\n ? 10\n : 0,\n marginRight: 12\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n \n \n \n );\n newChildren.push(\n (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n \n \n \n \n \n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n const labelStyle = StyleSheet.flatten([\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n ]);\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newLabel'\n })\n );\n }\n return newLabel;\n }\n\n render() {\n return (\n (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n \n );\n }\n}\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle('NativeBase.Item', {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","isFocussed","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","floatUp","getRef","_inputRef","roundedInputGroup","borderWidth","rounded","variables","undefined","borderRadius","inputGroupRoundedBorderRadius","timing","toValue","duration","start","e","defaultProps","style","getInitialStyle","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","setState","isFocused","newChildren","label","labelProps","Label","Input","icon","iconProps","Icon","image","Thumbnail","length","isIcon","i","name","push","placeholder","position","left","last","right","top","opacity","paddingTop","Platform","OS","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","isImage","marginRight","stackedLabel","flexDirection","flex","width","deviceWidth","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","createElement","key","float","floatBack","_root","prepareRootProps","renderChildren","Component","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","error","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAEA,4B,2CACA,qC,mDACA,yCAOA,8B,6CACA,iEAEA,qD,iDACA,mD,yDACA,mE,yEAEA,8BACA,8BACA,4BACA,sC,o4BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC,WAAY,IADD,CAEXC,KAAM,EAFK,CAGXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAHE,CAIXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAJC,CAAb,CAFiB,aAQlB,C,8EACmB,CAClB,GAAI,KAAKN,KAAL,CAAWQ,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C,CAC5C,KAAKC,OAAL,CAAa,CAAC,EAAd,EACD,CACD,GAAI,KAAKF,UAAL,EAAmB,KAAKA,UAAL,CAAgBG,MAAvC,CACE,KAAKH,UAAL,CAAgBG,MAAhB,CAAuB,KAAKC,SAA5B,EACH,CACF,C,yDAEiB,CAChB,MAAO,CACLC,kBAAmB,CACjBC,YAAa,KAAKf,KAAL,CAAWgB,OAAX,CAAqBC,mBAAUF,WAAV,CAAwB,CAA7C,CAAiDG,SAD7C,CAEjBC,aAAc,KAAKnB,KAAL,CAAWgB,OAAX,CACVC,mBAAUG,6BADA,CAEVF,SAJa,CADd,CAAP,CAQD,C,6CAEW,CACVb,sBAASgB,MAAT,CAAgB,KAAKpB,KAAL,CAAWG,OAA3B,CAAoC,CAClCkB,QAAS,EADyB,CAElCC,SAAU,GAFwB,CAApC,EAGGC,KAHH,GAIAnB,sBAASgB,MAAT,CAAgB,KAAKpB,KAAL,CAAWM,QAA3B,CAAqC,CACnCe,QAAS,CAD0B,CAEnCC,SAAU,GAFyB,CAArC,EAGGC,KAHH,GAID,C,wCAEOC,C,CAAG,CACTpB,sBAASgB,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CAAnB,CAAnB,CAIA,GAAI,KAAK3B,KAAL,CAAWQ,aAAf,CAA8B,CAC5B,GAAI,KAAKP,KAAL,CAAWwC,SAAf,CAA0B,CACxBuC,SAASxB,IAAT,CACEzB,gBAAMuD,aAAN,CAAoBzC,YAApB,aACKD,UADL,EAEE2C,IAAK,WAFP,CAGEC,MAAO,IAHT,CAIE7D,MAAOsD,UAJT,GADF,EAQA,KAAKtE,OAAL,CAAa,CAAC,EAAd,EACD,CAVD,IAUO,CACLqE,SAASxB,IAAT,CAAcb,KAAd,EACA,KAAK8C,SAAL,GACD,CACF,CAfD,IAeO,CACLT,SAASxB,IAAT,CACEzB,gBAAMuD,aAAN,CAAoBzC,YAApB,aACKD,UADL,EAEE2C,IAAK,UAFP,GADF,EAMD,CACD,MAAOP,SAAP,CACD,C,uCAEQ,iBACP,MACE,+BAAC,6BAAD,WACE,IAAK,sBAAM,QAAKU,KAAL,CAAarB,CAAnB,EADP,EAEM,KAAKsB,gBAAL,EAFN,EAGE,cAAe,CAHjB,mDAKG,KAAKC,cAAL,EALH,CADF,CASD,C,kBApYgBC,gB,EAuYnB9F,KAAK+F,SAAL,aACKC,8BAAiBD,SADtB,EAEEnE,MAAOqE,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAOEC,YAAaL,oBAAUM,IAPzB,CAQE9F,cAAewF,oBAAUM,IAR3B,CASE3B,aAAcqB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEG,MAAOT,oBAAUM,IAZnB,GAeA,GAAMI,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["/* eslint-disable no-plusplus */\n/* eslint-disable no-loop-func */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from 'react-native';\nimport _ from 'lodash';\nimport { connectStyle } from 'native-base-shoutem-theme';\n\nimport variables from '../theme/variables/platform';\nimport computeProps from '../utils/computeProps';\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nimport { Input } from './Input';\nimport { Label } from './Label';\nimport { Icon } from './Icon';\nimport { Thumbnail } from './Thumbnail';\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n isFocussed: true,\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n // Temporary fix to avoid the crash.\n // To be refactored to getDerivedStateFromProps.\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n\n _.remove(childrenArray, item => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n return null;\n });\n\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n return null;\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n return null;\n });\n\n let image = [];\n image = _.remove(childrenArray, item => {\n if (item.type === Thumbnail) {\n return item;\n }\n return null;\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (\n this.props.children[i].props.name &&\n this.props.children[i].type.displayName !== 'Styled(Input)'\n ) {\n isIcon = true;\n newChildren.push(\n \n );\n }\n if (this.props.children[i].props.children || this.props.children[i].props.placeholder) {\n newChildren.push(\n \n \n \n );\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n if (inputProps.onFocus) {\n inputProps.onFocus();\n }\n }}\n onBlur={e => {\n if (inputProps.value) {\n this.setState({\n isFocused: true\n });\n } else if (!this.state.text.length) {\n this.setState({ isFocused: false });\n }\n\n if (inputProps.onBlur) {\n inputProps.onBlur(e);\n }\n }}\n onChangeText={text => {\n this.setState({ text });\n if (inputProps.onChangeText) {\n inputProps.onChangeText(text);\n }\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel && image.length) {\n let isImage = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].type.displayName === 'Styled(Thumbnail)') {\n isImage = true;\n newChildren.push(\n \n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n \n \n \n );\n newChildren.push(\n (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n style={{\n left:\n this.props.last && isImage\n ? 10\n : this.props.last\n ? 4\n : isImage\n ? 10\n : 0,\n marginRight: 12\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n \n \n \n );\n newChildren.push(\n (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={e => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur(e);\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n \n \n \n \n \n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n const labelStyle = StyleSheet.flatten([\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n ]);\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: 'newLabel'\n })\n );\n }\n return newLabel;\n }\n\n render() {\n return (\n (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n \n );\n }\n}\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle('NativeBase.Item', {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} \ No newline at end of file diff --git a/dist/src/basic/List.js b/dist/src/basic/List.js index 733528a97..6601acb41 100644 --- a/dist/src/basic/List.js +++ b/dist/src/basic/List.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.List=undefined;var _extends=Object.assign||function(target){for(var i=1;i (this._root = ref)}\n data={dataArray}\n renderItem={({ item }) => this.props.renderRow(item)}\n {...this.props}\n />\n );\n }\n return (this._root = c)} {...this.props} />;\n }\n}\nconst StyledList = connectStyle('NativeBase.List', {}, mapPropsToStyleNames)(\n List\n);\n\nexport { StyledList as List };\n"]} \ No newline at end of file +{"version":3,"sources":["../../../src/basic/List.js"],"names":["List","dataArray","props","_root","ref","item","index","renderItem","renderRow","c","Component","StyledList","mapPropsToStyleNames"],"mappings":"m1BAAA,iEACA,4B,2CACA,yCAEA,mE,68BAEMA,K,iQACK,oBACCC,UADD,CACe,KAAKC,KADpB,CACCD,SADD,CAGP,GAAIA,SAAJ,CAAe,CACb,MACE,+BAAC,qBAAD,WACE,IAAK,0BAAQ,QAAKE,KAAL,CAAaC,KAArB,EADP,CAEE,KAAMH,SAFR,CAGE,WAAY,6BAAGI,KAAH,MAAGA,IAAH,CAASC,KAAT,MAASA,KAAT,OACV,QAAKJ,KAAL,CAAWK,UAAX,CACI,OAAKL,KAAL,CAAWK,UAAX,CAAsB,CAAEF,SAAF,CAAQC,WAAR,CAAtB,CADJ,CAEI,OAAKJ,KAAL,CAAWM,SAAX,CAAqBH,IAArB,CAA2B,CAA3B,CAA8BC,KAA9B,CAHM,EAHd,EAQM,KAAKJ,KARX,mDADF,CAYD,CACD,MAAO,+BAAC,iBAAD,WAAM,IAAK,sBAAM,QAAKC,KAAL,CAAaM,CAAnB,EAAX,EAAsC,KAAKP,KAA3C,mDAAP,CACD,C,kBAnBgBQ,gB,EAsBnB,GAAMC,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjBZ,IADiB,CAAnB,C,QAIuBA,I,CAAdW,U","file":"List.js","sourcesContent":["import { connectStyle } from 'native-base-shoutem-theme';\nimport React, { Component } from 'react';\nimport { FlatList, View } from 'react-native';\n\nimport mapPropsToStyleNames from '../utils/mapPropsToStyleNames';\n\nclass List extends Component {\n render() {\n const { dataArray } = this.props;\n\n if (dataArray) {\n return (\n (this._root = ref)}\n data={dataArray}\n renderItem={({ item, index }) =>\n this.props.renderItem\n ? this.props.renderItem({ item, index })\n : this.props.renderRow(item, 0, index)\n }\n {...this.props}\n />\n );\n }\n return (this._root = c)} {...this.props} />;\n }\n}\n\nconst StyledList = connectStyle('NativeBase.List', {}, mapPropsToStyleNames)(\n List\n);\n\nexport { StyledList as List };\n"]} \ No newline at end of file diff --git a/dist/src/basic/Tabs/ScrollableTabBar.js b/dist/src/basic/Tabs/ScrollableTabBar.js index 8d99caf1e..55ec1935c 100644 --- a/dist/src/basic/Tabs/ScrollableTabBar.js +++ b/dist/src/basic/Tabs/ScrollableTabBar.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.ScrollableTab=undefined;var _jsxFileName='src/basic/Tabs/ScrollableTabBar.js';var _react=require('react');var _react2=_interopRequireDefault(_react);var _propTypes=require('prop-types');var _propTypes2=_interopRequireDefault(_propTypes);var _createReactClass=require('create-react-class');var _createReactClass2=_interopRequireDefault(_createReactClass);var _lodash=require('lodash');var _nativeBaseShoutemTheme=require('native-base-shoutem-theme');var _mapPropsToStyleNames=require('../../utils/mapPropsToStyleNames');var _mapPropsToStyleNames2=_interopRequireDefault(_mapPropsToStyleNames);var _platform=require('./../../theme/variables/platform');var _platform2=_interopRequireDefault(_platform);var _TabHeading=require('../TabHeading');var _Text=require('../Text');var _TabContainer=require('../TabContainer');var _utils=require('../../utils');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var Button=require('./Button');var ReactNative=require('react-native');var View=ReactNative.View,Animated=ReactNative.Animated,StyleSheet=ReactNative.StyleSheet,ScrollView=ReactNative.ScrollView,Platform=ReactNative.Platform,Dimensions=ReactNative.Dimensions;var WINDOW_WIDTH=Dimensions.get('window').width;var ScrollableTabBar=(0,_createReactClass2.default)({displayName:'ScrollableTabBar',propTypes:{goToPage:_propTypes2.default.func,activeTab:_propTypes2.default.number,tabs:_propTypes2.default.array,backgroundColor:_propTypes2.default.string,activeTextColor:_propTypes2.default.string,inactiveTextColor:_propTypes2.default.string,scrollOffset:_propTypes2.default.number,style:_utils.ViewPropTypes.style,tabStyle:_utils.ViewPropTypes.style,tabsContainerStyle:_utils.ViewPropTypes.style,renderTab:_propTypes2.default.func,underlineStyle:_utils.ViewPropTypes.style,onScroll:_propTypes2.default.func},contextTypes:{theme:_propTypes2.default.object},getDefaultProps:function getDefaultProps(){return{scrollOffset:52,activeTextColor:'navy',inactiveTextColor:'black',backgroundColor:_platform2.default.tabDefaultBg,style:{},tabStyle:{},tabsContainerStyle:{},underlineStyle:{},tabFontSize:_platform2.default.tabFontSize};},getInitialState:function getInitialState(){this._tabsMeasurements=[];return{_leftTabUnderline:new Animated.Value(0),_widthTabUnderline:new Animated.Value(0),_containerWidth:null};},componentDidMount:function componentDidMount(){this.props.scrollValue.addListener(this.updateView);},updateView:function updateView(offset){var position=Math.floor(offset.value);var pageOffset=offset.value%1;var tabCount=this.props.tabs.length;var lastTabPosition=tabCount-1;if(tabCount===0||offset.value<0||offset.value>lastTabPosition){return;}if(this.necessarilyMeasurementsCompleted(position,position===lastTabPosition)){this.updateTabPanel(position,pageOffset);this.updateTabUnderline(position,pageOffset,tabCount);}},necessarilyMeasurementsCompleted:function necessarilyMeasurementsCompleted(position,isLastTab){return this._tabsMeasurements[position]&&(isLastTab||this._tabsMeasurements[position+1])&&this._tabContainerMeasurements&&this._containerMeasurements;},updateTabPanel:function updateTabPanel(position,pageOffset){var containerWidth=this._containerMeasurements.width;var tabWidth=this._tabsMeasurements[position].width;var nextTabMeasurements=this._tabsMeasurements[position+1];var nextTabWidth=nextTabMeasurements&&nextTabMeasurements.width||0;var tabOffset=this._tabsMeasurements[position].left;var absolutePageOffset=pageOffset*tabWidth;var newScrollX=tabOffset+absolutePageOffset;newScrollX-=(containerWidth-(1-pageOffset)*tabWidth-pageOffset*nextTabWidth)/2;newScrollX=newScrollX>=0?newScrollX:0;if(Platform.OS==='android'){this._scrollView.scrollTo({x:newScrollX,y:0,animated:false});}else{var rightBoundScroll=this._tabContainerMeasurements.width-this._containerMeasurements.width;newScrollX=newScrollX>rightBoundScroll?rightBoundScroll:newScrollX;this._scrollView.scrollTo({x:newScrollX,y:0,animated:false});}},updateTabUnderline:function updateTabUnderline(position,pageOffset,tabCount){var lineLeft=this._tabsMeasurements[position].left;var lineRight=this._tabsMeasurements[position].right;if(positionlastTabPosition){return;}if(this.necessarilyMeasurementsCompleted(position,position===lastTabPosition)){this.updateTabPanel(position,pageOffset);this.updateTabUnderline(position,pageOffset,tabCount);}},necessarilyMeasurementsCompleted:function necessarilyMeasurementsCompleted(position,isLastTab){return this._tabsMeasurements[position]&&(isLastTab||this._tabsMeasurements[position+1])&&this._tabContainerMeasurements&&this._containerMeasurements;},updateTabPanel:function updateTabPanel(position,pageOffset){var containerWidth=this._containerMeasurements.width;var tabWidth=this._tabsMeasurements[position].width;var nextTabMeasurements=this._tabsMeasurements[position+1];var nextTabWidth=nextTabMeasurements&&nextTabMeasurements.width||0;var tabOffset=this._tabsMeasurements[position].left;var absolutePageOffset=pageOffset*tabWidth;var newScrollX=tabOffset+absolutePageOffset;newScrollX-=(containerWidth-(1-pageOffset)*tabWidth-pageOffset*nextTabWidth)/2;newScrollX=newScrollX>=0?newScrollX:0;if(Platform.OS==='android'){this._scrollView.scrollTo({x:newScrollX,y:0,animated:false});}else{var rightBoundScroll=this._tabContainerMeasurements.width-this._containerMeasurements.width;newScrollX=newScrollX>rightBoundScroll?rightBoundScroll:newScrollX;this._scrollView.scrollTo({x:newScrollX,y:0,animated:false});}},updateTabUnderline:function updateTabUnderline(position,pageOffset,tabCount){var lineLeft=this._tabsMeasurements[position].left;var lineRight=this._tabsMeasurements[position].right;if(position lastTabPosition) {\n return;\n }\n\n if (\n this.necessarilyMeasurementsCompleted(\n position,\n position === lastTabPosition\n )\n ) {\n this.updateTabPanel(position, pageOffset);\n this.updateTabUnderline(position, pageOffset, tabCount);\n }\n },\n\n necessarilyMeasurementsCompleted(position, isLastTab) {\n return (\n this._tabsMeasurements[position] &&\n (isLastTab || this._tabsMeasurements[position + 1]) &&\n this._tabContainerMeasurements &&\n this._containerMeasurements\n );\n },\n\n updateTabPanel(position, pageOffset) {\n const containerWidth = this._containerMeasurements.width;\n const tabWidth = this._tabsMeasurements[position].width;\n const nextTabMeasurements = this._tabsMeasurements[position + 1];\n const nextTabWidth =\n (nextTabMeasurements && nextTabMeasurements.width) || 0;\n const tabOffset = this._tabsMeasurements[position].left;\n const absolutePageOffset = pageOffset * tabWidth;\n let newScrollX = tabOffset + absolutePageOffset;\n\n // center tab and smooth tab change (for when tabWidth changes a lot between two tabs)\n newScrollX -=\n (containerWidth -\n (1 - pageOffset) * tabWidth -\n pageOffset * nextTabWidth) /\n 2;\n newScrollX = newScrollX >= 0 ? newScrollX : 0;\n\n if (Platform.OS === 'android') {\n this._scrollView.scrollTo({ x: newScrollX, y: 0, animated: false });\n } else {\n const rightBoundScroll =\n this._tabContainerMeasurements.width -\n this._containerMeasurements.width;\n newScrollX =\n newScrollX > rightBoundScroll ? rightBoundScroll : newScrollX;\n this._scrollView.scrollTo({ x: newScrollX, y: 0, animated: false });\n }\n },\n\n updateTabUnderline(position, pageOffset, tabCount) {\n const lineLeft = this._tabsMeasurements[position].left;\n const lineRight = this._tabsMeasurements[position].right;\n\n if (position < tabCount - 1) {\n const nextTabLeft = this._tabsMeasurements[position + 1].left;\n const nextTabRight = this._tabsMeasurements[position + 1].right;\n\n const newLineLeft =\n pageOffset * nextTabLeft + (1 - pageOffset) * lineLeft;\n const newLineRight =\n pageOffset * nextTabRight + (1 - pageOffset) * lineRight;\n\n this.state._leftTabUnderline.setValue(newLineLeft);\n this.state._widthTabUnderline.setValue(newLineRight - newLineLeft);\n } else {\n this.state._leftTabUnderline.setValue(lineLeft);\n this.state._widthTabUnderline.setValue(lineRight - lineLeft);\n }\n },\n\n renderTab(\n name,\n page,\n isTabActive,\n onPressHandler,\n onLayoutHandler,\n tabStyle,\n activeTabStyle,\n textStyle,\n activeTextStyle,\n tabHeaderStyle,\n tabFontSize\n ) {\n const headerContent =\n typeof name !== 'string' ? name.props.children : undefined;\n const { activeTextColor, inactiveTextColor } = this.props;\n const textColor = isTabActive ? activeTextColor : inactiveTextColor;\n const fontWeight = isTabActive ? 'bold' : 'normal';\n\n if (typeof name === 'string') {\n return (\n onPressHandler(page)}\n onLayout={onLayoutHandler}\n >\n \n \n {name}\n \n \n \n );\n }\n return (\n onPressHandler(page)}\n onLayout={onLayoutHandler}\n >\n \n {headerContent}\n \n \n );\n \n },\n\n measureTab(page, event) {\n const { x, width, height } = event.nativeEvent.layout;\n this._tabsMeasurements[page] = { left: x, right: x + width, width, height };\n this.updateView({ value: this.props.scrollValue._value });\n },\n\n render() {\n const variables = this.context.theme\n ? this.context.theme['@@shoutem.theme/themeStyle'].variables\n : variable;\n const tabUnderlineStyle = {\n position: 'absolute',\n height: 4,\n backgroundColor: variables.topTabBarActiveBorderColor,\n bottom: 0\n };\n\n const dynamicTabUnderline = {\n left: this.state._leftTabUnderline,\n width: this.state._widthTabUnderline\n };\n\n return (\n \n {\n this._scrollView = scrollView;\n }}\n horizontal\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n directionalLockEnabled\n onScroll={this.props.onScroll}\n bounces={false}\n scrollsToTop={false}\n >\n \n {this.props.tabs.map((name, page) => {\n const isTabActive = this.props.activeTab === page;\n const renderTab = this.props.renderTab || this.renderTab;\n return renderTab(\n name,\n page,\n isTabActive,\n this.props.goToPage,\n this.measureTab.bind(this, page),\n this.props.tabStyle[page],\n this.props.activeTabStyle[page],\n this.props.textStyle[page],\n this.props.activeTextStyle[page],\n this.props.tabHeaderStyle[page],\n variables.tabFontSize\n );\n })}\n \n \n \n \n );\n },\n\n componentDidUpdate(nextProps) {\n // If the tabs change, force the width of the tabs container to be recalculated\n if (\n !isEqual(this.props.tabs, nextProps.tabs) &&\n this.state._containerWidth\n ) {\n this.setState({ _containerWidth: null });\n }\n },\n\n onTabContainerLayout(e) {\n this._tabContainerMeasurements = e.nativeEvent.layout;\n let width = this._tabContainerMeasurements.width;\n if (width < WINDOW_WIDTH) {\n width = WINDOW_WIDTH;\n }\n this.setState({ _containerWidth: width });\n this.updateView({ value: this.props.scrollValue._value });\n },\n\n onContainerLayout(e) {\n this._containerMeasurements = e.nativeEvent.layout;\n this.updateView({ value: this.props.scrollValue._value });\n }\n});\n\n// module.exports = ScrollableTabBar;\nconst StyledTab = connectStyle(\n 'NativeBase.ScrollableTab',\n {},\n mapPropsToStyleNames\n)(ScrollableTabBar);\nexport { StyledTab as ScrollableTab };\nconst styles = StyleSheet.create({\n tab: {\n height: 49,\n alignItems: 'center',\n justifyContent: 'center',\n paddingLeft: 20,\n paddingRight: 20\n },\n container: {\n height: 50,\n borderWidth: 1,\n borderTopWidth: 0,\n borderLeftWidth: 0,\n borderRightWidth: 0,\n borderColor: '#ccc'\n },\n tabs: {\n flexDirection: 'row',\n justifyContent: 'space-around'\n }\n});\n"]} \ No newline at end of file +{"version":3,"sources":["../../../../src/basic/Tabs/ScrollableTabBar.js"],"names":["Button","require","ReactNative","View","Animated","StyleSheet","ScrollView","Platform","Dimensions","WINDOW_WIDTH","get","width","ScrollableTabBar","propTypes","goToPage","PropTypes","func","activeTab","number","tabs","array","backgroundColor","string","activeTextColor","inactiveTextColor","scrollOffset","style","ViewPropTypes","tabStyle","tabsContainerStyle","renderTab","underlineStyle","onScroll","contextTypes","theme","object","getDefaultProps","variable","tabDefaultBg","tabFontSize","getInitialState","_tabsMeasurements","_leftTabUnderline","Value","_widthTabUnderline","_containerWidth","componentDidMount","props","scrollValue","addListener","updateView","offset","position","Math","floor","value","pageOffset","tabCount","length","lastTabPosition","necessarilyMeasurementsCompleted","updateTabPanel","updateTabUnderline","isLastTab","_tabContainerMeasurements","_containerMeasurements","containerWidth","tabWidth","nextTabMeasurements","nextTabWidth","tabOffset","left","absolutePageOffset","newScrollX","OS","_scrollView","scrollTo","x","y","animated","rightBoundScroll","lineLeft","lineRight","right","nextTabLeft","nextTabRight","newLineLeft","newLineRight","state","setValue","name","page","isTabActive","onPressHandler","onLayoutHandler","activeTabStyle","textStyle","activeTextStyle","tabHeaderStyle","headerContent","children","undefined","textColor","fontWeight","fontSize","measureTab","event","nativeEvent","layout","height","_value","render","variables","context","tabUnderlineStyle","topTabBarActiveBorderColor","bottom","dynamicTabUnderline","styles","container","onContainerLayout","scrollView","onTabContainerLayout","map","bind","UNSAFE_componentWillReceiveProps","nextProps","setState","e","StyledTab","mapPropsToStyleNames","ScrollableTab","create","tab","alignItems","justifyContent","paddingLeft","paddingRight","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderColor","flexDirection"],"mappings":"+IAAA,4B,2CACA,qC,mDACA,oD,iEACA,8BACA,iEACA,sE,yEACA,0D,iDACA,yCACA,6BACA,6CACA,kC,mFACA,GAAMA,QAASC,QAAQ,UAAR,CAAf,CACA,GAAMC,aAAcD,QAAQ,cAAR,CAApB,C,GAEEE,K,CAMED,W,CANFC,I,CACAC,Q,CAKEF,W,CALFE,Q,CACAC,U,CAIEH,W,CAJFG,U,CACAC,U,CAGEJ,W,CAHFI,U,CACAC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4H,cAAe,KADX,CAEJR,eAAgB,cAFZ,CAhByB,CAAlB,CAAf","file":"ScrollableTabBar.js","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport createReactClass from 'create-react-class';\nimport { isEqual } from 'lodash';\nimport { connectStyle, StyleProvider } from 'native-base-shoutem-theme';\nimport mapPropsToStyleNames from '../../utils/mapPropsToStyleNames';\nimport variable from './../../theme/variables/platform';\nimport { TabHeading } from '../TabHeading';\nimport { Text } from '../Text';\nimport { TabContainer } from '../TabContainer';\nimport { ViewPropTypes } from '../../utils';\nconst Button = require('./Button');\nconst ReactNative = require('react-native');\nconst {\n View,\n Animated,\n StyleSheet,\n ScrollView,\n Platform,\n Dimensions\n} = ReactNative;\n\nconst WINDOW_WIDTH = Dimensions.get('window').width;\n\nconst ScrollableTabBar = createReactClass({\n propTypes: {\n goToPage: PropTypes.func,\n activeTab: PropTypes.number,\n tabs: PropTypes.array,\n backgroundColor: PropTypes.string,\n activeTextColor: PropTypes.string,\n inactiveTextColor: PropTypes.string,\n scrollOffset: PropTypes.number,\n style: ViewPropTypes.style,\n tabStyle: ViewPropTypes.style,\n tabsContainerStyle: ViewPropTypes.style,\n renderTab: PropTypes.func,\n underlineStyle: ViewPropTypes.style,\n onScroll: PropTypes.func\n },\n contextTypes: {\n theme: PropTypes.object\n },\n\n getDefaultProps() {\n return {\n scrollOffset: 52,\n activeTextColor: 'navy',\n inactiveTextColor: 'black',\n backgroundColor: variable.tabDefaultBg,\n style: {},\n tabStyle: {},\n tabsContainerStyle: {},\n underlineStyle: {},\n tabFontSize: variable.tabFontSize\n };\n },\n\n getInitialState() {\n this._tabsMeasurements = [];\n return {\n _leftTabUnderline: new Animated.Value(0),\n _widthTabUnderline: new Animated.Value(0),\n _containerWidth: null\n };\n },\n\n componentDidMount() {\n this.props.scrollValue.addListener(this.updateView);\n },\n\n updateView(offset) {\n const position = Math.floor(offset.value);\n const pageOffset = offset.value % 1;\n const tabCount = this.props.tabs.length;\n const lastTabPosition = tabCount - 1;\n\n if (tabCount === 0 || offset.value < 0 || offset.value > lastTabPosition) {\n return;\n }\n\n if (\n this.necessarilyMeasurementsCompleted(\n position,\n position === lastTabPosition\n )\n ) {\n this.updateTabPanel(position, pageOffset);\n this.updateTabUnderline(position, pageOffset, tabCount);\n }\n },\n\n necessarilyMeasurementsCompleted(position, isLastTab) {\n return (\n this._tabsMeasurements[position] &&\n (isLastTab || this._tabsMeasurements[position + 1]) &&\n this._tabContainerMeasurements &&\n this._containerMeasurements\n );\n },\n\n updateTabPanel(position, pageOffset) {\n const containerWidth = this._containerMeasurements.width;\n const tabWidth = this._tabsMeasurements[position].width;\n const nextTabMeasurements = this._tabsMeasurements[position + 1];\n const nextTabWidth =\n (nextTabMeasurements && nextTabMeasurements.width) || 0;\n const tabOffset = this._tabsMeasurements[position].left;\n const absolutePageOffset = pageOffset * tabWidth;\n let newScrollX = tabOffset + absolutePageOffset;\n\n // center tab and smooth tab change (for when tabWidth changes a lot between two tabs)\n newScrollX -=\n (containerWidth -\n (1 - pageOffset) * tabWidth -\n pageOffset * nextTabWidth) /\n 2;\n newScrollX = newScrollX >= 0 ? newScrollX : 0;\n\n if (Platform.OS === 'android') {\n this._scrollView.scrollTo({ x: newScrollX, y: 0, animated: false });\n } else {\n const rightBoundScroll =\n this._tabContainerMeasurements.width -\n this._containerMeasurements.width;\n newScrollX =\n newScrollX > rightBoundScroll ? rightBoundScroll : newScrollX;\n this._scrollView.scrollTo({ x: newScrollX, y: 0, animated: false });\n }\n },\n\n updateTabUnderline(position, pageOffset, tabCount) {\n const lineLeft = this._tabsMeasurements[position].left;\n const lineRight = this._tabsMeasurements[position].right;\n\n if (position < tabCount - 1) {\n const nextTabLeft = this._tabsMeasurements[position + 1].left;\n const nextTabRight = this._tabsMeasurements[position + 1].right;\n\n const newLineLeft =\n pageOffset * nextTabLeft + (1 - pageOffset) * lineLeft;\n const newLineRight =\n pageOffset * nextTabRight + (1 - pageOffset) * lineRight;\n\n this.state._leftTabUnderline.setValue(newLineLeft);\n this.state._widthTabUnderline.setValue(newLineRight - newLineLeft);\n } else {\n this.state._leftTabUnderline.setValue(lineLeft);\n this.state._widthTabUnderline.setValue(lineRight - lineLeft);\n }\n },\n\n renderTab(\n name,\n page,\n isTabActive,\n onPressHandler,\n onLayoutHandler,\n tabStyle,\n activeTabStyle,\n textStyle,\n activeTextStyle,\n tabHeaderStyle,\n tabFontSize\n ) {\n const headerContent =\n typeof name !== 'string' ? name.props.children : undefined;\n const { activeTextColor, inactiveTextColor } = this.props;\n const textColor = isTabActive ? activeTextColor : inactiveTextColor;\n const fontWeight = isTabActive ? 'bold' : 'normal';\n\n if (typeof name === 'string') {\n return (\n onPressHandler(page)}\n onLayout={onLayoutHandler}\n >\n \n \n {name}\n \n \n \n );\n }\n return (\n onPressHandler(page)}\n onLayout={onLayoutHandler}\n >\n \n {headerContent}\n \n \n );\n \n },\n\n measureTab(page, event) {\n const { x, width, height } = event.nativeEvent.layout;\n this._tabsMeasurements[page] = { left: x, right: x + width, width, height };\n this.updateView({ value: this.props.scrollValue._value });\n },\n\n render() {\n const variables = this.context.theme\n ? this.context.theme['@@shoutem.theme/themeStyle'].variables\n : variable;\n const tabUnderlineStyle = {\n position: 'absolute',\n height: 4,\n backgroundColor: variables.topTabBarActiveBorderColor,\n bottom: 0\n };\n\n const dynamicTabUnderline = {\n left: this.state._leftTabUnderline,\n width: this.state._widthTabUnderline\n };\n\n return (\n \n {\n this._scrollView = scrollView;\n }}\n horizontal\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n directionalLockEnabled\n onScroll={this.props.onScroll}\n bounces={false}\n scrollsToTop={false}\n >\n \n {this.props.tabs.map((name, page) => {\n const isTabActive = this.props.activeTab === page;\n const renderTab = this.props.renderTab || this.renderTab;\n return renderTab(\n name,\n page,\n isTabActive,\n this.props.goToPage,\n this.measureTab.bind(this, page),\n this.props.tabStyle[page],\n this.props.activeTabStyle[page],\n this.props.textStyle[page],\n this.props.activeTextStyle[page],\n this.props.tabHeaderStyle[page],\n variables.tabFontSize\n );\n })}\n \n \n \n \n );\n },\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n // If the tabs change, force the width of the tabs container to be recalculated\n if (\n !isEqual(this.props.tabs, nextProps.tabs) &&\n this.state._containerWidth\n ) {\n this.setState({ _containerWidth: null });\n }\n },\n\n onTabContainerLayout(e) {\n this._tabContainerMeasurements = e.nativeEvent.layout;\n let width = this._tabContainerMeasurements.width;\n if (width < WINDOW_WIDTH) {\n width = WINDOW_WIDTH;\n }\n this.setState({ _containerWidth: width });\n this.updateView({ value: this.props.scrollValue._value });\n },\n\n onContainerLayout(e) {\n this._containerMeasurements = e.nativeEvent.layout;\n this.updateView({ value: this.props.scrollValue._value });\n }\n});\n\n// module.exports = ScrollableTabBar;\nconst StyledTab = connectStyle(\n 'NativeBase.ScrollableTab',\n {},\n mapPropsToStyleNames\n)(ScrollableTabBar);\nexport { StyledTab as ScrollableTab };\nconst styles = StyleSheet.create({\n tab: {\n height: 49,\n alignItems: 'center',\n justifyContent: 'center',\n paddingLeft: 20,\n paddingRight: 20\n },\n container: {\n height: 50,\n borderWidth: 1,\n borderTopWidth: 0,\n borderLeftWidth: 0,\n borderRightWidth: 0,\n borderColor: '#ccc'\n },\n tabs: {\n flexDirection: 'row',\n justifyContent: 'space-around'\n }\n});\n"]} \ No newline at end of file diff --git a/dist/src/basic/Tabs/index.js b/dist/src/basic/Tabs/index.js index 5a19689e1..eccb5244a 100644 --- a/dist/src/basic/Tabs/index.js +++ b/dist/src/basic/Tabs/index.js @@ -1,2 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i=0&&props.page!==this.state.currentPage){this.goToPage(props.page);}},goToPage:function goToPage(pageNumber){var offset=pageNumber*this.state.containerWidth;if(this.scrollView){this.scrollView.scrollTo({x:offset,y:0,animated:!this.props.scrollWithoutAnimation});}var currentPage=this.state.currentPage;this.updateSceneKeys({page:pageNumber,callback:this._onChangeTab.bind(this,currentPage,pageNumber)});},renderTabBar:function renderTabBar(props){if(this.props.renderTabBar===false){return null;}else if(this.props.renderTabBar){return React.cloneElement(this.props.renderTabBar(props),props);}return React.createElement(DefaultTabBar,_extends({},props,{__source:{fileName:_jsxFileName,lineNumber:116}}));},updateSceneKeys:function updateSceneKeys(_ref){var page=_ref.page,_ref$children=_ref.children,children=_ref$children===undefined?this.props.children:_ref$children,_ref$callback=_ref.callback,callback=_ref$callback===undefined?function(){}:_ref$callback;var newKeys=this.newSceneKeys({previousKeys:this.state.sceneKeys,currentPage:page,children:children});this.setState({currentPage:page,sceneKeys:newKeys},callback);},newSceneKeys:function newSceneKeys(_ref2){var _this2=this;var _ref2$previousKeys=_ref2.previousKeys,previousKeys=_ref2$previousKeys===undefined?[]:_ref2$previousKeys,_ref2$currentPage=_ref2.currentPage,currentPage=_ref2$currentPage===undefined?0:_ref2$currentPage,_ref2$children=_ref2.children,children=_ref2$children===undefined?this.props.children:_ref2$children;var newKeys=[];this._children(children).forEach(function(child,idx){var key=_this2._makeSceneKey(child,idx);if(_this2._keyExists(previousKeys,key)||_this2._shouldRenderSceneKey(idx,currentPage)){newKeys.push(key);}});return newKeys;},_shouldRenderSceneKey:function _shouldRenderSceneKey(idx,currentPageKey){var numOfSibling=this.props.prerenderingSiblingsNumber;return idxcurrentPageKey-numOfSibling-1;},_keyExists:function _keyExists(sceneKeys,key){return sceneKeys.find(function(sceneKey){return key===sceneKey;});},_makeSceneKey:function _makeSceneKey(child,idx){return child.props.heading+'_'+idx;},renderScrollableContent:function renderScrollableContent(){var _this3=this;var scenes=this._composeScenes();return React.createElement(ScrollView,_extends({horizontal:true,pagingEnabled:true,automaticallyAdjustContentInsets:false,keyboardShouldPersistTaps:'handled',contentOffset:{x:this.props.initialPage*this.state.containerWidth},ref:function ref(scrollView){_this3.scrollView=scrollView;},onScroll:function onScroll(e){var offsetX=e.nativeEvent.contentOffset.x;_this3._updateScrollValue(offsetX/_this3.state.containerWidth);},onMomentumScrollBegin:this._onMomentumScrollBeginAndEnd,onMomentumScrollEnd:this._onMomentumScrollBeginAndEnd,scrollEventThrottle:16,scrollsToTop:false,showsHorizontalScrollIndicator:false,scrollEnabled:!this.props.locked,directionalLockEnabled:true,alwaysBounceVertical:false,keyboardDismissMode:'on-drag'},this.props.contentProps,{__source:{fileName:_jsxFileName,lineNumber:169}}),scenes);},_composeScenes:function _composeScenes(){var _this4=this;return this._children().map(function(child,idx){var key=_this4._makeSceneKey(child,idx);return React.createElement(SceneComponent,{key:child.key,shouldUpdated:_this4._shouldRenderSceneKey(idx,_this4.state.currentPage),style:{width:_this4.state.containerWidth},__source:{fileName:_jsxFileName,lineNumber:204}},_this4._keyExists(_this4.state.sceneKeys,key)?child:React.createElement(View,{heading:child.props.heading,__source:{fileName:_jsxFileName,lineNumber:215}}));});},_onMomentumScrollBeginAndEnd:function _onMomentumScrollBeginAndEnd(e){var offsetX=e.nativeEvent.contentOffset.x;var page=Math.round(offsetX/this.state.containerWidth);if(this.state.currentPage!==page){this._updateSelectedPage(page);}},_updateSelectedPage:function _updateSelectedPage(nextPage){var localNextPage=nextPage;if(typeof localNextPage==='object'){localNextPage=nextPage.nativeEvent.position;}var currentPage=this.state.currentPage;this.updateSceneKeys({page:localNextPage,callback:this._onChangeTab.bind(this,currentPage,localNextPage)});},_onChangeTab:function _onChangeTab(prevPage,currentPage){this.props.onChangeTab({i:currentPage,ref:this._children()[currentPage],from:prevPage});},_updateScrollValue:function _updateScrollValue(value){this.state.scrollValue.setValue(value);this.props.onScroll(value);},_handleLayout:function _handleLayout(e){var _this5=this;var width=e.nativeEvent.layout.width;if(!width||width<=0||Math.round(width)===Math.round(this.state.containerWidth)){return;}this.setState({containerWidth:width});this.requestAnimationFrame(function(){_this5.goToPage(_this5.state.currentPage);});},_children:function _children(){var children=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.props.children;return React.Children.map(children,function(child){return child;});},render:function render(){var overlayTabs=this.props.tabBarPosition==='overlayTop'||this.props.tabBarPosition==='overlayBottom';var tabBarProps={goToPage:this.goToPage,tabs:this._children().map(function(child){return child.props.heading;}),tabStyle:this._children().map(function(child){return child.props.tabStyle;}),activeTabStyle:this._children().map(function(child){return child.props.activeTabStyle;}),textStyle:this._children().map(function(child){return child.props.textStyle;}),activeTextStyle:this._children().map(function(child){return child.props.activeTextStyle;}),tabHeaderStyle:this._children().map(function(child){return _lodash2.default.get(child.props.heading.props,'style',undefined);}),disabled:this._children().map(function(child){return child.props.disabled;}),activeTab:this.state.currentPage,scrollValue:this.state.scrollValue,containerWidth:this.state.containerWidth};if(this.props.tabBarBackgroundColor){tabBarProps.backgroundColor=this.props.tabBarBackgroundColor;}if(this.props.tabBarActiveTextColor){tabBarProps.activeTextColor=this.props.tabBarActiveTextColor;}if(this.props.tabBarInactiveTextColor){tabBarProps.inactiveTextColor=this.props.tabBarInactiveTextColor;}if(this.props.tabBarTextStyle){tabBarProps.textStyle=this.props.tabBarTextStyle;}if(this.props.tabBarUnderlineStyle){tabBarProps.underlineStyle=this.props.tabBarUnderlineStyle;}if(this.props.tabContainerStyle){tabBarProps.tabContainerStyle=this.props.tabContainerStyle;}if(overlayTabs){var _tabBarProps$style;tabBarProps.style=(_tabBarProps$style={position:'absolute',left:0,right:0},_defineProperty(_tabBarProps$style,this.props.tabBarPosition==='overlayTop'?'top':'bottom',0),_defineProperty(_tabBarProps$style,'backgroundColor','rgba(255, 255, 255, 0.7)'),_tabBarProps$style);}return React.createElement(View,{style:[styles.container,this.props.style],onLayout:this._handleLayout,__source:{fileName:_jsxFileName,lineNumber:327}},(this.props.tabBarPosition==='top'||this.props.tabBarPosition==='overlayTop')&&this.renderTabBar(tabBarProps),this.renderScrollableContent(),(this.props.tabBarPosition==='bottom'||this.props.tabBarPosition==='overlayBottom')&&this.renderTabBar(tabBarProps));}});exports.default=ScrollableTabView;var styles=StyleSheet.create({container:{flex:1},scrollableContentAndroid:{flex:1}}); +Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i=0&&props.page!==this.state.currentPage){this.goToPage(props.page);}},goToPage:function goToPage(pageNumber){var offset=pageNumber*this.state.containerWidth;if(this.scrollView){this.scrollView.scrollTo({x:offset,y:0,animated:!this.props.scrollWithoutAnimation});}var currentPage=this.state.currentPage;this.updateSceneKeys({page:pageNumber,callback:this._onChangeTab.bind(this,currentPage,pageNumber)});},renderTabBar:function renderTabBar(props){if(this.props.renderTabBar===false){return null;}else if(this.props.renderTabBar){return React.cloneElement(this.props.renderTabBar(props),props);}return React.createElement(DefaultTabBar,_extends({},props,{__source:{fileName:_jsxFileName,lineNumber:116}}));},updateSceneKeys:function updateSceneKeys(_ref){var page=_ref.page,_ref$children=_ref.children,children=_ref$children===undefined?this.props.children:_ref$children,_ref$callback=_ref.callback,callback=_ref$callback===undefined?function(){}:_ref$callback;var newKeys=this.newSceneKeys({previousKeys:this.state.sceneKeys,currentPage:page,children:children});this.setState({currentPage:page,sceneKeys:newKeys},callback);},newSceneKeys:function newSceneKeys(_ref2){var _this2=this;var _ref2$previousKeys=_ref2.previousKeys,previousKeys=_ref2$previousKeys===undefined?[]:_ref2$previousKeys,_ref2$currentPage=_ref2.currentPage,currentPage=_ref2$currentPage===undefined?0:_ref2$currentPage,_ref2$children=_ref2.children,children=_ref2$children===undefined?this.props.children:_ref2$children;var newKeys=[];this._children(children).forEach(function(child,idx){var key=_this2._makeSceneKey(child,idx);if(_this2._keyExists(previousKeys,key)||_this2._shouldRenderSceneKey(idx,currentPage)){newKeys.push(key);}});return newKeys;},_shouldRenderSceneKey:function _shouldRenderSceneKey(idx,currentPageKey){var numOfSibling=this.props.prerenderingSiblingsNumber;return idxcurrentPageKey-numOfSibling-1;},_keyExists:function _keyExists(sceneKeys,key){return sceneKeys.find(function(sceneKey){return key===sceneKey;});},_makeSceneKey:function _makeSceneKey(child,idx){return child.props.heading+'_'+idx;},renderScrollableContent:function renderScrollableContent(){var _this3=this;var scenes=this._composeScenes();return React.createElement(ScrollView,_extends({horizontal:true,pagingEnabled:true,automaticallyAdjustContentInsets:false,keyboardShouldPersistTaps:'handled',contentOffset:{x:this.props.initialPage*this.state.containerWidth},ref:function ref(scrollView){_this3.scrollView=scrollView;},onScroll:function onScroll(e){var offsetX=e.nativeEvent.contentOffset.x;_this3._updateScrollValue(offsetX/_this3.state.containerWidth);},onMomentumScrollBegin:this._onMomentumScrollBeginAndEnd,onMomentumScrollEnd:this._onMomentumScrollBeginAndEnd,scrollEventThrottle:16,scrollsToTop:false,showsHorizontalScrollIndicator:false,scrollEnabled:!this.props.locked,directionalLockEnabled:true,alwaysBounceVertical:false,keyboardDismissMode:'on-drag'},this.props.contentProps,{__source:{fileName:_jsxFileName,lineNumber:169}}),scenes);},_composeScenes:function _composeScenes(){var _this4=this;return this._children().map(function(child,idx){var key=_this4._makeSceneKey(child,idx);return React.createElement(SceneComponent,{key:child.key,shouldUpdated:_this4._shouldRenderSceneKey(idx,_this4.state.currentPage),style:{width:_this4.state.containerWidth},__source:{fileName:_jsxFileName,lineNumber:204}},_this4._keyExists(_this4.state.sceneKeys,key)?child:React.createElement(View,{heading:child.props.heading,__source:{fileName:_jsxFileName,lineNumber:215}}));});},_onMomentumScrollBeginAndEnd:function _onMomentumScrollBeginAndEnd(e){var offsetX=e.nativeEvent.contentOffset.x;var page=Math.round(offsetX/this.state.containerWidth);if(this.state.currentPage!==page){this._updateSelectedPage(page);}},_updateSelectedPage:function _updateSelectedPage(nextPage){var localNextPage=nextPage;if(typeof localNextPage==='object'){localNextPage=nextPage.nativeEvent.position;}var currentPage=this.state.currentPage;this.updateSceneKeys({page:localNextPage,callback:this._onChangeTab.bind(this,currentPage,localNextPage)});},_onChangeTab:function _onChangeTab(prevPage,currentPage){this.props.onChangeTab({i:currentPage,ref:this._children()[currentPage],from:prevPage});},_updateScrollValue:function _updateScrollValue(value){this.state.scrollValue.setValue(value);this.props.onScroll(value);},_handleLayout:function _handleLayout(e){var _this5=this;var width=e.nativeEvent.layout.width;if(!width||width<=0||Math.round(width)===Math.round(this.state.containerWidth)){return;}this.setState({containerWidth:width});this.requestAnimationFrame(function(){_this5.goToPage(_this5.state.currentPage);});},_children:function _children(){var children=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.props.children;return React.Children.map(children,function(child){return child;});},render:function render(){var overlayTabs=this.props.tabBarPosition==='overlayTop'||this.props.tabBarPosition==='overlayBottom';var tabBarProps={goToPage:this.goToPage,tabs:this._children().map(function(child){return child.props.heading;}),tabStyle:this._children().map(function(child){return child.props.tabStyle;}),activeTabStyle:this._children().map(function(child){return child.props.activeTabStyle;}),textStyle:this._children().map(function(child){return child.props.textStyle;}),activeTextStyle:this._children().map(function(child){return child.props.activeTextStyle;}),tabHeaderStyle:this._children().map(function(child){return _lodash2.default.get(child.props.heading.props,'style',undefined);}),disabled:this._children().map(function(child){return child.props.disabled;}),activeTab:this.state.currentPage,scrollValue:this.state.scrollValue,containerWidth:this.state.containerWidth};if(this.props.tabBarBackgroundColor){tabBarProps.backgroundColor=this.props.tabBarBackgroundColor;}if(this.props.tabBarActiveTextColor){tabBarProps.activeTextColor=this.props.tabBarActiveTextColor;}if(this.props.tabBarInactiveTextColor){tabBarProps.inactiveTextColor=this.props.tabBarInactiveTextColor;}if(this.props.tabBarTextStyle){tabBarProps.textStyle=this.props.tabBarTextStyle;}if(this.props.tabBarUnderlineStyle){tabBarProps.underlineStyle=this.props.tabBarUnderlineStyle;}if(this.props.tabContainerStyle){tabBarProps.tabContainerStyle=this.props.tabContainerStyle;}if(overlayTabs){var _tabBarProps$style;tabBarProps.style=(_tabBarProps$style={position:'absolute',left:0,right:0},_defineProperty(_tabBarProps$style,this.props.tabBarPosition==='overlayTop'?'top':'bottom',0),_defineProperty(_tabBarProps$style,'backgroundColor','rgba(255, 255, 255, 0.7)'),_tabBarProps$style);}return React.createElement(View,{style:[styles.container,this.props.style],onLayout:this._handleLayout,__source:{fileName:_jsxFileName,lineNumber:327}},(this.props.tabBarPosition==='top'||this.props.tabBarPosition==='overlayTop')&&this.renderTabBar(tabBarProps),this.renderScrollableContent(),(this.props.tabBarPosition==='bottom'||this.props.tabBarPosition==='overlayBottom')&&this.renderTabBar(tabBarProps));}});exports.default=ScrollableTabView;var styles=StyleSheet.create({container:{flex:1},scrollableContentAndroid:{flex:1}}); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/src/basic/Tabs/index.js.map b/dist/src/basic/Tabs/index.js.map index e82ebfdbf..8c8d8c392 100644 --- a/dist/src/basic/Tabs/index.js.map +++ b/dist/src/basic/Tabs/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../../src/basic/Tabs/index.js"],"names":["React","require","Component","ReactNative","Dimensions","View","Animated","ScrollView","StyleSheet","Platform","TimerMixin","SceneComponent","DefaultTabBar","ScrollableTabBar","ScrollableTabView","mixins","statics","propTypes","tabBarPosition","PropTypes","oneOf","initialPage","number","page","onChangeTab","func","onScroll","renderTabBar","any","style","ViewPropTypes","contentProps","object","scrollWithoutAnimation","bool","locked","prerenderingSiblingsNumber","getDefaultProps","getInitialState","currentPage","props","scrollValue","Value","containerWidth","get","width","sceneKeys","newSceneKeys","componentDidMount","scrollFn","scrollView","state","setValue","InteractionManager","runAfterInteractions","componentDidUpdate","children","updateSceneKeys","goToPage","pageNumber","offset","scrollTo","x","y","animated","callback","_onChangeTab","bind","cloneElement","newKeys","previousKeys","setState","_children","forEach","child","idx","key","_makeSceneKey","_keyExists","_shouldRenderSceneKey","push","currentPageKey","numOfSibling","find","sceneKey","heading","renderScrollableContent","scenes","_composeScenes","offsetX","e","nativeEvent","contentOffset","_updateScrollValue","_onMomentumScrollBeginAndEnd","map","Math","round","_updateSelectedPage","nextPage","localNextPage","position","prevPage","i","ref","from","value","_handleLayout","layout","requestAnimationFrame","Children","render","overlayTabs","tabBarProps","tabs","tabStyle","activeTabStyle","textStyle","activeTextStyle","tabHeaderStyle","_","undefined","disabled","activeTab","tabBarBackgroundColor","backgroundColor","tabBarActiveTextColor","activeTextColor","tabBarInactiveTextColor","inactiveTextColor","tabBarTextStyle","tabBarUnderlineStyle","underlineStyle","tabContainerStyle","left","right","styles","container","create","flex","scrollableContentAndroid"],"mappings":"oUAAA,qC,mDACA,oD,iEACA,8B,6CACA,kC,yQACA,GAAMA,OAAQC,QAAQ,OAAR,CAAd,C,GACQC,U,CAAcF,K,CAAdE,S,CACR,GAAMC,aAAcF,QAAQ,cAAR,CAApB,C,GAEEG,W,CAMED,W,CANFC,U,CACAC,I,CAKEF,W,CALFE,I,CACAC,Q,CAIEH,W,CAJFG,Q,CACAC,U,CAGEJ,W,CAHFI,U,CACAC,U,CAEEL,W,CAFFK,U,CACAC,Q,CACEN,W,CADFM,Q,CAEF,GAAMC,YAAaT,QAAQ,mBAAR,CAAnB,CAEA,GAAMU,gBAAiBV,QAAQ,kBAAR,CAAvB,C,aAC0BA,QAAQ,iBAAR,C,CAAlBW,a,UAAAA,a,eACqBX,QAAQ,oBAAR,C,CAArBY,gB,WAAAA,gB,CAER,GAAMC,mBAAoB,+BAAiB,iCACzCC,OAAQ,CAACL,UAAD,CADiC,CAEzCM,QAAS,CACPJ,2BADO,CAEPC,iCAFO,CAFgC,CAOzCI,UAAW,CACTC,eAAgBC,oBAAUC,KAAV,CAAgB,CAC9B,KAD8B,CAE9B,QAF8B,CAG9B,YAH8B,CAI9B,eAJ8B,CAAhB,CADP,CAOTC,YAAaF,oBAAUG,MAPd,CAQTC,KAAMJ,oBAAUG,MARP,CASTE,YAAaL,oBAAUM,IATd,CAUTC,SAAUP,oBAAUM,IAVX,CAWTE,aAAcR,oBAAUS,GAXf,CAYTC,MAAOC,qBAAcD,KAZZ,CAaTE,aAAcZ,oBAAUa,MAbf,CAcTC,uBAAwBd,oBAAUe,IAdzB,CAeTC,OAAQhB,oBAAUe,IAfT,CAgBTE,2BAA4BjB,oBAAUG,MAhB7B,CAP8B,CA0BzCe,eA1ByC,2BA0BvB,CAChB,MAAO,CACLnB,eAAgB,KADX,CAELG,YAAa,CAFR,CAGLE,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AmB,KAAKjG,KAAL,CAAWX,KAA9B,CADT,CAEE,SAAU,KAAK8E,aAFjB,kDAIG,CAAC,KAAKnE,KAAL,CAAWtB,cAAX,GAA8B,KAA9B,EACA,KAAKsB,KAAL,CAAWtB,cAAX,GAA8B,YAD/B,GAEC,KAAKS,YAAL,CAAkBsF,WAAlB,CANJ,CAOG,KAAK3B,uBAAL,EAPH,CAQG,CAAC,KAAK9C,KAAL,CAAWtB,cAAX,GAA8B,QAA9B,EACA,KAAKsB,KAAL,CAAWtB,cAAX,GAA8B,eAD/B,GAEC,KAAKS,YAAL,CAAkBsF,WAAlB,CAVJ,CADF,CAcD,CA9TwC,CAAjB,CAA1B,C,gBAiUenG,iB,CAEf,GAAM0H,QAAShI,WAAWkI,MAAX,CAAkB,CAC/BD,UAAW,CACTE,KAAM,CADG,CADoB,CAI/BC,yBAA0B,CACxBD,KAAM,CADkB,CAJK,CAAlB,CAAf","file":"index.js","sourcesContent":["import PropTypes from 'prop-types';\nimport createReactClass from 'create-react-class';\nimport _ from 'lodash';\nimport { InteractionManager, ViewPropTypes } from '../../utils';\nconst React = require('react');\nconst { Component } = React;\nconst ReactNative = require('react-native');\nconst {\n Dimensions,\n View,\n Animated,\n ScrollView,\n StyleSheet,\n Platform\n} = ReactNative;\nconst TimerMixin = require('react-timer-mixin');\n\nconst SceneComponent = require('./SceneComponent');\nconst { DefaultTabBar } = require('./DefaultTabBar');\nconst { ScrollableTabBar } = require('./ScrollableTabBar');\n\nconst ScrollableTabView = createReactClass({\n mixins: [TimerMixin],\n statics: {\n DefaultTabBar,\n ScrollableTabBar\n },\n\n propTypes: {\n tabBarPosition: PropTypes.oneOf([\n 'top',\n 'bottom',\n 'overlayTop',\n 'overlayBottom'\n ]),\n initialPage: PropTypes.number,\n page: PropTypes.number,\n onChangeTab: PropTypes.func,\n onScroll: PropTypes.func,\n renderTabBar: PropTypes.any,\n style: ViewPropTypes.style,\n contentProps: PropTypes.object,\n scrollWithoutAnimation: PropTypes.bool,\n locked: PropTypes.bool,\n prerenderingSiblingsNumber: PropTypes.number\n },\n\n getDefaultProps() {\n return {\n tabBarPosition: 'top',\n initialPage: 0,\n page: -1,\n onChangeTab: () => {},\n onScroll: () => {},\n contentProps: {},\n scrollWithoutAnimation: false,\n locked: false,\n prerenderingSiblingsNumber: 0\n };\n },\n\n getInitialState() {\n return {\n currentPage: this.props.initialPage,\n scrollValue: new Animated.Value(this.props.initialPage),\n containerWidth: Dimensions.get('window').width,\n sceneKeys: this.newSceneKeys({ currentPage: this.props.initialPage })\n };\n },\n\n componentDidMount() {\n const scrollFn = () => {\n if (this.scrollView) {\n this.state.scrollValue.setValue(this.props.initialPage);\n }\n };\n InteractionManager.runAfterInteractions(scrollFn);\n },\n\n componentDidUpdate(props) {\n if (props.children !== this.props.children) {\n this.updateSceneKeys({\n page: this.state.currentPage,\n children: props.children\n });\n }\n\n if (props.page >= 0 && props.page !== this.state.currentPage) {\n this.goToPage(props.page);\n }\n },\n\n goToPage(pageNumber) {\n const offset = pageNumber * this.state.containerWidth;\n if (this.scrollView) {\n this.scrollView.scrollTo({\n x: offset,\n y: 0,\n animated: !this.props.scrollWithoutAnimation\n });\n }\n\n const currentPage = this.state.currentPage;\n this.updateSceneKeys({\n page: pageNumber,\n callback: this._onChangeTab.bind(this, currentPage, pageNumber)\n });\n },\n\n renderTabBar(props) {\n if (this.props.renderTabBar === false) {\n return null;\n } else if (this.props.renderTabBar) {\n return React.cloneElement(this.props.renderTabBar(props), props);\n }\n return ;\n },\n\n updateSceneKeys({\n page,\n children = this.props.children,\n callback = () => {}\n }) {\n const newKeys = this.newSceneKeys({\n previousKeys: this.state.sceneKeys,\n currentPage: page,\n children\n });\n this.setState({ currentPage: page, sceneKeys: newKeys }, callback);\n },\n\n newSceneKeys({\n previousKeys = [],\n currentPage = 0,\n children = this.props.children\n }) {\n const newKeys = [];\n this._children(children).forEach((child, idx) => {\n const key = this._makeSceneKey(child, idx);\n if (\n this._keyExists(previousKeys, key) ||\n this._shouldRenderSceneKey(idx, currentPage)\n ) {\n newKeys.push(key);\n }\n });\n return newKeys;\n },\n\n _shouldRenderSceneKey(idx, currentPageKey) {\n const numOfSibling = this.props.prerenderingSiblingsNumber;\n return (\n idx < currentPageKey + numOfSibling + 1 &&\n idx > currentPageKey - numOfSibling - 1\n );\n },\n\n _keyExists(sceneKeys, key) {\n return sceneKeys.find(sceneKey => key === sceneKey);\n },\n\n _makeSceneKey(child, idx) {\n return `${child.props.heading}_${idx}`;\n },\n\n renderScrollableContent() {\n const scenes = this._composeScenes();\n return (\n {\n this.scrollView = scrollView;\n }}\n onScroll={e => {\n const offsetX = e.nativeEvent.contentOffset.x;\n this._updateScrollValue(offsetX / this.state.containerWidth);\n }}\n onMomentumScrollBegin={this._onMomentumScrollBeginAndEnd}\n onMomentumScrollEnd={this._onMomentumScrollBeginAndEnd}\n scrollEventThrottle={16}\n scrollsToTop={false}\n showsHorizontalScrollIndicator={false}\n scrollEnabled={!this.props.locked}\n directionalLockEnabled\n alwaysBounceVertical={false}\n keyboardDismissMode=\"on-drag\"\n {...this.props.contentProps}\n >\n {scenes}\n \n );\n },\n\n _composeScenes() {\n return this._children().map((child, idx) => {\n const key = this._makeSceneKey(child, idx);\n return (\n \n {this._keyExists(this.state.sceneKeys, key) ? (\n child\n ) : (\n \n )}\n \n );\n });\n },\n\n _onMomentumScrollBeginAndEnd(e) {\n const offsetX = e.nativeEvent.contentOffset.x;\n const page = Math.round(offsetX / this.state.containerWidth);\n if (this.state.currentPage !== page) {\n this._updateSelectedPage(page);\n }\n },\n\n _updateSelectedPage(nextPage) {\n let localNextPage = nextPage;\n if (typeof localNextPage === 'object') {\n localNextPage = nextPage.nativeEvent.position;\n }\n\n const currentPage = this.state.currentPage;\n this.updateSceneKeys({\n page: localNextPage,\n callback: this._onChangeTab.bind(this, currentPage, localNextPage)\n });\n },\n\n _onChangeTab(prevPage, currentPage) {\n this.props.onChangeTab({\n i: currentPage,\n ref: this._children()[currentPage],\n from: prevPage\n });\n },\n\n _updateScrollValue(value) {\n this.state.scrollValue.setValue(value);\n this.props.onScroll(value);\n },\n\n _handleLayout(e) {\n const { width } = e.nativeEvent.layout;\n\n if (\n !width ||\n width <= 0 ||\n Math.round(width) === Math.round(this.state.containerWidth)\n ) {\n return;\n }\n this.setState({ containerWidth: width });\n this.requestAnimationFrame(() => {\n this.goToPage(this.state.currentPage);\n });\n },\n\n _children(children = this.props.children) {\n return React.Children.map(children, child => child);\n },\n\n render() {\n const overlayTabs =\n this.props.tabBarPosition === 'overlayTop' ||\n this.props.tabBarPosition === 'overlayBottom';\n const tabBarProps = {\n goToPage: this.goToPage,\n tabs: this._children().map(child => child.props.heading),\n tabStyle: this._children().map(child => child.props.tabStyle),\n activeTabStyle: this._children().map(child => child.props.activeTabStyle),\n textStyle: this._children().map(child => child.props.textStyle),\n activeTextStyle: this._children().map(\n child => child.props.activeTextStyle\n ),\n tabHeaderStyle: this._children().map(child =>\n _.get(child.props.heading.props, 'style', undefined)\n ),\n disabled: this._children().map(child => child.props.disabled),\n activeTab: this.state.currentPage,\n scrollValue: this.state.scrollValue,\n containerWidth: this.state.containerWidth\n };\n\n if (this.props.tabBarBackgroundColor) {\n tabBarProps.backgroundColor = this.props.tabBarBackgroundColor;\n }\n if (this.props.tabBarActiveTextColor) {\n tabBarProps.activeTextColor = this.props.tabBarActiveTextColor;\n }\n if (this.props.tabBarInactiveTextColor) {\n tabBarProps.inactiveTextColor = this.props.tabBarInactiveTextColor;\n }\n if (this.props.tabBarTextStyle) {\n tabBarProps.textStyle = this.props.tabBarTextStyle;\n }\n if (this.props.tabBarUnderlineStyle) {\n tabBarProps.underlineStyle = this.props.tabBarUnderlineStyle;\n }\n if (this.props.tabContainerStyle) {\n tabBarProps.tabContainerStyle = this.props.tabContainerStyle;\n }\n if (overlayTabs) {\n tabBarProps.style = {\n position: 'absolute',\n left: 0,\n right: 0,\n [this.props.tabBarPosition === 'overlayTop' ? 'top' : 'bottom']: 0,\n backgroundColor: 'rgba(255, 255, 255, 0.7)'\n };\n }\n\n return (\n \n {(this.props.tabBarPosition === 'top' ||\n this.props.tabBarPosition === 'overlayTop') &&\n this.renderTabBar(tabBarProps)}\n {this.renderScrollableContent()}\n {(this.props.tabBarPosition === 'bottom' ||\n this.props.tabBarPosition === 'overlayBottom') &&\n this.renderTabBar(tabBarProps)}\n \n );\n }\n});\n\nexport default ScrollableTabView;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1\n },\n scrollableContentAndroid: {\n flex: 1\n }\n});\n"]} \ No newline at end of file +{"version":3,"sources":["../../../../src/basic/Tabs/index.js"],"names":["React","require","Component","ReactNative","Dimensions","View","Animated","ScrollView","StyleSheet","Platform","TimerMixin","SceneComponent","DefaultTabBar","ScrollableTabBar","ScrollableTabView","mixins","statics","propTypes","tabBarPosition","PropTypes","oneOf","initialPage","number","page","onChangeTab","func","onScroll","renderTabBar","any","style","ViewPropTypes","contentProps","object","scrollWithoutAnimation","bool","locked","prerenderingSiblingsNumber","getDefaultProps","getInitialState","currentPage","props","scrollValue","Value","containerWidth","get","width","sceneKeys","newSceneKeys","componentDidMount","scrollFn","scrollView","state","setValue","InteractionManager","runAfterInteractions","UNSAFE_componentWillReceiveProps","children","updateSceneKeys","goToPage","pageNumber","offset","scrollTo","x","y","animated","callback","_onChangeTab","bind","cloneElement","newKeys","previousKeys","setState","_children","forEach","child","idx","key","_makeSceneKey","_keyExists","_shouldRenderSceneKey","push","currentPageKey","numOfSibling","find","sceneKey","heading","renderScrollableContent","scenes","_composeScenes","offsetX","e","nativeEvent","contentOffset","_updateScrollValue","_onMomentumScrollBeginAndEnd","map","Math","round","_updateSelectedPage","nextPage","localNextPage","position","prevPage","i","ref","from","value","_handleLayout","layout","requestAnimationFrame","Children","render","overlayTabs","tabBarProps","tabs","tabStyle","activeTabStyle","textStyle","activeTextStyle","tabHeaderStyle","_","undefined","disabled","activeTab","tabBarBackgroundColor","backgroundColor","tabBarActiveTextColor","activeTextColor","tabBarInactiveTextColor","inactiveTextColor","tabBarTextStyle","tabBarUnderlineStyle","underlineStyle","tabContainerStyle","left","right","styles","container","create","flex","scrollableContentAndroid"],"mappings":"oUAAA,qC,mDACA,oD,iEACA,8B,6CACA,kC,yQACA,GAAMA,OAAQC,QAAQ,OAAR,CAAd,C,GACQC,U,CAAcF,K,CAAdE,S,CACR,GAAMC,aAAcF,QAAQ,cAAR,CAApB,C,GAEEG,W,CAMED,W,CANFC,U,CACAC,I,CAKEF,W,CALFE,I,CACAC,Q,CAIEH,W,CAJFG,Q,CACAC,U,CAGEJ,W,CAHFI,U,CACAC,U,CAEEL,W,CAFFK,U,CACAC,Q,CACEN,W,CADFM,Q,CAEF,GAAMC,YAAaT,QAAQ,mBAAR,CAAnB,CAEA,GAAMU,gBAAiBV,QAAQ,kBAAR,CAAvB,C,aAC0BA,QAAQ,iBAAR,C,CAAlBW,a,UAAAA,a,eACqBX,QAAQ,oBAAR,C,CAArBY,gB,WAAAA,gB,CAER,GAAMC,mBAAoB,+BAAiB,iCACzCC,OAAQ,CAACL,UAAD,CADiC,CAEzCM,QAAS,CACPJ,2BADO,CAEPC,iCAFO,CAFgC,CAOzCI,UAAW,CACTC,eAAgBC,oBAAUC,KAAV,CAAgB,CAC9B,KAD8B,CAE9B,QAF8B,CAG9B,YAH8B,CAI9B,eAJ8B,CAAhB,CADP,CAOTC,YAAaF,oBAAUG,MAPd,CAQTC,KAAMJ,oBAAUG,MARP,CASTE,YAAaL,oBAAUM,IATd,CAUTC,SAAUP,oBAAUM,IAVX,CAWTE,aAAcR,oBAAUS,GAXf,CAYTC,MAAOC,qBAAcD,KAZZ,CAaTE,aAAcZ,oBAAUa,MAbf,CAcTC,uBAAwBd,oBAAUe,IAdzB,CAeTC,OAAQhB,oBAAUe,IAfT,CAgBTE,2BAA4BjB,oBAAUG,MAhB7B,CAP8B,CA0BzCe,eA1ByC,2BA0BvB,CAChB,MAAO,CACLnB,eAAgB,KADX,CAELG,YAAa,CAFR,CAGLE,KAAM,CAAC,CAHF,C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AAWX,KAA9B,CADT,CAEE,SAAU,KAAK8E,aAFjB,kDAIG,CAAC,KAAKnE,KAAL,CAAWtB,cAAX,GAA8B,KAA9B,EACA,KAAKsB,KAAL,CAAWtB,cAAX,GAA8B,YAD/B,GAEC,KAAKS,YAAL,CAAkBsF,WAAlB,CANJ,CAOG,KAAK3B,uBAAL,EAPH,CAQG,CAAC,KAAK9C,KAAL,CAAWtB,cAAX,GAA8B,QAA9B,EACA,KAAKsB,KAAL,CAAWtB,cAAX,GAA8B,eAD/B,GAEC,KAAKS,YAAL,CAAkBsF,WAAlB,CAVJ,CADF,CAcD,CA9TwC,CAAjB,CAA1B,C,gBAiUenG,iB,CAEf,GAAM0H,QAAShI,WAAWkI,MAAX,CAAkB,CAC/BD,UAAW,CACTE,KAAM,CADG,CADoB,CAI/BC,yBAA0B,CACxBD,KAAM,CADkB,CAJK,CAAlB,CAAf","file":"index.js","sourcesContent":["import PropTypes from 'prop-types';\nimport createReactClass from 'create-react-class';\nimport _ from 'lodash';\nimport { InteractionManager, ViewPropTypes } from '../../utils';\nconst React = require('react');\nconst { Component } = React;\nconst ReactNative = require('react-native');\nconst {\n Dimensions,\n View,\n Animated,\n ScrollView,\n StyleSheet,\n Platform\n} = ReactNative;\nconst TimerMixin = require('react-timer-mixin');\n\nconst SceneComponent = require('./SceneComponent');\nconst { DefaultTabBar } = require('./DefaultTabBar');\nconst { ScrollableTabBar } = require('./ScrollableTabBar');\n\nconst ScrollableTabView = createReactClass({\n mixins: [TimerMixin],\n statics: {\n DefaultTabBar,\n ScrollableTabBar\n },\n\n propTypes: {\n tabBarPosition: PropTypes.oneOf([\n 'top',\n 'bottom',\n 'overlayTop',\n 'overlayBottom'\n ]),\n initialPage: PropTypes.number,\n page: PropTypes.number,\n onChangeTab: PropTypes.func,\n onScroll: PropTypes.func,\n renderTabBar: PropTypes.any,\n style: ViewPropTypes.style,\n contentProps: PropTypes.object,\n scrollWithoutAnimation: PropTypes.bool,\n locked: PropTypes.bool,\n prerenderingSiblingsNumber: PropTypes.number\n },\n\n getDefaultProps() {\n return {\n tabBarPosition: 'top',\n initialPage: 0,\n page: -1,\n onChangeTab: () => {},\n onScroll: () => {},\n contentProps: {},\n scrollWithoutAnimation: false,\n locked: false,\n prerenderingSiblingsNumber: 0\n };\n },\n\n getInitialState() {\n return {\n currentPage: this.props.initialPage,\n scrollValue: new Animated.Value(this.props.initialPage),\n containerWidth: Dimensions.get('window').width,\n sceneKeys: this.newSceneKeys({ currentPage: this.props.initialPage })\n };\n },\n\n componentDidMount() {\n const scrollFn = () => {\n if (this.scrollView) {\n this.state.scrollValue.setValue(this.props.initialPage);\n }\n };\n InteractionManager.runAfterInteractions(scrollFn);\n },\n\n UNSAFE_componentWillReceiveProps(props) {\n if (props.children !== this.props.children) {\n this.updateSceneKeys({\n page: this.state.currentPage,\n children: props.children\n });\n }\n\n if (props.page >= 0 && props.page !== this.state.currentPage) {\n this.goToPage(props.page);\n }\n },\n\n goToPage(pageNumber) {\n const offset = pageNumber * this.state.containerWidth;\n if (this.scrollView) {\n this.scrollView.scrollTo({\n x: offset,\n y: 0,\n animated: !this.props.scrollWithoutAnimation\n });\n }\n\n const currentPage = this.state.currentPage;\n this.updateSceneKeys({\n page: pageNumber,\n callback: this._onChangeTab.bind(this, currentPage, pageNumber)\n });\n },\n\n renderTabBar(props) {\n if (this.props.renderTabBar === false) {\n return null;\n } else if (this.props.renderTabBar) {\n return React.cloneElement(this.props.renderTabBar(props), props);\n }\n return ;\n },\n\n updateSceneKeys({\n page,\n children = this.props.children,\n callback = () => {}\n }) {\n const newKeys = this.newSceneKeys({\n previousKeys: this.state.sceneKeys,\n currentPage: page,\n children\n });\n this.setState({ currentPage: page, sceneKeys: newKeys }, callback);\n },\n\n newSceneKeys({\n previousKeys = [],\n currentPage = 0,\n children = this.props.children\n }) {\n const newKeys = [];\n this._children(children).forEach((child, idx) => {\n const key = this._makeSceneKey(child, idx);\n if (\n this._keyExists(previousKeys, key) ||\n this._shouldRenderSceneKey(idx, currentPage)\n ) {\n newKeys.push(key);\n }\n });\n return newKeys;\n },\n\n _shouldRenderSceneKey(idx, currentPageKey) {\n const numOfSibling = this.props.prerenderingSiblingsNumber;\n return (\n idx < currentPageKey + numOfSibling + 1 &&\n idx > currentPageKey - numOfSibling - 1\n );\n },\n\n _keyExists(sceneKeys, key) {\n return sceneKeys.find(sceneKey => key === sceneKey);\n },\n\n _makeSceneKey(child, idx) {\n return `${child.props.heading}_${idx}`;\n },\n\n renderScrollableContent() {\n const scenes = this._composeScenes();\n return (\n {\n this.scrollView = scrollView;\n }}\n onScroll={e => {\n const offsetX = e.nativeEvent.contentOffset.x;\n this._updateScrollValue(offsetX / this.state.containerWidth);\n }}\n onMomentumScrollBegin={this._onMomentumScrollBeginAndEnd}\n onMomentumScrollEnd={this._onMomentumScrollBeginAndEnd}\n scrollEventThrottle={16}\n scrollsToTop={false}\n showsHorizontalScrollIndicator={false}\n scrollEnabled={!this.props.locked}\n directionalLockEnabled\n alwaysBounceVertical={false}\n keyboardDismissMode=\"on-drag\"\n {...this.props.contentProps}\n >\n {scenes}\n \n );\n },\n\n _composeScenes() {\n return this._children().map((child, idx) => {\n const key = this._makeSceneKey(child, idx);\n return (\n \n {this._keyExists(this.state.sceneKeys, key) ? (\n child\n ) : (\n \n )}\n \n );\n });\n },\n\n _onMomentumScrollBeginAndEnd(e) {\n const offsetX = e.nativeEvent.contentOffset.x;\n const page = Math.round(offsetX / this.state.containerWidth);\n if (this.state.currentPage !== page) {\n this._updateSelectedPage(page);\n }\n },\n\n _updateSelectedPage(nextPage) {\n let localNextPage = nextPage;\n if (typeof localNextPage === 'object') {\n localNextPage = nextPage.nativeEvent.position;\n }\n\n const currentPage = this.state.currentPage;\n this.updateSceneKeys({\n page: localNextPage,\n callback: this._onChangeTab.bind(this, currentPage, localNextPage)\n });\n },\n\n _onChangeTab(prevPage, currentPage) {\n this.props.onChangeTab({\n i: currentPage,\n ref: this._children()[currentPage],\n from: prevPage\n });\n },\n\n _updateScrollValue(value) {\n this.state.scrollValue.setValue(value);\n this.props.onScroll(value);\n },\n\n _handleLayout(e) {\n const { width } = e.nativeEvent.layout;\n\n if (\n !width ||\n width <= 0 ||\n Math.round(width) === Math.round(this.state.containerWidth)\n ) {\n return;\n }\n this.setState({ containerWidth: width });\n this.requestAnimationFrame(() => {\n this.goToPage(this.state.currentPage);\n });\n },\n\n _children(children = this.props.children) {\n return React.Children.map(children, child => child);\n },\n\n render() {\n const overlayTabs =\n this.props.tabBarPosition === 'overlayTop' ||\n this.props.tabBarPosition === 'overlayBottom';\n const tabBarProps = {\n goToPage: this.goToPage,\n tabs: this._children().map(child => child.props.heading),\n tabStyle: this._children().map(child => child.props.tabStyle),\n activeTabStyle: this._children().map(child => child.props.activeTabStyle),\n textStyle: this._children().map(child => child.props.textStyle),\n activeTextStyle: this._children().map(\n child => child.props.activeTextStyle\n ),\n tabHeaderStyle: this._children().map(child =>\n _.get(child.props.heading.props, 'style', undefined)\n ),\n disabled: this._children().map(child => child.props.disabled),\n activeTab: this.state.currentPage,\n scrollValue: this.state.scrollValue,\n containerWidth: this.state.containerWidth\n };\n\n if (this.props.tabBarBackgroundColor) {\n tabBarProps.backgroundColor = this.props.tabBarBackgroundColor;\n }\n if (this.props.tabBarActiveTextColor) {\n tabBarProps.activeTextColor = this.props.tabBarActiveTextColor;\n }\n if (this.props.tabBarInactiveTextColor) {\n tabBarProps.inactiveTextColor = this.props.tabBarInactiveTextColor;\n }\n if (this.props.tabBarTextStyle) {\n tabBarProps.textStyle = this.props.tabBarTextStyle;\n }\n if (this.props.tabBarUnderlineStyle) {\n tabBarProps.underlineStyle = this.props.tabBarUnderlineStyle;\n }\n if (this.props.tabContainerStyle) {\n tabBarProps.tabContainerStyle = this.props.tabContainerStyle;\n }\n if (overlayTabs) {\n tabBarProps.style = {\n position: 'absolute',\n left: 0,\n right: 0,\n [this.props.tabBarPosition === 'overlayTop' ? 'top' : 'bottom']: 0,\n backgroundColor: 'rgba(255, 255, 255, 0.7)'\n };\n }\n\n return (\n \n {(this.props.tabBarPosition === 'top' ||\n this.props.tabBarPosition === 'overlayTop') &&\n this.renderTabBar(tabBarProps)}\n {this.renderScrollableContent()}\n {(this.props.tabBarPosition === 'bottom' ||\n this.props.tabBarPosition === 'overlayBottom') &&\n this.renderTabBar(tabBarProps)}\n \n );\n }\n});\n\nexport default ScrollableTabView;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1\n },\n scrollableContentAndroid: {\n flex: 1\n }\n});\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 33851baae..3e816235c 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "react-native-drawer": "2.5.1", "react-native-easy-grid": "0.2.1", "react-native-keyboard-aware-scroll-view": "0.8.0", - "react-native-vector-icons": "6.1.0", + "react-native-vector-icons": "^6.6.0", "react-timer-mixin": "^0.13.4", "react-tween-state": "^0.1.5", "tween-functions": "^1.0.1" diff --git a/yarn.lock b/yarn.lock index def126bf6..5f8a77135 100644 --- a/yarn.lock +++ b/yarn.lock @@ -697,6 +697,11 @@ ansi-regex@^3.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + ansi-styles@^2.1.0, ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -1807,6 +1812,11 @@ camelcase@^4.1.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + capture-exit@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" @@ -1962,6 +1972,15 @@ cliui@^4.0.0: strip-ansi "^4.0.0" wrap-ansi "^2.0.0" +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -2228,7 +2247,7 @@ debug@^4.1.0: dependencies: ms "^2.1.1" -decamelize@^1.1.1: +decamelize@^1.1.1, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= @@ -2379,6 +2398,11 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -3047,6 +3071,13 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + find-up@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -3199,6 +3230,11 @@ get-caller-file@^1.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + get-stdin@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" @@ -4550,6 +4586,14 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + locate-path@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -5405,6 +5449,13 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" +p-limit@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" + integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== + dependencies: + p-try "^2.0.0" + p-limit@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" @@ -5419,6 +5470,13 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + p-locate@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" @@ -5856,14 +5914,14 @@ react-native-keyboard-aware-scroll-view@0.8.0: prop-types "^15.6.2" react-native-iphone-x-helper "^1.0.3" -react-native-vector-icons@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/react-native-vector-icons/-/react-native-vector-icons-6.1.0.tgz#770a3f8ced692d75deb3afbb9829195ceed1eedd" - integrity sha512-1GF5I4VWgwnzBtVfAKNgEiR5ziHi5QaKL381wwApMzuiFgIJMNt5XIChuKwKoaiB86s+P5iMcYWxYCyENL96lA== +react-native-vector-icons@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/react-native-vector-icons/-/react-native-vector-icons-6.6.0.tgz#66cf004918eb05d90778d64bd42077c1800d481b" + integrity sha512-MImKVx8JEvVVBnaShMr7/yTX4Y062JZMupht1T+IEgbqBj4aQeQ1z2SH4VHWKNtWtppk4kz9gYyUiMWqx6tNSw== dependencies: lodash "^4.0.0" prop-types "^15.6.2" - yargs "^8.0.2" + yargs "^13.2.2" react-native@0.56.0: version "0.56.0" @@ -6237,6 +6295,11 @@ require-main-filename@^1.0.1: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + require-uncached@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" @@ -6736,6 +6799,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -6757,6 +6829,13 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-bom@3.0.0, strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" @@ -7266,6 +7345,15 @@ wrap-ansi@^2.0.0: string-width "^1.0.1" strip-ansi "^3.0.1" +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -7371,6 +7459,11 @@ y18n@^3.2.1: resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= +y18n@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" @@ -7381,6 +7474,14 @@ yallist@^3.0.0, yallist@^3.0.3: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== +yargs-parser@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" @@ -7413,24 +7514,21 @@ yargs@^11.0.0: y18n "^3.2.1" yargs-parser "^9.0.2" -yargs@^8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" - integrity sha1-YpmpBVsc78lp/355wdkY3Osiw2A= +yargs@^13.2.2: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - read-pkg-up "^2.0.0" + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" require-directory "^2.1.1" - require-main-filename "^1.0.1" + require-main-filename "^2.0.0" set-blocking "^2.0.0" - string-width "^2.0.0" + string-width "^3.0.0" which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" yargs@^9.0.0: version "9.0.1"