Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3178120
D10040.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10040.diff
View Options
diff --git a/native/chat/swipeable-message.react.js b/native/chat/swipeable-message.react.js
--- a/native/chat/swipeable-message.react.js
+++ b/native/chat/swipeable-message.react.js
@@ -19,6 +19,9 @@
cancelAnimation,
Extrapolate,
type SharedValue,
+ // ESLint doesn't understand Flow comment syntax
+ // eslint-disable-next-line no-unused-vars
+ type WithSpringConfig,
} from 'react-native-reanimated';
import tinycolor from 'tinycolor2';
@@ -33,7 +36,11 @@
const panGestureHandlerActiveOffsetX = [-4, 4];
const panGestureHandlerFailOffsetY = [-5, 5];
-function dividePastDistance(value, distance, factor) {
+function dividePastDistance(
+ value /*: number */,
+ distance /*: number */,
+ factor /*: number */,
+) /*: number */ {
'worklet';
const absValue = Math.abs(value);
if (absValue < distance) {
@@ -43,7 +50,7 @@
return absFactor * (distance + (absValue - distance) / factor);
}
-function makeSpringConfig(velocity) {
+function makeSpringConfig(velocity /*: number */) /*: WithSpringConfig */ {
'worklet';
return {
stiffness: 257.1370588235294,
@@ -56,19 +63,27 @@
};
}
-function interpolateOpacityForViewerPrimarySnake(translateX) {
+function interpolateOpacityForViewerPrimarySnake(
+ translateX /*: number */,
+) /*: number */ {
'worklet';
return interpolate(translateX, [-20, -5], [1, 0], Extrapolate.CLAMP);
}
-function interpolateOpacityForNonViewerPrimarySnake(translateX) {
+function interpolateOpacityForNonViewerPrimarySnake(
+ translateX /*: number */,
+) /*: number */ {
'worklet';
return interpolate(translateX, [5, 20], [0, 1], Extrapolate.CLAMP);
}
-function interpolateTranslateXForViewerSecondarySnake(translateX) {
+function interpolateTranslateXForViewerSecondarySnake(
+ translateX /*: number */,
+) /*: number */ {
'worklet';
return interpolate(translateX, [-130, -120, -60, 0], [-130, -120, -5, 20]);
}
-function interpolateTranslateXForNonViewerSecondarySnake(translateX) {
+function interpolateTranslateXForNonViewerSecondarySnake(
+ translateX /*: number */,
+) /*: number */ {
'worklet';
return interpolate(translateX, [0, 80, 120, 130], [0, 30, 120, 130]);
}
diff --git a/native/flow-typed/npm/react-native-reanimated_v2.x.x.js b/native/flow-typed/npm/react-native-reanimated_v2.x.x.js
--- a/native/flow-typed/npm/react-native-reanimated_v2.x.x.js
+++ b/native/flow-typed/npm/react-native-reanimated_v2.x.x.js
@@ -503,7 +503,7 @@
dependencies?: $ReadOnlyArray<mixed>,
) => T;
- declare type WithSpringConfig = $Shape<{|
+ declare export type WithSpringConfig = $Shape<{|
+stiffness: number,
+damping: number,
+mass: number,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 1:03 AM (20 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2447159
Default Alt Text
D10040.diff (2 KB)
Attached To
Mode
D10040: [Flow202][native][skip-ci] [56/x] Use Flow's comment syntax in Reanimated worklets
Attached
Detach File
Event Timeline
Log In to Comment