Skip to content

Commit

Permalink
[expo] Send a warning for missing native modules (#19845)
Browse files Browse the repository at this point in the history
# Why

the native modules checking will throw an error that is too aggressive and the error stacktrace is little confused.

as we are not very confident with this approach in the meantime, we should send a warning rather than an error.

# How

use `console.warn` than throwing errors.

# Test Plan

- bare-expo + NativeModules.FOO in App.js
  • Loading branch information
Kudo committed Nov 3, 2022
1 parent 4021cd3 commit cb30a98
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/expo/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- Showing warnings for missing native modules rather than throwing errors. ([#19845](https://github.com/expo/expo/pull/19845) by [@kudo](https://github.com/kudo))

### 💡 Others

## 47.0.0-beta.8 — 2022-11-02
Expand Down
4 changes: 2 additions & 2 deletions packages/expo/build/proxies/NativeModules.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo/build/proxies/NativeModules.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/expo/src/proxies/NativeModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export function createProxyForNativeModules(NativeModules: any) {
target.NativeUnimoduleProxy?.modulesConstants.ExponentConstants?.executionEnvironment ===
ExecutionEnvironment.StoreClient;
if (isRunningInStoreClient) {
throw new Error(createErrorMessageForStoreClient(prop));
console.warn(createErrorMessageForStoreClient(prop));
} else if (target.EXDevLauncher) {
throw new Error(createErrorMessageForDevelopmentBuild(prop));
console.warn(createErrorMessageForDevelopmentBuild(prop));
}
}
return value;
Expand Down

0 comments on commit cb30a98

Please sign in to comment.