From 5570b9027b30c8b6f11f1689a4552e7f1f703c81 Mon Sep 17 00:00:00 2001
From: ykforerlang <1527997464@qq.com>
Date: Tue, 30 Jul 2019 10:56:03 +0800
Subject: [PATCH] =?UTF-8?q?perf(wx-react-native):=20FlatList,=20SectionLis?=
=?UTF-8?q?t,=20Picker=20R=E4=B8=8E=5Fr=20=E5=88=87=E6=8D=A2=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../component/WXFlatList/index.js | 21 +--
.../component/WXFlatList/index.wxml | 147 +++++++++---------
.../component/WXPicker/index.js | 13 +-
.../component/WXPicker/index.wxml | 41 ++---
.../component/WXSectionList/index.js | 14 +-
.../component/WXSectionList/index.wxml | 119 +++++++-------
6 files changed, 183 insertions(+), 172 deletions(-)
diff --git a/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.js b/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.js
index 8270a88..a706cbc 100644
--- a/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.js
+++ b/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.js
@@ -13,7 +13,7 @@ const top = 80
Component({
properties: {
diuu: null,
- _r: null,
+ R: null,
},
attached() {
@@ -23,20 +23,17 @@ Component({
ready() {
instanceManager.setWxCompInst(this.data.diuu, this)
const compInst = instanceManager.getCompInstByUUID(this.data.diuu)
- if (!compInst.firstRender) {
- compInst.firstUpdateUI()
- }
this.compInst = compInst
const method = getPropsMethod(this, 'onRefresh');
- this.hasOnRefreshPassed = !!this.data._r.onRefreshPassed
+ this.hasOnRefreshPassed = !!this.data.R.onRefreshPassed
this.onRefreshMethod = method
this.onScrollFunc = getPropsMethod(this, 'onScroll');
this.onScrollEndDragFunc = getPropsMethod(this, 'onScrollEndDrag');
this.hasChanges = []
- const infos = this.data._r.stickyInfos
+ const infos = this.data.R.stickyInfos
if (Array.isArray(infos) && infos.length > 0) {
for (let k = 0; k < infos.length; k++) {
this.hasChanges.push(false)
@@ -84,7 +81,9 @@ Component({
clearTimeout(this.stopTimerFlag)
}
this.stopTimerFlag = setTimeout(() => {
- if (this.lastVal <= 80 && !this.data._r.refreshing) {
+
+ const refreshing = (this.data._r || this.data.R).refreshing
+ if (this.lastVal <= 80 && !refreshing) {
this.setData({
sr: false
});
@@ -107,8 +106,9 @@ Component({
this.onScrollFunc(this.formatEvent(e));
}
- if (this.data._r.stickyInfos) {
- const infos = this.data._r.stickyInfos
+ const stickyInfos = (this.data._r || this.data.R).stickyInfos
+ if (stickyInfos) {
+ const infos = stickyInfos
if (Array.isArray(infos) && infos.length > 0) {
for (let k = 0; k < infos.length; k++) {
const info = infos[k]
@@ -155,7 +155,8 @@ Component({
return;
}
//松手归位
- if (this.lastVal <= top && this.lastVal >= 20 && !this.data._r.refreshing) {
+ const refreshing = (this.data._r || this.data.R).refreshing
+ if (this.lastVal <= top && this.lastVal >= 20 && !refreshing) {
this.setData({
sr: false
});
diff --git a/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.wxml b/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.wxml
index 58834ad..f6e3799 100644
--- a/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.wxml
+++ b/packages/wx-react-native/miniprogram_dist/component/WXFlatList/index.wxml
@@ -14,82 +14,87 @@
ArrayContains : ArrayContains,
}
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.js b/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.js
index 7c87ab3..ac5ceb5 100644
--- a/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.js
+++ b/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.js
@@ -15,20 +15,13 @@ Component({
},
onValueChange: null,
diuu: null,
- _r: null
+ R: null
},
attached() {
instanceManager.setWxCompInst(this.data.diuu, this)
},
- ready() {
- instanceManager.setWxCompInst(this.data.diuu, this)
- const compInst = instanceManager.getCompInstByUUID(this.data.diuu)
- if (!compInst.firstRender) {
- compInst.firstUpdateUI()
- }
- },
detached() {
instanceManager.removeUUID(this.data.diuu)
@@ -37,7 +30,9 @@ Component({
methods: {
onValueChange: function (e) {
const index = e.detail.value[0];
- const value = this.data._r.pickData[index].value
+
+ const pickData = (this.data._r || this.data.R).pickData
+ const value = pickData[index].value
const method = getPropsMethod(this, 'onValueChange')
method && method(value, index)
diff --git a/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.wxml b/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.wxml
index 8e637cb..dd1c102 100644
--- a/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.wxml
+++ b/packages/wx-react-native/miniprogram_dist/component/WXPicker/index.wxml
@@ -1,19 +1,24 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.js b/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.js
index d719a1d..bc9cec0 100644
--- a/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.js
+++ b/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.js
@@ -12,7 +12,7 @@ const top = 80
Component({
properties: {
diuu: null,
- _r: null
+ R: null
},
attached() {
@@ -22,13 +22,10 @@ Component({
ready() {
instanceManager.setWxCompInst(this.data.diuu, this)
const compInst = instanceManager.getCompInstByUUID(this.data.diuu)
- if (!compInst.firstRender) {
- compInst.firstUpdateUI()
- }
this.compInst = compInst
const method = getPropsMethod(this, "onRefresh");
- this.hasOnRefreshPassed = !!this.data._r.onRefreshPassed
+ this.hasOnRefreshPassed = !!this.data.R.onRefreshPassed
this.onRefreshMethod = method
this.onScrollFunc = getPropsMethod(this, 'onScroll');
@@ -66,7 +63,8 @@ Component({
clearTimeout(this.stopTimerFlag)
}
this.stopTimerFlag = setTimeout(() => {
- if (this.lastVal <= 80 && !this.data._r.refreshing) {
+ const refreshing = (this.data._r || this.data.R).refreshing
+ if (this.lastVal <= 80 && !refreshing) {
this.setData({
sr: false
});
@@ -114,7 +112,9 @@ Component({
return;
}
//松手归位
- if (this.lastVal <= top && this.lastVal >= 20 && !this.data._r.refreshing) {
+
+ const refreshing = (this.data._r || this.data.R).refreshing
+ if (this.lastVal <= top && this.lastVal >= 20 && !refreshing) {
this.setData({
sr: false
});
diff --git a/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.wxml b/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.wxml
index 6c50888..d5ef4ec 100644
--- a/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.wxml
+++ b/packages/wx-react-native/miniprogram_dist/component/WXSectionList/index.wxml
@@ -1,65 +1,70 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
-
-
+
+
+
+
+
+
-
-
-
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file