| #
732f0c04 |
| 27-Mar-2023 |
Łukasz Kosmaty <[email protected]> |
[core][Android] Add converter for `View` (#21816)
# Why
Adds a converter for the `View` type.
If you're using our view, it will be converted from the view instance. If not, you can always pass t
[core][Android] Add converter for `View` (#21816)
# Why
Adds a converter for the `View` type.
If you're using our view, it will be converted from the view instance. If not, you can always pass the view tag.
# How
- Added a front-end and back-end for view type.
- Allowed conversion from int or expo view object to the view's class.
# Usage
```tsx
class ExpoView {
nativeRef = React.createRef<NativeViewRef>();
function() {
return this.nativeRef.current?.function?.();
}
render() {
return <NativeView nativeRef={this.nativeRef} />
}
}
```
```kotlin
AsyncFunction("function") { view: ExpoView ->
// your code
}
```
# Test Plan
- unit tests ✅
- clear function on expo-image
show more ...
|
| #
d8bd928c |
| 19-Oct-2022 |
Łukasz Kosmaty <[email protected]> |
[modules][Android] Fix exceptions handling in async functions (#19611)
# Why
Fixes test-suites:
```
- Calendar
- First run only: getEventsAsync() resolves to an array with an event of the
[modules][Android] Fix exceptions handling in async functions (#19611)
# Why
Fixes test-suites:
```
- Calendar
- First run only: getEventsAsync() resolves to an array with an event of the correct shape (expected 0 to be 1)
- Subsequent runs: deleteEventAsync(), deletes an event -expected false to be true
```
This is a follow-up to https://github.com/expo/expo/pull/19605.
# How
- Made sure that promises reject with a coded error instead of the plain js object.
- If something was thrown in the CPP code, the promise will also be rejected.
# Test Plan
- test-suite ✅
- manually test some corner case behavior ✅
show more ...
|
| #
e0f520f5 |
| 19-Oct-2022 |
Kudo Chien <[email protected]> |
[packages] Fix expo-modules-core androidTest (#19559)
# Why
follow up with #19411 to make expo-modules-core androidTest correctly
# How
those commented test cases break because we try to ca
[packages] Fix expo-modules-core androidTest (#19559)
# Why
follow up with #19411 to make expo-modules-core androidTest correctly
# How
those commented test cases break because we try to catch exceptions across shared library boundaries. there are a couple root causes actually:
## incompatible ndk versions
before ndk r23, the unwind library is libgcc, and after r23, the implementation is llvm libunwind. these two unwind implementation is incompatible. [email protected] and prebuilt react-native libs are all built from ndk r21. if we run the androidTest on m1 machine, we will use ndk r24 to build libraries. that's why we cannot catch fbjni exceptions in this situation. the pr tries to re-implement fbjni method calls and throw exceptions inline. that would make jni exceptions catchable.
other than that, when targeting prebuilt react-native, we should also use the same ndk r21 to build expo-modules-core. even we are on m1 machines.
## jscexecutor missing `_Unwind_Resume` symbol
the case happens when ndk r21 + jsc only, and this is also our ci android instrumented test environment. as [the ndk document](https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#unwinding) mentioned, for ndk r21, we should take care linking order. [this react-native fork patch](https://github.com/expo/react-native/commit/3986a385502df3eb207ca05f0b558171a600166c) addressed the issue.
if we test jsc on bare-expo, these test cases will still crash. i don't want to fix it or proposing the fix to upstream in the meantime. the latest react-native with AGP 7.3, the side-by-side ndk is already r23. since these are actually error cases, it's just not crash with correct stacktrace (not from expo-modules-core, but jscexecutor)
## c++_static runtime in expo-modules-core androidTest
always uses c++_shared runtime: the c++_static runtime doesn't well support the throw exceptions between shared library boundaries. we used c++_static because we want to fix the `et android-native-unit-tests -t instrumented` failures where the `./gradlew :expo-modules-core:connectedAndroidTest :expo-eas-client:connectedAndroidTest` will have duplicated fbjni.so build errors. this pr also reorganizes `et android-native-unit-tests` to build expo-modules-core androidTest exclusively.
# Test Plan
android instrumented ci passed
show more ...
|
| #
b7d1787d |
| 12-Aug-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API] Cache PropNameID and js objects (#18579)
# Why
Adds a cache for prop name IDs and js objects like `Promise` or `CodedError`.
# How
- Added a cache registry
- Added missing tr
[sweet API] Cache PropNameID and js objects (#18579)
# Why
Adds a cache for prop name IDs and js objects like `Promise` or `CodedError`.
# How
- Added a cache registry
- Added missing try catch in the async function
# Test Plan
- unit tests ✅
show more ...
|
| #
ce6f2823 |
| 12-Aug-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API] Throw missing exceptions (#18578)
# Why
I forgot to throw exceptions in two corner cases:
- when js type is not convertible to a Kotlin object - like Symbol
- when the js value has
[sweet API] Throw missing exceptions (#18578)
# Why
I forgot to throw exceptions in two corner cases:
- when js type is not convertible to a Kotlin object - like Symbol
- when the js value has an unknown type
# How
- Exported `UnknownException` to the C++.
- Add missing exceptions.
# Test Plan
- unit tests that will be added in a separate PR
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 ...
|
| #
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 ...
|