Skip to content
This repository has been archived by the owner on Sep 13, 2020. It is now read-only.

Expose the Left Animated Property to the given menu Component #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GabrielCTroia
Copy link

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.

@morenoh149
Copy link
Contributor

looks good. try rebasing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants