cd1d652af4
Summary: This adds a new type of node that clamps an animated value between 2 values with a special twist, it is based on the difference between the previous value so getting far from a bound doesn't matter and as soon as we start getting closer again the value will start changing. The main use case for this node is to create a collapsible navbar when scrolling a scrollview. This is a pretty in apps (fb, youtube, twitter, all use something like this). It updates using the following: `value = clamp(value + diff, min, max)` where `diff` is the difference with the previous value. This gives the following output for parameters min = 0, max = 30: ``` in out 0 0 15 15 30 30 100 30 90 20 30 0 50 20 ``` One issue I see is that this node is pretty specific to this use case but I can't see another simple way to do this with Animated that can also be offloaded to native easily. I'd be glad to discuss other solutions if some Closes https://github.com/facebook/react-native/pull/9419 Differential Revision: D3753920 fbshipit-source-id: 40a749d38fd003aab2d3cb5cb8f0535e467d8a2a |
||
---|---|---|
.. | ||
examples | ||
release | ||
src |