Skip to content
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

[core] Add requireNativeModule function #15848

Merged
merged 4 commits into from
Jan 11, 2022

Conversation

tsapeta
Copy link
Member

@tsapeta tsapeta commented Jan 8, 2022

Why

Followup #15847

How

Added requireNativeModule that loads the native module from global.ExpoModules host object (managed by JSI), or if it's not there, the old NativeModulesProxy bridge module.

Test Plan

Tested with aforementioned PR. It can't break anything as it's still not used anywhere 😉

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jan 8, 2022
@tsapeta tsapeta force-pushed the @tsapeta/core/require-native-module branch from 880f392 to f495f97 Compare January 8, 2022 22:14
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jan 8, 2022
@tsapeta tsapeta marked this pull request as ready for review January 8, 2022 23:29
Copy link
Contributor

@bbarthec bbarthec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Notice that the modules loaded from the proxy may not support some features like synchronous functions.

I guess we should mark it somehow, shouldn't we? Like using some additional property descriptor?

@tsapeta
Copy link
Member Author

tsapeta commented Jan 10, 2022

Notice that the modules loaded from the proxy may not support some features like synchronous functions.

I guess we should mark it somehow, shouldn't we? Like using some additional property descriptor?

Yeah, that's good idea. I'll remember to do this once we start using such features — so probably when I migrate expo-random.

tsapeta and others added 3 commits January 10, 2022 23:52
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@tsapeta tsapeta force-pushed the @tsapeta/core/require-native-module branch from 0bb747e to d9685af Compare January 10, 2022 22:53
@tsapeta tsapeta merged commit d46e3a1 into master Jan 11, 2022
@tsapeta tsapeta deleted the @tsapeta/core/require-native-module branch January 11, 2022 09:27
lukmccall added a commit to software-mansion-labs/expo-maps that referenced this pull request Jan 27, 2022
Bump `expo-modules-core` to `0.7.0`:

# Changelog:

## 0.7.0 — 2022-01-26

### 🎉 New features

- Allow accessing `RCTBridge` from the modules on iOS. ([#15816](expo/expo#15816) by [@tsapeta](https://github.com/tsapeta))
- Added support for native callbacks through the view props in Sweet API on iOS. ([#15731](expo/expo#15731) by [@tsapeta](https://github.com/tsapeta))
- Added support for native callbacks through the view props in Sweet API on Android. ([#15743](expo/expo#15743) by [@lukmccall](https://github.com/lukmccall))
- The `ModuleDefinition` will use class name if the `name` component wasn't provided in Sweet API on Android. ([#15738](expo/expo#15738) by [@lukmccall](https://github.com/lukmccall))
- Added `onViewDestroys` component to the `ViewManager` in Sweet API on Android. ([#15740](expo/expo#15740) by [@lukmccall](https://github.com/lukmccall))
- Added shortened `constants` component that takes `vargs Pair<String, Any?>` as an argument in Sweet API on Android. ([#15742](expo/expo#15742) by [@lukmccall](https://github.com/lukmccall))
- Introduced the concept of chainable exceptions in Sweet API on iOS. ([#15813](expo/expo#15813) by [@tsapeta](https://github.com/tsapeta))
- Sweet function closures can throw errors on iOS. ([#15849](expo/expo#15849) by [@tsapeta](https://github.com/tsapeta))
- Add `requireNativeModule` function to replace accessing native modules from `NativeModulesProxy`. ([#15848](expo/expo#15848) by [@tsapeta](https://github.com/tsapeta))
- Implemented basic functionality of JSI host object to replace `NativeModulesProxy` on iOS. ([#15847](expo/expo#15847) by [@tsapeta](https://github.com/tsapeta))

### 🐛 Bug fixes

- It's no longer possible to directly call methods from the `ModuleDefinition` in the `ViewManagers` on Android. ([#15741](expo/expo#15741) by [@lukmccall](https://github.com/lukmccall))
- Fix compatibility with react-native 0.66. ([#15914](expo/expo#15914) by [@Kudo](https://github.com/kudo))

## 0.6.4 — 2022-01-05

### 🐛 Bug fixes

- Fix `ReactInstanceManager.onHostPause` exception from moving Android apps to background. ([#15748](expo/expo#15748) by [@Kudo](https://github.com/kudo))

## 0.6.3 — 2021-12-16

### 🐛 Bug fixes

- Fixed the deep link wasn't passed to the application if the application wasn't running when the deep link was sent. ([#15593](expo/expo#15593) by [@lukmccall](https://github.com/lukmccall))

## 0.6.2 — 2021-12-15

### 🎉 New features

- Add `onNewIntent` and `onBackPressed` support to `ReactActivityLifecycleListener`. ([#15550](expo/expo#15550) by [@Kudo](https://github.com/Kudo))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants