react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

type all style props with `AnimateStyle`

Open johankasperi opened this issue 3 years ago • 0 comments

Description

Style type properties (properties that extends StyleProp<ViewStyle>) can be defined with other property names than "style". For example contentContainerStyle in FlatList. Current implementation of AnimateProps defines all style type properties as AnimatedNode<StyleProp<...>> except the regular style property. The regular style property is being typed as StyleProp<AnimateStyle<StyleProp<ViewStyle>>. I think the type definition for all style type properties should act similarly.

Changes

  • Extend AnimateStyle so all properties ending with "Style" (for example "textStyle" and "contentContainerStyle") is being typed as StyleProp<AnimateStyle<StyleProp<ViewStyle>>.

Test code and steps to reproduce

Added a test in "FabricExample/react-native-reanimated-tests.tsx" named "CreateAnimatedFlatListTest3" illustrating the problem and that shows that the proposed change fixes it.

Checklist

  • [ ] Included code example that can be used to test this change
  • [x] Updated TS types
  • [x] Added TS types tests
  • [ ] Added unit / integration tests
  • [ ] Updated documentation
  • [x] Ensured that CI passes

johankasperi avatar Oct 06 '22 21:10 johankasperi