react-native-reanimated
react-native-reanimated copied to clipboard
type all style props with `AnimateStyle`
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
AnimateStyleso all properties ending with "Style" (for example "textStyle" and "contentContainerStyle") is being typed asStyleProp<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