react-native-side-menu icon indicating copy to clipboard operation
react-native-side-menu copied to clipboard

Expose the Left Animated Property to the given menu Component

Open GabrielCTroia opened this issue 9 years ago • 1 comments

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:

  1. Say the Menu Content's behavior depends on the Menu open ratio, like so: e97d31d78e03005f54a8224b39758044 or 4b59ed942f3dd1a2b0c83e178cfdfa76

(^ 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)

  1. 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.

GabrielCTroia avatar Nov 25 '15 21:11 GabrielCTroia

looks good. try rebasing

morenoh149 avatar Dec 31 '15 08:12 morenoh149