intergalacticspacehighway / react-native-reanimated-zoom

Component for zooming react native views. 🔎
MIT License
315 stars 19 forks source link

improvement: replace scrollEnabled react state implementation with useAnimatedProps from reanimated #10

Closed intergalacticspacehighway closed 2 years ago

intergalacticspacehighway commented 2 years ago

Here we're using scrollEnabled with react state to disable scrollview's scroll if zoom is enabled. We can replace this implementation with useAnimatedProps from reanimated to improve the performance.

However, this will require us to use Animated.createdAnimatedComponent from reanimated. We also need to think what happens if the user passes an Animated ScrollView/FlatList.

itzhak-ira commented 2 years ago

Any potential performance boost that mitigates the need to use state should 100% be considered. You can set an optional prop to utilize this feature (maybe initWithAnimatedCompoment?) which warns that this prop will negate ability to pass in their own animated component.

I’m looking to implement this lib for a large client pretty soon, do you think you can add this feature as simply an experimental addition (to start) soon?

intergalacticspacehighway commented 2 years ago

@itzhak-ira resolved with https://github.com/intergalacticspacehighway/react-native-reanimated-zoom/pull/12. It's released in 0.3.0 version. Let me know if it works for you. Thanks for the suggestion!