History log of /expo/packages/expo-modules-core/android/src/main/cpp/JavaScriptRuntime.cpp (Results 1 – 19 of 19)
Revision Date Author Comments
# 12cf8561 21-Sep-2023 lukmccall <[email protected]>

[core][Android] Fix failing instrumental tests


# db6683c6 19-Aug-2023 Kudo Chien <[email protected]>

[core][dev-menu] fix react-native 0.73 compatibility [2/3] (#24019)

# Why

fix react-native 0.73 compatibility. this pr focus on react-native 0.73 breaking changes.

# How

- [core] fix compat

[core][dev-menu] fix react-native 0.73 compatibility [2/3] (#24019)

# Why

fix react-native 0.73 compatibility. this pr focus on react-native 0.73 breaking changes.

# How

- [core] fix compatibility of `NativeMethodCallInvoker` renaming: https://github.com/facebook/react-native/commit/b70f186b53
- [dev-menu] fix compatibility of `RCTAppDelegate` changes.
- [core] fix ios runtime crash from [upstream change](https://github.com/facebook/react-native/blob/540c41be9/packages/react-native/React/Views/RCTComponentData.m#L506-L507)
- [core] fix android build error because BOOST_VERSION is removed from `gradle.properties`

# Test Plan

ci passed in #23961 (https://github.com/expo/expo/pull/23961/checks)

show more ...


# e1f25825 08-Aug-2023 Łukasz Kosmaty <[email protected]>

[core] Move `defineProperty` and `ObjectDeallocator` to common code (#23860)

# Why

Moves `defineProperty` and `ObjectDeallocator` to common code.

# Test Plan

- bare-expo ✅
- native-tester

[core] Move `defineProperty` and `ObjectDeallocator` to common code (#23860)

# Why

Moves `defineProperty` and `ObjectDeallocator` to common code.

# Test Plan

- bare-expo ✅
- native-tester ✅

show more ...


# b702c83d 26-Jul-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Add `CoreModule` defining the `global.expo` object (#23654)

# Why

This a follow-up to the https://github.com/expo/expo/pull/22567.
Closes ENG-8810.

# How

We want the `globa

[core][Android] Add `CoreModule` defining the `global.expo` object (#23654)

# Why

This a follow-up to the https://github.com/expo/expo/pull/22567.
Closes ENG-8810.

# How

We want the `global.expo` object to be automatically built and decorated. The best and easiest approach is to introduce the `CoreModule` that will live outside the module registry but will be used to build the object for `global.expo`.

# Test Plan

- automatic tests ✅
- bare-expo ✅

show more ...


# 29e8b6f8 25-May-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Bind `JNIDeallocator` to the context (#22610)

# Why

Binds the `JNIDeallocator` to the current context.

# How

I've discovered that making `JNIDeallocator` static wasn't a go

[core][Android] Bind `JNIDeallocator` to the context (#22610)

# Why

Binds the `JNIDeallocator` to the current context.

# How

I've discovered that making `JNIDeallocator` static wasn't a good decision. This approach failed to function properly when we migrated to our API in the dev-launcher context. Whenever the user switches between the app and launcher, the app will crash since the dev-launcher remains in memory, but the app context's destruction causes all registered objects inside the `JNIDeallocator` to deallocate. Consequently, we're removing js objects associated with the dev-launcher context, even if it's still valid.

# Test Plan

- bare-expo with and without dev-client ✅
- unit tests ✅

show more ...


# 879827bb 06-Apr-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Add functions converter (#21976)

# Why

Adds functions converter.

# How

- Adds a frontend and backend converter for js function type
- Adds ability to call those functions

[core][Android] Add functions converter (#21976)

# Why

Adds functions converter.

# How

- Adds a frontend and backend converter for js function type
- Adds ability to call those functions via Kotlin code

# Test Plan

- unit tests ✅

show more ...


# 84f418d7 17-Jan-2023 Kudo Chien <[email protected]>

[1/3] upgrade react-native 0.71 (#20799)

# Why

upgrade react-native 0.71 for sdk 48
close ENG-7192

# How

- update package versions
- `react: 18.1.0 -> 18.2.0`
- `react-native 0.70.5

[1/3] upgrade react-native 0.71 (#20799)

# Why

upgrade react-native 0.71 for sdk 48
close ENG-7192

# How

- update package versions
- `react: 18.1.0 -> 18.2.0`
- `react-native 0.70.5 -> 0.71.0`
- `react-dom: 18.1.0 -> 18.2.0`
- `react-test-renderer: 18.1.0 -> 18.2.0`
- `react-native-web: 0.18.9 -> 0.18.10`
- `babel-plugin-react-native-web: 0.18.9 -> 0.18.10`
- `metro-react-native-babel-preset: 0.72.3 -> 0.73.5`
- upgrade three project templates based on [upgrade-helper](https://react-native-community.github.io/upgrade-helper/?from=0.70.6&to=0.71.0)
- bare-expo
- expo-template-bare-minimum
- fabric-tester (this is based on `npx expo prebuild --clean --no-install --template /path/to/expo-template-bare-minimum.tgz`) so it includes some inconsistent changes
- [@expo/config-plugins]: support 0.71 template transform. the `namespace` in build.gradle and the files in `release` build variants
- [fbjni] upgrade 0.3.0 to align 0.71 (also ndk version)
- [expo-updates] move the `EX_UPDATES_NATIVE_DEBUG` `bundleInDebug` setup to templates. unfortunately, because RNGP setups the task dependencies pretty early. the original setup in expo-updates build.gradle is too late. note that the change doesn't reference any files from templates to expo-updates package. somehow it's not tightly coupled.
- [native-tests / expo-modules-test-core / expo-modules-autolinking] fix ios unit test build error because jsc now in a dedicated podspec. in theory, the ios native unit test could now run on hermes as well.
- for other details, please check commit histories one by one.

# Test Plan

- bare-expo ios / android
- fabric ios / android
- ci passed (except ios)
- test-suite ios is broken for unknown reasons. it breaks only on github actions and hermes. for nightlies testing, i also [changed it to jsc](https://github.com/expo/expo/blob/1e029c89c4247802cc4880e27e116a6b4c71c502/tools/src/commands/SetupReactNativeNightly.ts#L287-L293) to make ci green. i'll try to follow up and investigate the root cause.

show more ...


# dedc0ffd 29-Sep-2022 Łukasz Kosmaty <[email protected]>

[modules][Android] Install modules host object as `global.expo.modules` instead of `global.ExpoModules` (#19281)

# Why

A follow-up to https://github.com/expo/expo/pull/19273.

# How

- Added

[modules][Android] Install modules host object as `global.expo.modules` instead of `global.ExpoModules` (#19281)

# Why

A follow-up to https://github.com/expo/expo/pull/19273.

# How

- Added `global.expo` object to the runtime.
- Installed the Expo Modules host object as `global.expo.modules`.
- Deprecated `global.ExpoModules`, which will still exist in SDK47 for one-cycle backward compatibility. It can be removed in SDK48.
- Migrated references to `global.ExpoModules` in native unit tests

# Test Plan

- unit test ✅
- NCL ✅

show more ...


# 57cd185a 30-Aug-2022 Kudo Chien <[email protected]>

[core] Decouple jsc or hermes runtime lib on Android (#18899)

# Why

the expo-modules-core links hermes or jsc to create a js runtime, however the call flow is only for android instrumented test.

[core] Decouple jsc or hermes runtime lib on Android (#18899)

# Why

the expo-modules-core links hermes or jsc to create a js runtime, however the call flow is only for android instrumented test. the test code increases build time as well as introducing the lib dependency to hermes/jsc and then breaks v8 support.
fix https://github.com/Kudo/react-native-v8/issues/134

# How

- Use `UNIT_TEST` preprocessor for the test code.
- change `FOR_HERMES -> USE_HERMES`

# Test Plan

- bare-expo
- `./gradlew :expo-modules-core:connectedAndroidTest` in `android`. this is running instrumented test on jsc
- `./gradlew :expo-modules-core:connectedAndroidTest` in `apps/bare-expo/android`. this is running instrumented test on hermes
- unzip the apk and use `objdump -x /path/to/libexpo-modules-core.so` to make sure there's no hermes or jsc dependency.

show more ...


# 8bd57a9a 27-Jul-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Improve JSI error handling (#18259)

# Why

Improves error handling in functions that are called via JSI.
All API errors should look like this:
```
expo.modules.kotlin.jni.Pr

[sweet API][Kotlin] Improve JSI error handling (#18259)

# Why

Improves error handling in functions that are called via JSI.
All API errors should look like this:
```
expo.modules.kotlin.jni.PromiseException: Call to function 'f.TestModule' has been rejected.
→ Caused by: java.lang.IllegalStateException
```

# How

- Exported `CodedError` and use it to wrap the bare Kotlin exceptioThathat makes expressions like this `exception instanceOf CodedError` work.
- Added more `exceptionDecorator` blocks to add more context to the exceptions inside of exported functions.
- Mocked `CodedError` class in the test environment.

# Test Plan

- unit tests ✅

show more ...


# 256b5942 27-Jul-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Simplify usage of `JavaScriptRuntime` (#18382)

# Why

In many places, we have a similar code that accesses the `jsi::Runtime` from `weak_ptr`. It makes the code hard to read. S

[sweet API][Kotlin] Simplify usage of `JavaScriptRuntime` (#18382)

# Why

In many places, we have a similar code that accesses the `jsi::Runtime` from `weak_ptr`. It makes the code hard to read. So I decided to decorate the `std::weak_ptr<JavaScriptRuntime>` with additional access functions.

# How

Added a `WeakRuntimeHolder` with two additional methods to access `jsi::Runtime`

# Test Plan

- unit tests ✅

show more ...


# c27399f5 13-Jul-2022 Łukasz Kosmaty <[email protected]>

[core][Kotlin] `JavaScriptRuntime::evaluateScript` function cleanup (#18210)

# Why

A small cleanup of the `JavaScriptRuntime::evaluateScript` function.


# 33581d18 28-Jun-2022 Łukasz Kosmaty <[email protected]>

[sweet][Kotlin] Fix instrumental tests not working on JSC (#18009)

# Why

Fixes instrumental tests not working on JSC

# How

It turns out that the `global` property isn't set up in JSC too.

[sweet][Kotlin] Fix instrumental tests not working on JSC (#18009)

# Why

Fixes instrumental tests not working on JSC

# How

It turns out that the `global` property isn't set up in JSC too.
Also, I've improved an error message when the promise wasn't resolved.

# Test Plan

- run Android tests on JSC ✅

show more ...


# e3d1d66a 23-Jun-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Set up a test environment for async flow (#17943)

# Why

Sets up a test environment to work with async functions.

# How

- Implemented a basic `CallInvoker` that automati

[sweet API][Kotlin] Set up a test environment for async flow (#17943)

# Why

Sets up a test environment to work with async functions.

# How

- Implemented a basic `CallInvoker` that automatically calls the received function.
- Mocked `setImmediate ` function that is needed by Hermes `Promise` implementation.
- Exports a `global` object to the js.

show more ...


# a89667b6 23-Jun-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Add method to drain event loop (#17938)

# Why

Adds a method to drain even loop from Kotlin.

# How

Exposes a `drainMicrotasks` function from `JSI`.
This function is ver

[sweet API][Kotlin] Add method to drain event loop (#17938)

# Why

Adds a method to drain even loop from Kotlin.

# How

Exposes a `drainMicrotasks` function from `JSI`.
This function is very handy when you're trying to test async flows.

show more ...


# 342f32d0 31-May-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Add `JavaScriptRuntime.createObject` (#17687)

# Why

Adds `JavaScriptRuntime.createObject`

# How

Adds a simple method to create an empty object without running `evaluateS

[sweet API][Kotlin] Add `JavaScriptRuntime.createObject` (#17687)

# Why

Adds `JavaScriptRuntime.createObject`

# How

Adds a simple method to create an empty object without running `evaluateScript`.

# Test Plan

- unit tests ✅

show more ...


# 14c0f05d 31-May-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Add `JavaScriptObject.setProperty` (#17684)

# Why

Adds `setProperty` to the `JavaScriptObject`.

# How

- Adds a base interface to indicate if the derived class wrap a jsi

[sweet API][Kotlin] Add `JavaScriptObject.setProperty` (#17684)

# Why

Adds `setProperty` to the `JavaScriptObject`.

# How

- Adds a base interface to indicate if the derived class wrap a jsi::Value or jsi::Object.
- Adds a conversion between JNI and jsi objects based on the type traits.
- Hides raw JNI API in the `JavaScriptObject` using methods overload.
- Adds unit tests

# Test Plan

- unit tests ✅

show more ...


# a416e6db 24-May-2022 Łukasz Kosmaty <[email protected]>

[sweet][Kotlin] Add `evaluateScript` function (#17586)

# Why

Adds a `evaluateScript` function.
Also, adds wrappers for `jsi::Value` and `jsi::Object`.

# How

Exposes a `evaluateScript` fun

[sweet][Kotlin] Add `evaluateScript` function (#17586)

# Why

Adds a `evaluateScript` function.
Also, adds wrappers for `jsi::Value` and `jsi::Object`.

# How

Exposes a `evaluateScript` function to Kotlin (it's pretty handy in the tests environment). I've also created a wrapper for jsi types. For now, it's read-only, but that will be expanded in the future.

# Test Plan

- unit tests ✅

show more ...


# 64f5c95f 17-May-2022 Łukasz Kosmaty <[email protected]>

[module-core][Kotlin] Add basic support for sync function (#16977)

# Why

Closes ENG-4608.
Adds basic support for sync function.

# How

- Created ExpoModulesHostObject that installs into the

[module-core][Kotlin] Add basic support for sync function (#16977)

# Why

Closes ENG-4608.
Adds basic support for sync function.

# How

- Created ExpoModulesHostObject that installs into the runtime as `global.ExpoModules`. A host object is an abstract object where we can define our property getter, allowing us to create JS object for each module lazily.
- Added `isAsync` property to sweet functions and `runSynchronously()` modifier - that will be changed in the future.
- Created `JavaScriptModuleObject` that represents a module in the JS world. It has a map of methods with a cached body.
- All the communication goes via two kotlin methods - `getJavaScriptModuleObject` (which returns a hybrid representation of the module) and `callMethodSync` (which is calling correct implementation). Right now, I'm not using lambdas to pass Kotlin functions into CPP, because I don't see any reason why should I.

# Test Plan

- tested with bare-expo ✅

show more ...