forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreact-native-web+0.19.12+005+osr-improvement.patch
70 lines (69 loc) · 3.85 KB
/
react-native-web+0.19.12+005+osr-improvement.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
diff --git a/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js b/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js
index b05da08..80aea85 100644
--- a/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js
+++ b/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js
@@ -332,7 +332,7 @@ class VirtualizedList extends StateSafePureComponent {
zoomScale: 1
};
this._scrollRef = null;
- this._sentStartForContentLength = 0;
+ this._sentStartForFirstVisibleItemKey = null;
this._sentEndForContentLength = 0;
this._totalCellLength = 0;
this._totalCellsMeasured = 0;
@@ -1397,8 +1397,8 @@ class VirtualizedList extends StateSafePureComponent {
// Next check if the user just scrolled within the start threshold
// and call onStartReached only once for a given content length,
// and only if onEndReached is not being executed
- else if (onStartReached != null && this.state.cellsAroundViewport.first === 0 && isWithinStartThreshold && this._scrollMetrics.contentLength !== this._sentStartForContentLength) {
- this._sentStartForContentLength = this._scrollMetrics.contentLength;
+ else if (onStartReached != null && this.state.cellsAroundViewport.first === 0 && isWithinStartThreshold && this.state.firstVisibleItemKey !== this._sentStartForFirstVisibleItemKey) {
+ this._sentStartForFirstVisibleItemKey = this.state.firstVisibleItemKey;
onStartReached({
distanceFromStart
});
@@ -1407,7 +1407,7 @@ class VirtualizedList extends StateSafePureComponent {
// If the user scrolls away from the start or end and back again,
// cause onStartReached or onEndReached to be triggered again
else {
- this._sentStartForContentLength = isWithinStartThreshold ? this._sentStartForContentLength : 0;
+ this._sentStartForFirstVisibleItemKey = isWithinStartThreshold ? this._sentStartForFirstVisibleItemKey : null;
this._sentEndForContentLength = isWithinEndThreshold ? this._sentEndForContentLength : 0;
}
}
diff --git a/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js b/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js
index 459f017..799a6ee 100644
--- a/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js
+++ b/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js
@@ -1325,7 +1325,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
zoomScale: 1,
};
_scrollRef: ?React.ElementRef<any> = null;
- _sentStartForContentLength = 0;
+ _sentStartForFirstVisibleItemKey: ?string = null;
_sentEndForContentLength = 0;
_totalCellLength = 0;
_totalCellsMeasured = 0;
@@ -1675,18 +1675,18 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
onStartReached != null &&
this.state.cellsAroundViewport.first === 0 &&
isWithinStartThreshold &&
- this._scrollMetrics.contentLength !== this._sentStartForContentLength
+ this.state.firstVisibleItemKey !== this._sentStartForFirstVisibleItemKey
) {
- this._sentStartForContentLength = this._scrollMetrics.contentLength;
+ this._sentStartForFirstVisibleItemKey = this.state.firstVisibleItemKey;
onStartReached({distanceFromStart});
}
// If the user scrolls away from the start or end and back again,
// cause onStartReached or onEndReached to be triggered again
else {
- this._sentStartForContentLength = isWithinStartThreshold
- ? this._sentStartForContentLength
- : 0;
+ this._sentStartForFirstVisibleItemKey = isWithinStartThreshold
+ ? this._sentStartForFirstVisibleItemKey
+ : null;
this._sentEndForContentLength = isWithinEndThreshold
? this._sentEndForContentLength
: 0;