Skip to content

Commit 637ffb1

Browse files
Lulu Wufacebook-github-bot
authored andcommitted
Fix setRuntimeConfigProvider multiple times error
Summary: Fix the following error: {F1038388240} Calling ```setRuntimeConfigProvider``` multiple times is not always a wrong behaviour, the following could happen and before this diff App C will raise above error: - App A has main bundle X - App B has main bundle Y - App C has main bundle X and bundle Y To fix we guarantee ```setRuntimeConfigProvider``` only called once instead of raising an error. Changelog: [iOS][Changed] Fix setRuntimeConfigProvider called multiple times error Reviewed By: dmytrorykun Differential Revision: D47094267 fbshipit-source-id: c8473f4f7d639a73e0201c6d72781c01e6cf95fd
1 parent 3ecbc1d commit 637ffb1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/react-native/Libraries/NativeComponent/NativeComponentRegistry.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ export function setRuntimeConfigProvider(
3838
verify: boolean,
3939
},
4040
): void {
41-
invariant(
42-
getRuntimeConfig == null,
43-
'NativeComponentRegistry.setRuntimeConfigProvider() called more than once.',
44-
);
45-
getRuntimeConfig = runtimeConfigProvider;
41+
if (getRuntimeConfig === undefined) {
42+
getRuntimeConfig = runtimeConfigProvider;
43+
}
4644
}
4745

4846
/**

0 commit comments

Comments
 (0)