@legendapp/list 3.0.0-beta.5 → 3.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/keyboard.js +38 -20
- package/keyboard.mjs +38 -20
- package/package.json +1 -1
package/keyboard.js
CHANGED
|
@@ -68,6 +68,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
68
68
|
const keyboardInset = reactNativeReanimated.useSharedValue(0);
|
|
69
69
|
const keyboardHeight = reactNativeReanimated.useSharedValue(0);
|
|
70
70
|
const isOpening = reactNativeReanimated.useSharedValue(false);
|
|
71
|
+
const didInteractive = reactNativeReanimated.useSharedValue(false);
|
|
71
72
|
const scrollHandler = reactNativeReanimated.useAnimatedScrollHandler(
|
|
72
73
|
(event) => {
|
|
73
74
|
scrollOffsetY.value = event.contentOffset[horizontal ? "x" : "y"];
|
|
@@ -89,37 +90,54 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
89
90
|
{
|
|
90
91
|
onStart: (event) => {
|
|
91
92
|
"worklet";
|
|
92
|
-
if (
|
|
93
|
-
|
|
93
|
+
if (!didInteractive.get()) {
|
|
94
|
+
if (event.height > 0) {
|
|
95
|
+
keyboardHeight.set(event.height - safeAreaInsetBottom);
|
|
96
|
+
}
|
|
97
|
+
isOpening.set(event.progress > 0);
|
|
98
|
+
scrollOffsetAtKeyboardStart.value = scrollOffsetY.value;
|
|
99
|
+
animatedOffsetY.set(scrollOffsetY.value);
|
|
100
|
+
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
onInteractive: () => {
|
|
104
|
+
"worklet";
|
|
105
|
+
if (!didInteractive.get()) {
|
|
106
|
+
didInteractive.set(true);
|
|
94
107
|
}
|
|
95
|
-
isOpening.set(event.progress > 0);
|
|
96
|
-
scrollOffsetAtKeyboardStart.value = scrollOffsetY.value;
|
|
97
|
-
animatedOffsetY.set(scrollOffsetY.value);
|
|
98
|
-
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
|
|
99
108
|
},
|
|
100
109
|
onMove: (event) => {
|
|
101
110
|
"worklet";
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
if (!didInteractive.get()) {
|
|
112
|
+
const vIsOpening = isOpening.get();
|
|
113
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
114
|
+
const vProgress = vIsOpening ? event.progress : 1 - event.progress;
|
|
115
|
+
const targetOffset = scrollOffsetAtKeyboardStart.value + (vIsOpening ? vKeyboardHeight : -vKeyboardHeight) * vProgress;
|
|
116
|
+
scrollOffsetY.value = targetOffset;
|
|
117
|
+
animatedOffsetY.set(targetOffset);
|
|
118
|
+
if (!horizontal) {
|
|
119
|
+
keyboardInset.value = Math.max(0, event.height - safeAreaInsetBottom);
|
|
120
|
+
}
|
|
110
121
|
}
|
|
111
122
|
},
|
|
112
123
|
onEnd: (event) => {
|
|
113
124
|
"worklet";
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
const wasInteractive = didInteractive.get();
|
|
126
|
+
if (wasInteractive && event.progress === 0 && event.target > 0) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (!wasInteractive) {
|
|
130
|
+
const vIsOpening = isOpening.get();
|
|
131
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
132
|
+
const targetOffset = scrollOffsetAtKeyboardStart.value + (vIsOpening ? vKeyboardHeight : -vKeyboardHeight) * (vIsOpening ? event.progress : 1 - event.progress);
|
|
133
|
+
scrollOffsetY.value = targetOffset;
|
|
134
|
+
animatedOffsetY.set(targetOffset);
|
|
135
|
+
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(true);
|
|
136
|
+
}
|
|
137
|
+
didInteractive.set(false);
|
|
119
138
|
if (!horizontal) {
|
|
120
139
|
keyboardInset.value = Math.max(0, event.height - safeAreaInsetBottom);
|
|
121
140
|
}
|
|
122
|
-
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(true);
|
|
123
141
|
}
|
|
124
142
|
},
|
|
125
143
|
[scrollViewRef, safeAreaInsetBottom]
|
package/keyboard.mjs
CHANGED
|
@@ -47,6 +47,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
47
47
|
const keyboardInset = useSharedValue(0);
|
|
48
48
|
const keyboardHeight = useSharedValue(0);
|
|
49
49
|
const isOpening = useSharedValue(false);
|
|
50
|
+
const didInteractive = useSharedValue(false);
|
|
50
51
|
const scrollHandler = useAnimatedScrollHandler(
|
|
51
52
|
(event) => {
|
|
52
53
|
scrollOffsetY.value = event.contentOffset[horizontal ? "x" : "y"];
|
|
@@ -68,37 +69,54 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
68
69
|
{
|
|
69
70
|
onStart: (event) => {
|
|
70
71
|
"worklet";
|
|
71
|
-
if (
|
|
72
|
-
|
|
72
|
+
if (!didInteractive.get()) {
|
|
73
|
+
if (event.height > 0) {
|
|
74
|
+
keyboardHeight.set(event.height - safeAreaInsetBottom);
|
|
75
|
+
}
|
|
76
|
+
isOpening.set(event.progress > 0);
|
|
77
|
+
scrollOffsetAtKeyboardStart.value = scrollOffsetY.value;
|
|
78
|
+
animatedOffsetY.set(scrollOffsetY.value);
|
|
79
|
+
runOnJS(setScrollProcessingEnabled)(false);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
onInteractive: () => {
|
|
83
|
+
"worklet";
|
|
84
|
+
if (!didInteractive.get()) {
|
|
85
|
+
didInteractive.set(true);
|
|
73
86
|
}
|
|
74
|
-
isOpening.set(event.progress > 0);
|
|
75
|
-
scrollOffsetAtKeyboardStart.value = scrollOffsetY.value;
|
|
76
|
-
animatedOffsetY.set(scrollOffsetY.value);
|
|
77
|
-
runOnJS(setScrollProcessingEnabled)(false);
|
|
78
87
|
},
|
|
79
88
|
onMove: (event) => {
|
|
80
89
|
"worklet";
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
if (!didInteractive.get()) {
|
|
91
|
+
const vIsOpening = isOpening.get();
|
|
92
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
93
|
+
const vProgress = vIsOpening ? event.progress : 1 - event.progress;
|
|
94
|
+
const targetOffset = scrollOffsetAtKeyboardStart.value + (vIsOpening ? vKeyboardHeight : -vKeyboardHeight) * vProgress;
|
|
95
|
+
scrollOffsetY.value = targetOffset;
|
|
96
|
+
animatedOffsetY.set(targetOffset);
|
|
97
|
+
if (!horizontal) {
|
|
98
|
+
keyboardInset.value = Math.max(0, event.height - safeAreaInsetBottom);
|
|
99
|
+
}
|
|
89
100
|
}
|
|
90
101
|
},
|
|
91
102
|
onEnd: (event) => {
|
|
92
103
|
"worklet";
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
const wasInteractive = didInteractive.get();
|
|
105
|
+
if (wasInteractive && event.progress === 0 && event.target > 0) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (!wasInteractive) {
|
|
109
|
+
const vIsOpening = isOpening.get();
|
|
110
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
111
|
+
const targetOffset = scrollOffsetAtKeyboardStart.value + (vIsOpening ? vKeyboardHeight : -vKeyboardHeight) * (vIsOpening ? event.progress : 1 - event.progress);
|
|
112
|
+
scrollOffsetY.value = targetOffset;
|
|
113
|
+
animatedOffsetY.set(targetOffset);
|
|
114
|
+
runOnJS(setScrollProcessingEnabled)(true);
|
|
115
|
+
}
|
|
116
|
+
didInteractive.set(false);
|
|
98
117
|
if (!horizontal) {
|
|
99
118
|
keyboardInset.value = Math.max(0, event.height - safeAreaInsetBottom);
|
|
100
119
|
}
|
|
101
|
-
runOnJS(setScrollProcessingEnabled)(true);
|
|
102
120
|
}
|
|
103
121
|
},
|
|
104
122
|
[scrollViewRef, safeAreaInsetBottom]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/list",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.6",
|
|
4
4
|
"description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|