airbnb / react-sketchapp

render React components to Sketch ⚛️💎
http://airbnb.io/react-sketchapp/
MIT License
14.95k stars 824 forks source link

Add TestRenderer.act callback function #528

Open macintoshhelper opened 3 years ago

macintoshhelper commented 3 years ago

I am...

------------------------------------------------------------------------------------------------- Requesting a new feature

Proposal/Feature-request:

Add callback to render function to run code inside TestRenderer.act function. https://github.com/airbnb/react-sketchapp/blob/b238e69c6f1e65ec6b1d8a908a91fbd9a8cc43a7/src/buildTree.ts#L96-L99

This should allow for Relay data fetching to occur before the component is rendered: https://relay.dev/docs/guides/testing-relay-components/#examples

I’ll work on hacking together a demo for this with a mock GraphQL Relay API; this could be expanded to having a full Relay example in this repo.