Skip to content
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

[types] MotiImage type error when specifying tintColor animation #305

Open
2 of 3 tasks
xzilja opened this issue Aug 4, 2023 · 6 comments
Open
2 of 3 tasks

[types] MotiImage type error when specifying tintColor animation #305

xzilja opened this issue Aug 4, 2023 · 6 comments

Comments

@xzilja
Copy link

xzilja commented Aug 4, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Do you want this issue prioritized?

  • Yes, I have sponsored
  • Not urgent

Current Behavior

It seems that MotiImage animates "tintColor" property as expected, however specifying it on the component throws type error (property tintColor is invalid).

      <MotiImage
          animate={{ tintColor: active ? activeTint : '#ffffff' }}
      />

Expected Behavior

Should be a valid property type.

Steps To Reproduce

  1. Example above under "Current Behavior"

Versions

- Moti: 0.25.4
- Reanimated: 3.3.0
- React Native: 0.72.3

Screenshots

No response

Reproduction

https://stackblitz.com/edit/nextjs-5qbidy?file=pages%2Findex.tsx

@nandorojo
Copy link
Owner

nandorojo commented Aug 4, 2023

this is likely because it’s a prop and not in the styles, right? if so, you can probably just ts-ignore it

@xzilja
Copy link
Author

xzilja commented Aug 4, 2023

ts-ignored it for now yeh, it's on the styles of <Image /> though. I think you can set it as prop as well, however as prop it seems to have no effect.

@nandorojo
Copy link
Owner

hm interesting

@nandorojo
Copy link
Owner

i’d accept a PR with a fix if you want to try

@xzilja
Copy link
Author

xzilja commented Aug 4, 2023

😅 yeh I wanted to, but it seems like image component is just a simple wrapper here? https://github.com/nandorojo/moti/blob/master/packages/moti/src/components/image.tsx

Here is stylesheet usage with no error / correct typing

Screenshot 2023-08-04 at 15 24 23

And this is when it's defined in animate prop of MotiImage
Screenshot 2023-08-04 at 15 25 57

Where would I go to see how animate prop gets it's types?

@nandorojo
Copy link
Owner

It's this line: https://github.com/nandorojo/moti/blob/ab569152a0a228e10f581c57386ac6a2a31ac9a7/packages/moti/src/core/types.ts#L271C1-L271C52

Maybe those have to get changed to ImageStyle | ViewStyle | TextStyle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants