-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add ability to provide render callback #858
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you add a unit test to ensure the callback is called after render, and update the docs for AppRegistry
.
Sure, will do that next week when I come back from holiday.
Thanks for the review
Le jeu. 29 mars 2018 à 23:39, Nicolas Gallagher <[email protected]>
a écrit :
… ***@***.**** requested changes on this pull request.
Please could you add a unit test to ensure the callback is called after
render, and update the docs for AppRegistry.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#858 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAtvPqvY81Z0TikAZyLIJCOLwMtk6V-eks5tjWKNgaJpZM4Sg-jZ>
.
|
Hi @necolas I tried to write a test for this callback but I'm not exactly sure how to do this. All the other tests are currently using Enzyme which does not use any callback, and the following code is currently not tested as far as I've seen: const renderFn = process.env.NODE_ENV !== 'production' ? render : hydrate;
export default function renderApplication<Props: Object>(
RootComponent: ComponentType<Props>,
initialProps: Props,
rootTag: any,
callback?: () => void
) {
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);
renderFn(
<AppContainer rootTag={rootTag}>
<RootComponent {...initialProps} />
</AppContainer>,
rootTag,
callback
);
} To test the callback addition, this Do we agree that the test should not call the real ReactDOM render/hydrate functions and mock them? So basically the test will only verify that the arguments are dispatched correctly to real render/hydrate methods? This means I should then probably pass an extra argument I'll update the doc |
# Conflicts: # packages/react-native-web/src/exports/AppRegistry/index.js # packages/react-native-web/src/exports/AppRegistry/renderApplication.js
Hi @necolas I've updated the doc and resolved the conflicts of the PR related to the new Waiting for your feedback related to the Note that I wasn't able to run the storybook website. Do you have a contribution guide explaining that? Should I use Lerna or Yarn should be enough? |
Thanks, I'll take care of adding the test |
https://github.com/necolas/react-native-web/blob/master/.github/CONTRIBUTING.md |
Thanks, I'll upgrade the Gatsby plugin as soon as there's a release (ping me) I tried |
This render callback is needed for Gatsby integration. (https://github.com/gatsbyjs/gatsby/blob/021a460184be6b8f8e1d2b3d072baabbbe45544c/packages/gatsby/cache-dir/production-app.js#L185)
Not exactly sure what I'm doing so tell me if I did something wrong :)