mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-02 09:21:44 +08:00
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 https://github.com/facebook/react-native/pull/15056 Differential Revision: D5460966 Pulled By: javache fbshipit-source-id: a11b450eae4186e68bed7b8ce7dea8e5982e689a
Building React Native for Android
See the docs on the website.
Running tests
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see Testing.