mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08:00
[fix] AppRegistry.getApplication shouldn't throw if missing options
Fix #899
This commit is contained in:
@@ -22,6 +22,11 @@ describe('AppRegistry', () => {
|
||||
ExecutionEnvironment.canUseDOM = canUseDOM;
|
||||
});
|
||||
|
||||
test('does not throw when missing appParameters', () => {
|
||||
AppRegistry.registerComponent('App', () => RootComponent);
|
||||
expect(() => AppRegistry.getApplication('App')).not.toThrow();
|
||||
});
|
||||
|
||||
test('returns "element" and "getStyleElement"', () => {
|
||||
AppRegistry.registerComponent('App', () => RootComponent);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class AppRegistry {
|
||||
getApplication: appParameters =>
|
||||
getApplication(
|
||||
componentProviderInstrumentationHook(componentProvider),
|
||||
appParameters.initialProps || emptyObject,
|
||||
appParameters ? appParameters.initialProps : emptyObject,
|
||||
wrapperComponentProvider && wrapperComponentProvider(appParameters)
|
||||
),
|
||||
run: appParameters =>
|
||||
@@ -90,7 +90,7 @@ export default class AppRegistry {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
static runApplication(appKey: string, appParameters?: Object): void {
|
||||
static runApplication(appKey: string, appParameters: Object): void {
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||
const params = { ...appParameters };
|
||||
params.rootTag = `#${params.rootTag.id}`;
|
||||
|
||||
@@ -93,7 +93,7 @@ const AppRegistryScreen = () => (
|
||||
})`
|
||||
}}
|
||||
name="static runApplication"
|
||||
typeInfo="(appKey: string, appParameters?: object) => void"
|
||||
typeInfo="(appKey: string, appParameters: object) => void"
|
||||
/>
|
||||
|
||||
<DocItem
|
||||
|
||||
Reference in New Issue
Block a user