-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Update API.md #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update API.md #164
Conversation
Hold no longer exists on Spring
|
Why was this removed? Is there a new way to achieve the effect? |
|
I didn't know what it was tbh. Internals changed in 6.0, everything is controlled by a class called From looking at old code (seems like this was removed long time ago actually ... 🤔) // Skip held animations
if (hold && (hold === true || hold.indexOf(name) !== -1))
return onFinish()
AnimatedController(entry.animation, { toValue, ...config }, impl).start(
props => props.finished && onFinish()
)to me it looks like it is the same as Could i see an example of the effect in action? |
|
@PrecociouslyDigital API.md is a relic, could you remove the whole thing? Props are all extracted automatically from PropTypes in the official documentation now. |
|
Discussion was in #48. I'll have to look into the new internals, it's been a while since I had the hold prop merged, perhaps it's no longer necessary. |
|
Now i remember, thanks! I think this actually works out of the box now. http://react-spring.surge.sh/manual It can circumvent the render phase, for instance on mouse input. https://codesandbox.io/s/ppxnl191zx?from-embed This is because you can update a controller anywhere. This is very easy to do with hooks (and in that example you see how you can even re-use AnimatedValues in further springs. But theoretically this would also work with a generic spring = React.createRef()
componentDidMount() {
// This would animate views, but it won't cause a new render pass
this.spring.current.controller.update({ ...newprops }, true)
}
render() {
return (
<Spring native ref={this.spring} ... >
{props => <animated.div style={props} />If there's something missing or if we need to make this easier we could discuss this in a separate issue. |
|
Here's a proof of concept: https://codesandbox.io/embed/534v0v8pyx It's not really as straight forward as hooks or imperative controller because it needs (to: {...}) but other than that it works. The only real difference is that now you can set props instead of relying on internals like AnimatedValue. |
|
@drcmda I added a pull request to remove the bit, but it has a trivial merge conflict I will resolve when I get home |
Update API.md
Hold no longer exists on Spring