-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken types with react-native@0.71.9+ and reanimated 3.2.0 #4548
Comments
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem? |
possible fix for export type TransformStyleTypes = TransformsStyle['transform'] extends
| readonly (infer T)[]
| undefined | string <---- added | string
? T
: never; at: react-native-reanimated/react-native-reanimated.d.ts Lines 69 to 74 in 2426f32
for several other places: export type AnimateStyle<S> = {
[K in keyof S]: K extends 'transform'
? AnimatedTransform | string <-------- added | string
: S[K] extends ReadonlyArray<any>
? ReadonlyArray<AnimateStyle<S[K][0]>>
: S[K] extends object
? AnimateStyle<S[K]>
: S[K] extends ColorValue | undefined
? S[K] | number
: S[K] | SharedValue<AnimatableValue>;
}; at: react-native-reanimated/react-native-reanimated.d.ts Lines 79 to 89 in 2426f32
diff --git a/node_modules/react-native-reanimated/react-native-reanimated.d.ts b/node_modules/react-native-reanimated/react-native-reanimated.d.ts
index ec993fd..d99761f 100644
--- a/node_modules/react-native-reanimated/react-native-reanimated.d.ts
+++ b/node_modules/react-native-reanimated/react-native-reanimated.d.ts
@@ -68,7 +68,7 @@ declare module 'react-native-reanimated' {
export type TransformStyleTypes = TransformsStyle['transform'] extends
| readonly (infer T)[]
- | undefined
+ | undefined | string
? T
: never;
export type AdaptTransforms<T> = {
@@ -78,7 +78,7 @@ declare module 'react-native-reanimated' {
export type AnimateStyle<S> = {
[K in keyof S]: K extends 'transform'
- ? AnimatedTransform
+ ? AnimatedTransform | string
: S[K] extends ReadonlyArray<any>
? ReadonlyArray<AnimateStyle<S[K][0]>>
: S[K] extends object let me know if you want me to open a PR if these changes look good. |
For context here's where the change introduced to React Native: facebook/react-native#37569 |
Same error when using useAnimatedStyle and transform: Type '{ translateX: number; }' is not assignable to type 'never'. |
@Pnlvfx hey, did you used the patch from this comment #4548 (comment)? |
I cannot use 3.2.0 because of |
This commit facebook/react-native@2558c3d added string to `transform` type and it broke Reanimated types. <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary fixes [#45](#4548)
Are you still doing releases on the 2.x branch? I'm seeing the same issue there and wondered if a fix will be published there as well, or if I should just keep a patch on my end for now before I'm able to upgrade to 3.x |
Yeah, it was surely broken type declaration. |
See software-mansion/react-native-reanimated#4548 (comment) for information about this patch file.
This commit facebook/react-native@2558c3d added string to `transform` type and it broke Reanimated types. <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary fixes [software-mansion#45](software-mansion#4548)
Currently on "react-native-reanimated": "3.4.0" and "react-native": "0.72.5". And getting the same issue, seems the fix was not ported to 3.x. edit: took a look at 3.5 and seems these are fixed |
Description
react-native
0.71.9
and0.71.10
were published today and the typings are now broken probably because of this PR. Downgrading react-native@0.71.8 eliminates the issue.diffs: 0.71.8..0.71.9 and 0.71.9..0.71.10
const input = useRef<TextInput>(null);
produces this onconst AnimatedTextInput = Animated.createAnimatedComponent(TextInput);
while using"@types/react": "18.2.7"
:Steps to reproduce
Snack or a link to a repository
none needed
Reanimated version
3.2.0
React Native version
0.71.9+
Platforms
Android, iOS, Web
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
Debug mode
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: