react-native-side-menu
react-native-side-menu copied to clipboard
Expose the Left Animated Property to the given menu Component
This PR exposes the Left AnimatedValue to the Menu Component, and additionally interpolates it on a scale from 1 to 100 (percentage). Here are the reasons for both additions:
- Say the Menu Content's behavior depends on the Menu open ratio, like so:
or
(^ each individual item is animated separately - notice the slight delay in each one of them)
Without, having direct access to the Left AnimatedValue, such behavior is not really possible.*
(* The only other way to get access to the Left AnimatedValue that I found, is to grab the leftValue from the animationStyle method, attach a listener to it, save the returned exact value, to the current Component's state, and pass that value down to the MenuContent Component, but besides being sooo hacky, it is also noticeable less performant)
- Exposing the LeftValue interpolated to percentage instead of the concrete pixel value, is in my opinion, a much flexible approach, since now, the consumers don't need to care about device widths, offsets or any other pixel type of measurements.
The interpolated LeftValue is called "openPercentage" and is automatically passed down to the MenuContent Component as a property and to animationStyle() as the 2nd param, so it doesn't break the current API.
looks good. try rebasing