Skip to content

Commit 4cc0775

Browse files
committed
Fixed typings so yarn build runs correctly
1 parent cc3a38a commit 4cc0775

4 files changed

Lines changed: 21 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"react": "^16.12.0",
4848
"react-native": "^0.61.5",
4949
"react-native-gesture-handler": "^1.5.3",
50-
"react-native-reanimated": "^1.7.0",
50+
"react-native-reanimated": "^1.9.0",
5151
"typescript": "^3.7.3"
5252
}
5353
}

src/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,10 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
815815
[`translate${horizontal ? "X" : "Y"}`]: this
816816
.hoverComponentTranslate
817817
}
818-
]
818+
// We need the cast because the transform array usually accepts
819+
// only specific keys, and we dynamically generate the key
820+
// above
821+
] as Animated.AnimatedTransform
819822
}
820823
]}
821824
>

src/procs.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Animated from "react-native-reanimated";
2-
import { State as GestureState } from "react-native-gesture-handler";
32

43
let {
54
or,
@@ -68,9 +67,16 @@ export const hardReset = proc(
6867
block([set(position, 0), set(finished, 0), set(time, 0), set(toValue, 0)])
6968
);
7069

71-
export const setupCell = proc(
70+
/**
71+
* The in react-native-reanimated.d.ts definition of `proc` only has generics
72+
* for up to 10 arguments. We cast it to accept any params to avoid errors when
73+
* type-checking.
74+
*/
75+
type RetypedProc = (cb: (...params: any) => Animated.Node<number>) => typeof cb;
76+
77+
export const setupCell = (proc as RetypedProc)(
7278
(
73-
currentIndex: Animated.Node<number>,
79+
currentIndex: Animated.Value<number>,
7480
initialized: Animated.Value<number>,
7581
size: Animated.Node<number>,
7682
offset: Animated.Node<number>,
@@ -207,7 +213,7 @@ export const setupCell = proc(
207213
])
208214
);
209215

210-
const betterSpring = proc(
216+
const betterSpring = (proc as RetypedProc)(
211217
(
212218
finished: Animated.Value<number>,
213219
velocity: Animated.Value<number>,

yarn.lock

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3740,10 +3740,12 @@ react-native-gesture-handler@^1.5.3:
37403740
invariant "^2.2.4"
37413741
prop-types "^15.7.2"
37423742

3743-
react-native-reanimated@^1.7.0:
3744-
version "1.7.0"
3745-
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-1.7.0.tgz#896db2576552ac59d288a1f6c7f00afc171f240c"
3746-
integrity sha512-FQWSqP605eQVJumuK2HpR+7heF0ZI+qfy4jNguv3Xv8nPFHeIgZaRTXHCEQL2AcuSIj50zy8jGJf5l134QMQWQ==
3743+
react-native-reanimated@^1.9.0:
3744+
version "1.9.0"
3745+
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-1.9.0.tgz#38676c99dd585504fdc7331efb45e5f48ec7339a"
3746+
integrity sha512-Aj+spgIHRiVv7ezGADxnSH1EoKrQRD2+XaSiGY0MiB/pvRNNrZPSJ+3NVpvLwWf9lZMOP7dwqqyJIzoZgBDt8w==
3747+
dependencies:
3748+
fbjs "^1.0.0"
37473749

37483750
react-native@^0.61.5:
37493751
version "0.61.5"

0 commit comments

Comments
 (0)