Skip to content

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-native-web/src/exports/AppRegistry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export default class AppRegistry {
runnables[appKey] = {
getApplication: ({ initialProps } = emptyObject) =>
getApplication(getComponentFunc(), initialProps),
run: ({ initialProps = emptyObject, rootTag }) =>
renderApplication(getComponentFunc(), initialProps, rootTag)
run: ({ initialProps = emptyObject, rootTag, callback }) =>
renderApplication(getComponentFunc(), initialProps, rootTag, callback)
};
return appKey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ const renderFn = process.env.NODE_ENV !== 'production' ? render : hydrate;
export default function renderApplication<Props: Object>(
RootComponent: ComponentType<Props>,
initialProps: Props,
rootTag: any
rootTag: any,
callback?: () => void
) {
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);

renderFn(
<AppContainer rootTag={rootTag}>
<RootComponent {...initialProps} />
</AppContainer>,
rootTag
rootTag,
callback
);
}

Expand Down