Skip to content

Commit

Permalink
[@unimodules/core] Add support for Bundle in MapArguments#toBundle (#…
Browse files Browse the repository at this point in the history
…8068)

# Why

Sometimes `data` comes in `Bundle`, which later can't be serialized properly:

![Screenshot_2020-04-15-12-53-04-597_com miui bugreport](https://user-images.githubusercontent.com/1151041/80567655-ededd100-89f5-11ea-8bae-258810c13318.jpg)

# How

Added support for `Bundle` in the offending `MapArguments#toBundle` method.

# Test Plan

The fix has been confirmed by outside contributors.
  • Loading branch information
sjchmiela committed Apr 29, 2020
1 parent 0dddd79 commit e8ae25a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@unimodules/core/CHANGELOG.md
Expand Up @@ -9,3 +9,4 @@
### 🐛 Bug fixes

- Fixed a rare undetermined behavior that may have been a result of misuse of `dispatch_once_t` on iOS ([#7576](https://github.com/expo/expo/pull/7576) by [@sjchmiela](https://github.com/sjchmiela))
- Fixed error when serializing a `Map` containing a `Bundle` ([#8068](https://github.com/expo/expo/pull/8068) by [@sjchmiela](https://github.com/sjchmiela))
Expand Up @@ -156,6 +156,8 @@ public Bundle toBundle() {
bundle.putParcelableArrayList(key, (ArrayList) value);
} else if (value instanceof Map) {
bundle.putBundle(key, new MapArguments((Map) value).toBundle());
} else if (value instanceof Bundle) {
bundle.putBundle(key, (Bundle) value);
} else {
throw new UnsupportedOperationException("Could not put a value of " + value.getClass() + " to bundle.");
}
Expand Down

0 comments on commit e8ae25a

Please sign in to comment.