react-native-macos/ReactAndroid
Dulmandakh 7b33d6b0b9 fix WritableArray, WritableMap nullable annotations (#23397)
Summary:
Recently, I added nullable annotations to ReadableArray, ReadableMap, WritableArray, WritableMap and subclasses to improve Kotlin developer experience. But found that I made mistake with pushArray, pushMap, pushString method of WritableArray, and putArray, putMap, putString methods of WritableMap. This PR fixes previous mistake.

Excerpt from WritableNativeArray.cpp.
```cpp
void WritableNativeArray::pushString(jstring value) {
  if (value == NULL) {
    pushNull();
    return;
  }
  throwIfConsumed();
  array_.push_back(wrap_alias(value)->toStdString());
}

void WritableNativeArray::pushNativeArray(WritableNativeArray* otherArray) {
  if (otherArray == NULL) {
    pushNull();
    return;
  }
  throwIfConsumed();
  array_.push_back(otherArray->consume());
}

void WritableNativeArray::pushNativeMap(WritableNativeMap* map) {
  if (map == NULL) {
    pushNull();
    return;
  }
  throwIfConsumed();
  array_.push_back(map->consume());
}
```

Excerpt from WritableNativeMap.cpp
```cpp
void WritableNativeMap::putString(std::string key, alias_ref<jstring> val) {
  if (!val) {
    putNull(std::move(key));
    return;
  }
  throwIfConsumed();
  map_.insert(std::move(key), val->toString());
}

void WritableNativeMap::putNativeArray(std::string key, WritableNativeArray* otherArray) {
  if (!otherArray) {
    putNull(std::move(key));
    return;
  }
  throwIfConsumed();
  map_.insert(key, otherArray->consume());
}

void WritableNativeMap::putNativeMap(std::string key, WritableNativeMap *otherMap) {
  if (!otherMap) {
    putNull(std::move(key));
    return;
  }
  throwIfConsumed();
  map_.insert(std::move(key), otherMap->consume());
}
```

[Android] [Changed] - fix nullable annotations in WritableArray, WritableMap
Pull Request resolved: https://github.com/facebook/react-native/pull/23397

Differential Revision: D14044014

Pulled By: cpojer

fbshipit-source-id: c44ea2e097e7b1156223b516aa640a181f0d4a9b
2019-02-12 06:26:34 -08:00
..
libs Upgrade Android support library to version 28 in RN 2019-01-22 10:44:53 -08:00
src fix WritableArray, WritableMap nullable annotations (#23397) 2019-02-12 06:26:34 -08:00
.npmignore Don't publish /ReactAndroid/build to npm, update version on master 2015-10-12 11:11:40 -07:00
DevExperience.md CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
README.md Fixing link to Android build guide. 2018-05-27 15:17:55 -07:00
build.gradle Prepare Groovy scripts for Kotlin DSL migration (#23355) 2019-02-09 10:18:07 -08:00
gradle.properties bump soloader to 0.6.0 (#23239) 2019-02-01 03:40:37 -08:00
proguard-rules.pro Remove UIProp class from redex and proguard rules, it doesn't exist 2019-01-28 14:42:03 -08:00
release.gradle Prepare Groovy scripts for Kotlin DSL migration (#23355) 2019-02-09 10:18:07 -08:00

README.md

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.