Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
RFC: Snapshot API Proposal #9855
"Snapshotting" is a method commonly used in native app development to provide an efficient way to visually "clone" view hierarchies in a side-effect free way. Having these capabilities allows for more nontrivial animations, especially those that cross boundaries of react component hierarchies, and perhaps need multiple visual copies of the element in order to produce the desired effect.
Potential Use Cases
the reason I created react-native-view-shot was that UIManager.takeSnapshot was not going to make it to Android (see PR). My current use-case being limited to just "I want to export a rendering to share an image result to social networks".
I really hope we can push your idea to be built in RN, I especially like your dispose & update API proposal. if it can't be, I still imagine it could be possible to implement as a third party?
If you need another use-case: I could definitely imagine it could be a solid API to implement caching of views like OpenGL views. For instance to implement something like https://github.com/gre/gl-react-dom-static-container (in WebGL, it was mandatory to have this, as you are limited in maximum concurrent WebGL contexts)
One question: do you think the
I thought about this a bit. I think it's a good idea to have a snapshot component that just accepts a
Yes. Nothing here requires us to use react internals... as a result, we can make a 3rd party solution. This RFC is mainly to identify whether or not we want to put it in core, and to discuss refinements on the proposed API.
The main purpose for the "update" API is to allow a consumer of a
referenced this issue
Sep 13, 2016
added a commit
Sep 30, 2016
referenced this issue
Oct 22, 2016
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/rfc-snapshot-api-proposal
ProductPains helps the community prioritize the most important issues thanks to its voting feature.
Also, if this issue is a bug, please consider sending a PR with a fix.