From 961b9ba7d1e008da9f86657115e646664e84269e Mon Sep 17 00:00:00 2001 From: jjskay <404784102@qq.com> Date: Tue, 8 Jan 2019 11:16:50 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=94=AF=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E4=BA=8C=E4=B8=89=E5=88=97=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/AreaPicker.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/view/AreaPicker.js b/view/AreaPicker.js index 94b5362..b7a378d 100644 --- a/view/AreaPicker.js +++ b/view/AreaPicker.js @@ -71,14 +71,14 @@ class AreaPicker extends BaseDialog { areaData.map((pitem) => { for (let pname in pitem) { province.push(pname) - if (pname == this.props.selectedValue[0]) { - pitem[pname].map(citem => { + if (this.props.selectedValue[1] && pname == this.props.selectedValue[0]) { + pitem[pname] && pitem[pname].map(citem => { for (let cname in citem) { if (firstCity == null) { firstCity = cname; } city.push(cname); - if (cname == this.props.selectedValue[1]) { + if (this.props.selectedValue[2] && cname == this.props.selectedValue[1]) { county = citem[cname]; if (firstCountry == null) { firstCountry = citem[cname][0]; @@ -90,17 +90,21 @@ class AreaPicker extends BaseDialog { } }); - if (county.indexOf(this.props.selectedValue[2]) == -1) { + if (this.props.selectedValue[2] && county && county.length && county.indexOf(this.props.selectedValue[2]) == -1) { this.props.selectedValue[2] = firstCountry; } - if (county.length == 0 && firstCity != null) { + if (this.props.selectedValue[2] && county && !county.length && firstCity != null) { this.props.selectedValue[1] = firstCity; return this.formatPickerData(); } + let pickerData = [province] + city && city.length && pickerData.push(city) + county && county.length && pickerData.push(county) + return { - pickerData: [province, city, county], visible: true + pickerData, visible: true }; } From b41a58e171052176786546cb2ee4a1409a0daa79 Mon Sep 17 00:00:00 2001 From: jjskay <404784102@qq.com> Date: Tue, 8 Jan 2019 13:58:25 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=94=AF=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E4=BA=8C=E4=B8=89=E5=88=97=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/AreaPicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/AreaPicker.js b/view/AreaPicker.js index b7a378d..33326b9 100644 --- a/view/AreaPicker.js +++ b/view/AreaPicker.js @@ -90,11 +90,11 @@ class AreaPicker extends BaseDialog { } }); - if (this.props.selectedValue[2] && county && county.length && county.indexOf(this.props.selectedValue[2]) == -1) { + if (this.props.selectedValue[2] && county.length && county.indexOf(this.props.selectedValue[2]) == -1) { this.props.selectedValue[2] = firstCountry; } - if (this.props.selectedValue[2] && county && !county.length && firstCity != null) { + if (this.props.selectedValue[1] && city.length && city.indexOf(this.props.selectedValue[1]) == -1 && firstCity != null) { this.props.selectedValue[1] = firstCity; return this.formatPickerData(); } From 95b9f7458da9aca6590701979b924d8533f47ecd Mon Sep 17 00:00:00 2001 From: jjskay <404784102@qq.com> Date: Tue, 8 Jan 2019 14:00:59 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E8=81=94=E5=8A=A8=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/AreaPicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/AreaPicker.js b/view/AreaPicker.js index 33326b9..6a3e0a1 100644 --- a/view/AreaPicker.js +++ b/view/AreaPicker.js @@ -90,11 +90,11 @@ class AreaPicker extends BaseDialog { } }); - if (this.props.selectedValue[2] && county.length && county.indexOf(this.props.selectedValue[2]) == -1) { + if (this.props.selectedValue[2] && county.length && county.indexOf(this.props.selectedValue[2]) == -1 && firstCountry) { this.props.selectedValue[2] = firstCountry; } - if (this.props.selectedValue[1] && city.length && city.indexOf(this.props.selectedValue[1]) == -1 && firstCity != null) { + if (this.props.selectedValue[1] && city.length && city.indexOf(this.props.selectedValue[1]) == -1 && firstCity) { this.props.selectedValue[1] = firstCity; return this.formatPickerData(); } From cb378080119632e175d740cca1220017ab081e93 Mon Sep 17 00:00:00 2001 From: jjskay <404784102@qq.com> Date: Tue, 8 Jan 2019 14:05:52 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E8=81=94=E5=8A=A8=E5=87=BD=E6=95=B0=E5=86=99=E6=B3=95?= =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/AreaPicker.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/view/AreaPicker.js b/view/AreaPicker.js index 6a3e0a1..3ac3637 100644 --- a/view/AreaPicker.js +++ b/view/AreaPicker.js @@ -65,8 +65,7 @@ class AreaPicker extends BaseDialog { let province = []; let city = []; let county = []; - let firstCity = null; - let firstCountry = null; + let firstCity = firstCountry = ''; let areaData = this.getAreaData(); areaData.map((pitem) => { for (let pname in pitem) { @@ -74,13 +73,13 @@ class AreaPicker extends BaseDialog { if (this.props.selectedValue[1] && pname == this.props.selectedValue[0]) { pitem[pname] && pitem[pname].map(citem => { for (let cname in citem) { - if (firstCity == null) { + if (!firstCity) { firstCity = cname; } city.push(cname); if (this.props.selectedValue[2] && cname == this.props.selectedValue[1]) { county = citem[cname]; - if (firstCountry == null) { + if (!firstCountry) { firstCountry = citem[cname][0]; } } @@ -90,18 +89,18 @@ class AreaPicker extends BaseDialog { } }); - if (this.props.selectedValue[2] && county.length && county.indexOf(this.props.selectedValue[2]) == -1 && firstCountry) { + if (this.props.selectedValue[2] && county.indexOf(this.props.selectedValue[2]) == -1 && firstCountry) { this.props.selectedValue[2] = firstCountry; } - if (this.props.selectedValue[1] && city.length && city.indexOf(this.props.selectedValue[1]) == -1 && firstCity) { + if (this.props.selectedValue[1] && city.indexOf(this.props.selectedValue[1]) == -1 && firstCity) { this.props.selectedValue[1] = firstCity; return this.formatPickerData(); } let pickerData = [province] - city && city.length && pickerData.push(city) - county && county.length && pickerData.push(county) + city.length && pickerData.push(city) + county.length && pickerData.push(county) return { pickerData, visible: true From 046c5ee1c5fe79b3ced8f21c4e6a083a4f5c116a Mon Sep 17 00:00:00 2001 From: frank <404784102@qq.com> Date: Fri, 22 Mar 2019 10:35:07 +0800 Subject: [PATCH 5/7] fixed bug for TypeError: method.bind is not function error in PickerView.js --- view/PickerView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/view/PickerView.js b/view/PickerView.js index 2837d39..022cffe 100644 --- a/view/PickerView.js +++ b/view/PickerView.js @@ -285,7 +285,7 @@ class PickerView extends BaseComponent { - { return false; }} @@ -333,7 +333,7 @@ class PickerView extends BaseComponent { fill="url(#grad)" clipPath="url(#clip)" /> - + */> @@ -341,4 +341,4 @@ class PickerView extends BaseComponent { } } -export default PickerView; \ No newline at end of file +export default PickerView; From aa47eff49abd12eda70bcdfed419f54a9948ae1e Mon Sep 17 00:00:00 2001 From: frank <404784102@qq.com> Date: Fri, 22 Mar 2019 10:41:47 +0800 Subject: [PATCH 6/7] Update PickerView.js --- view/PickerView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/PickerView.js b/view/PickerView.js index 022cffe..0d9f65c 100644 --- a/view/PickerView.js +++ b/view/PickerView.js @@ -333,7 +333,7 @@ class PickerView extends BaseComponent { fill="url(#grad)" clipPath="url(#clip)" /> - */> + */} From 451675b412507e1c343551bef741c4a0fb4bd239 Mon Sep 17 00:00:00 2001 From: frank <404784102@qq.com> Date: Mon, 1 Jul 2019 18:57:04 +0800 Subject: [PATCH 7/7] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1fbeb41..8f1b2d3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-native-pickers", + "name": "react-native-pickers-1", "version": "2.0.0", "description": "纯JS实现的React-Native 各种弹窗、日期选择控件、地址选择控件等", "main": "index.js", @@ -22,4 +22,4 @@ ], "author": "iBerHK", "license": "ISC" -} \ No newline at end of file +}