Skip to content

[pull] main from expo:main#640

Merged
pull[bot] merged 1 commit intocode:mainfrom
expo:main
Mar 2, 2026
Merged

[pull] main from expo:main#640
pull[bot] merged 1 commit intocode:mainfrom
expo:main

Conversation

@pull
Copy link

@pull pull bot commented Mar 2, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

…sults (#42641)

# Why

When returning arrays/dictionaries to JS, their dynamic types only shallow-convert arguments, which breaks for more complex returned types.

- When an array of mixed values is returned, the [`elementType`](https://github.com/expo/expo/blob/bf5c4aefbf6b67f37f5f6870a6f80c2efa4c8171/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicArrayType.swift#L41) is of type [`DynamicRawType`](https://github.com/expo/expo/blob/main/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicRawType.swift) even if array elements have their own dynamic type converters
- The [`DynamicDictionaryType`](https://github.com/expo/expo/blob/main/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicDictionaryType.swift) is missing the `convertResults` at all

Example where this matters:
[This return](https://github.com/expo/expo/blob/bf5c4aefbf6b67f37f5f6870a6f80c2efa4c8171/packages/expo-sqlite/ios/SQLiteModule.swift#L419) can be of type:
```js
{
   lastInsertRowId: 1,
   changes: 0,
   firstRowValues: [1, <<ArrayBuffer>>]
}
```

Primitives and nested arrays are converted, but ArrayBuffer is being `undefined` because, without this change, the `value` inside [`convertObjCObjectToJSIValue`](https://github.com/expo/expo/blob/bf5c4aefbf6b67f37f5f6870a6f80c2efa4c8171/packages/expo-modules-core/ios/JSI/EXJSIConversions.mm#L100) is of type [`ExpoModulesCore.NativeArrayBuffer`](https://github.com/expo/expo/blob/7cac70926cb456f8a1a7673d68d4a84800099071/packages/expo-modules-core/ios/Core/ArrayBuffers/ArrayBuffer.swift#L7) instead of `EXArrayBuffer` and the conditional is skipped.
This is caused by [`DynamicArrayBufferType.convertResult()`](https://github.com/expo/expo/blob/7cac70926cb456f8a1a7673d68d4a84800099071/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicArrayBufferType.swift#L35) not being called when converting array/dict

# How

**Note**: this change might negatively affect conversion performance, but I'm unsure how big the impact of using [`convertFunctionResult()`](https://github.com/expo/expo/blob/bf5c4aefbf6b67f37f5f6870a6f80c2efa4c8171/packages/expo-modules-core/ios/Core/Conversions.swift#L182) is.

- Updated array dynamic type's convertResult to use `Conversions.convertFunctionResult()` which respects value types
- Added `convertResult` to dictionary dynamic type as it was missing there

# Test Plan

- Tested on the SQLite stack (#42642) which required this change.
- Added unit test for `DynamicArrayType` and a test suite for `DynamicDictionaryType`

# Checklist

- [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
@pull pull bot locked and limited conversation to collaborators Mar 2, 2026
@pull pull bot added the ⤵️ pull label Mar 2, 2026
@pull pull bot merged commit 1a65e69 into code:main Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant