Please sign in to comment.
Android: Added support to arrays in toBundle
Summary: The support for `ReadableArray` in `toBundle` was never implemented, throwing an `UnsupportedOperationException` when trying to convert an array. * Created `toList` -- A method that converts a `ReadableArray` to an `ArrayList` * Modified `toBundle` to support arrays using `toList` * Created `fromList` -- A method that converts a `List` to a `WritableArray` * Modified `fromBundle` to also support lists using `fromList` This PR allows `toBundle` and `fromBundle` (as well as `toList` and `fromList`) to work consistently without loosing information. **Test Plan** I've created three different arrays: one full of integers, one full of strings, and one mixed (with a integer, a boolean, a string, null, a map with a string and a boolean array), putting all of them inside a map. After converting the map to a `Bundle` using `toBundle`, the integer array was retrieved through `Bundle.getIntegerArrayList`, the string array through `Bundle.getStringArrayList` and the mixed array through `Bundle.get` (casting it to an `ArrayList`) After checking whether each value from the bundle was correct, I converted the bundle back to a map using `fromBundle`, and checked again every value. The code and results from the test can be found in [this gist](https://gist.github.com/Guichaguri/5c7574b31f9584b6a9a0c182fd940a86). Closes #15056 Differential Revision: D5460966 Pulled By: javache fbshipit-source-id: a11b450eae4186e68bed7b8ce7dea8e5982e689a
- Loading branch information...
Showing with 90 additions and 2 deletions.