Question - Is it possible to detect when the content of the Surface have loaded?
serhiipalash opened this issue · comments
feature request?
I want to take the snapshot of the loaded Surface, but onLoad
event fires early then all content have loaded. Do you have any idea how to handle this?
library version
Expected behavior
Actual behavior
Steps to reproduce the behavior
Clone this repo and open in Expo XDE
by default, the Surface will render as soon as possible and won't wait images, if an image is not loaded yet, it renders black instead.
To have a different behavior, you need to specify the images to wait in a preload
prop.
it will force Surface to wait for all images to render the first frame AND should only trigger onLoad after that.
example
<Surface preload={[ image1, image2 ]} onLoad={this.onLoad} ...>
<Node ... uniforms={{ t1: image1, t2: image2 }} />
</Surface>
(the preload array contains same format as you would pass to uniform texture)
Thank you for your help @gre !