Граф коммитов

15741 Коммитов

Автор SHA1 Сообщение Дата
Mike Grabowski 69e5c2ddc1 [0.59.0-rc.0] Bump version numbers 2019-02-13 16:37:12 +01:00
Mike Grabowski 977458442c Revert "add basic signature in template (#22665)"
This reverts commit 63ebbd6bfc.
2019-02-13 16:35:06 +01:00
Mike Grabowski a252aee2ea Bump CLI dependency 2019-02-13 16:35:02 +01:00
Mike Grabowski 06bc4b5b7c Explicitly set path to React Native for development 2019-02-13 15:23:30 +01:00
Mike Grabowski 5e1504b0fc Update CLI dependency 2019-02-13 15:21:28 +01:00
Wellinton Monge e2bd7db732 Merge AlertIOS with Alert (#23318)
Summary:
Itwas merged AlertIOS into Alert and removed type parameter from Alert.alert line 60 at Alert.js

[AlertIOS] [Change and Replace] - Merge AlertIOS into Alert.
Pull Request resolved: https://github.com/facebook/react-native/pull/23318

Reviewed By: mjesun

Differential Revision: D14031421

Pulled By: cpojer

fbshipit-source-id: 98db173adeb65aa90d309f8a583993bc0cddb6e1
2019-02-12 07:38:42 -08:00
Mike Nedosekin 4ac65f5413 Add deprecation warning for MaskedViewIOS (#23398)
Summary:
Add a deprecation warning for the [MaskedViewIOS](https://facebook.github.io/react-native/docs/maskedviewios) module as part of #23313.
[General] [Deprecated] - Deprecated [MaskedViewIOS](https://facebook.github.io/react-native/docs/maskedviewios) as it has now been moved to [react-native-community/masked-view](https://github.com/react-native-community/react-native-masked-view)
Pull Request resolved: https://github.com/facebook/react-native/pull/23398

Differential Revision: D14045290

Pulled By: cpojer

fbshipit-source-id: e97230f6861cf35ee0b49376d0a5c9c47d4e99f8
2019-02-12 07:14:02 -08:00
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
ferrannp 77300ca91c Add deprecation warning for ViewPagerAndroid (#23395)
Summary:
Add a deprecation warning for the [ViewPagerAndroid](https://facebook.github.io/react-native/docs/viewpagerandroid) module as part of #23313.

[General] [Deprecated] - Deprecated [ViewPagerAndroid](https://facebook.github.io/react-native/docs/viewpagerandroid) as it has now been moved to [react-native-community/viewpager](https://github.com/react-native-community/react-native-viewpager)
Pull Request resolved: https://github.com/facebook/react-native/pull/23395

Differential Revision: D14043025

Pulled By: cpojer

fbshipit-source-id: 2f7988fe69dbeff0f3add9babcb15d7eb974863e
2019-02-12 05:26:11 -08:00
Alex Dvornikov 3c74b6ea34 Bring back the unit tests for the Cxx implementation
Reviewed By: jeanlauliac

Differential Revision: D14026623

fbshipit-source-id: 76a4089bb09b7e5152e992a91eae0427877767c0
2019-02-12 04:50:52 -08:00
Evan Bacon daa79b0f97 Add Platform module for web target (#23387)
Summary:
Added a Platform file for module for instances where internal modules need Platform.
ex: 78be6efda9/Libraries/Utilities/Dimensions.js (L14)

* Added `Libraries/Utilities/Platform.web.js`
[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/23387

Differential Revision: D14041834

Pulled By: cpojer

fbshipit-source-id: 9be7ad647d6a644956efa622b936fcecee7c1a1f
2019-02-12 03:32:29 -08:00
Kevin Gozali 344b32bb64 TM iOS: avoid bad memory access when passing prop name to a lambda
Summary: Depending on the timing of the method call from JS to a CxxModule, we may be accessing memory that has been deallocated, causing exception to RN runtime. This fixes it.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D14033831

fbshipit-source-id: 5a77aa41223b1fc3146dcf78b7f8e93375605d6d
2019-02-11 17:29:14 -08:00
Joshua Gross 2c09c06a4d Enable support for using new MobileConfigNativeModule in RN Core/Fabric C++
Summary: Enable support for using new MobileConfigNativeModule in RN Core/Fabric C++. Hack will be removed as part of T40273916 once MobileConfigNativeModule has rolled out to 100% of users and FbReactMobileConfigModule has been removed.

Reviewed By: mdvacca

Differential Revision: D14015962

fbshipit-source-id: 1b8ff0fb447040393a25fd03d9fb868877228ecc
2019-02-11 16:56:14 -08:00
Joshua Gross a15e723476 Support MobileConfig in Fabric Core C++ in FB4A and Catalyst
Summary:
MobileConfig should be wrapped and presented as a ReactNativeConfig object so that core Fabric C++ code can use it.

This is just a noop plumbing diff. Real support will be added in follow-on diff.

Reviewed By: fkgozali

Differential Revision: D13985466

fbshipit-source-id: a2ac2175688e855eda3b89aa69faf07749c6bd31
2019-02-11 16:56:14 -08:00
Spencer Ahrens 864a30185d Add more init perf markers
Summary:
Adding some more systrace markers to track load application and the initial bits of MarketplaceHomeApp.

There are a couple big segments worth pointing out with timing from a local `__DEV__: false` run:

* JSBundleRequireTime_end -> BundlePreInitializeCore_start: 360ms
* MobileConfigModuleInit: 210ms
* renderApplication_React_render_start -> MarketplaceHomeAppConstructorSuper_start: 180ms
* MarketplaceHomeAppGetQueryParamsForCachedTopPicks: 100ms

I'm not sure what we can do about any of these except for MarketplaceHomeAppGetQueryParamsForCachedTopPicks where we could break the query params out into a separate file so we don't have to load this 11-thousand-line behemoth just so we can get this snippet:

diffusion/FBS/browse/master/xplat/js/RKJSModules/Apps/Wilde/Marketplace/apps/__generated__/MarketplaceHomeAppQuery.graphql.js$11831-11837

But maybe we have to load it anyway and the query just needs to be optimized (or maybe Relay can optimize the format here).

Reviewed By: yungsters

Differential Revision: D13969695

fbshipit-source-id: 4f39efa6cb591b814687bfe51b02ad92048f1c21
2019-02-11 16:50:40 -08:00
David Vacca 48ba44087f Remove unused code in ReactTextView
Summary: Trivial cleanup of variables and methods that were not being used in ReactTextView

Reviewed By: blairvanderhoof

Differential Revision: D14027630

fbshipit-source-id: e763d6d001d4a0c2970adebc9855190845cf5a1d
2019-02-11 16:01:05 -08:00
Valentin Shergin 222e650885 Fabric: Systraces are temporary disabled in Fabric C++ code
Summary: Now in BUCK file only, not in code.

Reviewed By: JoshuaGross

Differential Revision: D14019271

fbshipit-source-id: e1396be7156a374a1379a147ddecb83b51686121
2019-02-11 16:01:05 -08:00
Valentin Shergin 77838b5504 Fabric: Systraces are back
Summary:
It's better to comment `DWITH_FBSYSTRACE` out in BUCK files instead of removing them from the code.
I'll publish the BUCK changes as separate diff for simpler backout in the future.

Reviewed By: mdvacca

Differential Revision: D14019272

fbshipit-source-id: 8b322b5c115efe33c15929e008b97a05220813df
2019-02-11 16:01:05 -08:00
empyrical 78be6efda9 JSI: Minor tweaks for building on MSVC (#23367)
Summary:
This pull request makes two minor changes to `jsi.h`:

 * Tweak the `JSI_EXPORT` macro to automatically set itself to an empty value if `_MSC_VER` is defined - like how was done by acoates-ms [here](8beb4bb58a/ReactCommon/cxxreact/JSBigString.h (L15-L21)).
 * Tweak the call to constructor `Pointer(Runtime::PointerValue* ptr)` in the constructor for `PropNameID`. I am not sure why MSVC wasn't working with the original version, but it compiles after I tweak that.

[General] [Fixed] - Tweaked `jsi.h` to build on MSVC
Pull Request resolved: https://github.com/facebook/react-native/pull/23367

Differential Revision: D14032507

Pulled By: cpojer

fbshipit-source-id: 701c13e3509cc244dbe0c15f92067fae4382bee2
2019-02-11 15:42:18 -08:00
Andres Suarez aefb05941a Exclude RN templates from internal linters
Reviewed By: cpojer

Differential Revision: D14032447

fbshipit-source-id: b36c2e01b10341077bec7fca43a35e980e9c13ce
2019-02-11 15:42:17 -08:00
Héctor Ramos 2af13b4477 React sync for revisions aa94237...f24a0da
Summary:
This sync includes the following changes:
- **[f24a0da6e](https://github.com/facebook/react/commit/f24a0da6e )**: Fix useImperativeHandle to have no deps by default (#14801) //<Dan Abramov>//
- **[1fecba923](https://github.com/facebook/react/commit/1fecba923 )**: Fix crash unmounting an empty Portal (#14820) //<Dan Abramov>//
- **[c11015ff4](https://github.com/facebook/react/commit/c11015ff4 )**: fix spelling mistakes (#14805) //<zhuoli99>//
- **[3e295edd5](https://github.com/facebook/react/commit/3e295edd5 )**: Typo fix in comment (#14787) //<Deniz Susman>//
- **[1d48b4a68](https://github.com/facebook/react/commit/1d48b4a68 )**: Fix hydration with createRoot warning (#14808) //<Sebastian Markbåge>//

Release Notes:
[GENERAL] [Changed] - React sync for revisions aa94237...f24a0da

Reviewed By: cpojer

Differential Revision: D14030552

fbshipit-source-id: f8df9d8e532b2afef59dbbc10715bd52fd22b355
2019-02-11 15:26:44 -08:00
Rick Hanlon 34763bf7f9 Update script to parse all specs in folder
Summary:
Updates the combine-js-to-schema to expose a cli and combine all passed files into a single schema output

Note: as far as I could tell, there isn't a way for buck to pass a glob of directories, so instead of accepting a dir and crawling it, this update accepts a list of files and combines them. Which makes sense, since buck is good at crawling already

Reviewed By: TheSavior

Differential Revision: D14007193

fbshipit-source-id: dbc209bb8d1cadd381269e9f70dc71a90f77878e
2019-02-11 15:18:39 -08:00
David Vacca 17e1694076 Stop preallocation views on the main thread
Summary:
There is no reason to allocate views ahead of time on the main thread.
There is a chance that this view will not be mounted and we are not saving any time because it's a sequential process anyway (because we are doing it on the main thread). Moreover, the switching context can only slowdown JS execution.

Reviewed By: JoshuaGross

Differential Revision: D14026379

fbshipit-source-id: 2dbe93ab32b611fae942468e7812b78afeaf34fc
2019-02-11 15:11:16 -08:00
Dulmandakh c6c5a173bc DatePickerDialogModule supports only FragmentActivity (#23371)
Summary:
Now RN has only ReactActivity which extends AppCompatActivity, subclass of FragmentActivity, therefore no need to check if activity is FragmentActivity or not. This PR changes DatePickerDialogModule to work only with FragmentActivity.

Also DialogFragment from Android is deprecated in API 28, and recommends to use DialogFragment from Support Library. Excerpt from DialogFragment documentation.

> **This class was deprecated in API level 28.**
> Use the Support Library DialogFragment for consistent behavior across all devices and access to Lifecycle.

**BREAKING CHANGE**: Brown field apps must extend FragmentActivity or its subclasses

[Android] [Changed] - DatePickerDialogModule supports only FragmentActivity
Pull Request resolved: https://github.com/facebook/react-native/pull/23371

Differential Revision: D14030765

Pulled By: cpojer

fbshipit-source-id: 3a1811102cf68b82c139f0e20b2fc8dab5d98b69
2019-02-11 15:03:36 -08:00
Dulmandakh be361d0fc1 TimePickerDialogModule supports only FragmentActivity (#23372)
Summary:
Now RN has only ReactActivity which extends AppCompatActivity, subclass of FragmentActivity, therefore no need to check if activity is FragmentActivity or not. This PR changes TimePickerDialogModule to work only with FragmentActivity.

Also DialogFragment from Android is deprecated in API 28, and recommends to use DialogFragment from Support Library. Excerpt from DialogFragment documentation.

> **This class was deprecated in API level 28.**
> Use the Support Library DialogFragment for consistent behavior across all devices and access to Lifecycle.

[Android] [Changed] - TimePickerDialogModule supports only FragmentActivity
Pull Request resolved: https://github.com/facebook/react-native/pull/23372

Differential Revision: D14030748

Pulled By: cpojer

fbshipit-source-id: 9b3778c90eb1c014260327513bc8709264b94431
2019-02-11 14:58:10 -08:00
zhongwuzw 9ff43abe65 Prevent crash when scrollEnabled used in singleline textinput (#23361)
Summary:
Fixes #22949 , #21339. Currently, multiline textInput uses `UITextView` but singleline textInput uses `UITextField`, so singleline textinput may crash when use `scrollEnabled` property.

[iOS] [Fixed] - Prevent crash when scrollEnabled used in singleline textinput
Pull Request resolved: https://github.com/facebook/react-native/pull/23361

Differential Revision: D14030586

Pulled By: cpojer

fbshipit-source-id: a8ae1b4e168469e65745c4d5e9329df8b6faa2aa
2019-02-11 14:52:59 -08:00
Emily Janzer b8246ac89a Make REACT_CLASS public so we can use a provider
Summary: Make REACT_CLASS a public property on ReactSwitchManager (similar to our other UI managers) so we can more easily lazily load this class.

Reviewed By: mdvacca

Differential Revision: D14028452

fbshipit-source-id: 84aebd4e2e1e0039957d8c12490022386aab7847
2019-02-11 14:45:42 -08:00
David Vacca f83281e2ce Disable OverlappingRendering for ReactTextView
Summary:
This diff disables OverlappingRendering for ReactTextView to avoid the exception:

```
java.lang.IllegalStateException: Unable to create layer for com.facebook.react.views.text.ReactTextView
```
during fade animations

OverlappingRendering enables an optimization during rendering of animations per component, disabling this might affect performance of animations inside TextView.

We will add a ReactFlag to experiment on how this affect other surfaces.

Reviewed By: blairvanderhoof

Differential Revision: D14027631

fbshipit-source-id: c1a84e7488c44582f7b7c78965aeb7bd27f82368
2019-02-11 14:39:18 -08:00
zhongwuzw cdd615136f Revert RCTRootView's backgroundColor to white (#23358)
Summary:
Fixes #23314 , the change came from #20945 , its purpose is to fix orientation change issue in HelloWord template, but I think it's just a trick, to make rootView's backgroundColor the same as window backgroundColor, the orientation issue seems related to [UIManager setAvailableSize:forRootView:](d2fc19f4aa/React/Modules/RCTUIManager.m (L343)) async layout things.

[iOS] [Fixed] - Revert RCTRootView's backgroundColor to white.
Pull Request resolved: https://github.com/facebook/react-native/pull/23358

Differential Revision: D14030666

Pulled By: cpojer

fbshipit-source-id: 7c9a45f03b87c3be0f2b7c64a3c837c6ae14af3e
2019-02-11 14:31:26 -08:00
Christoph Nakazawa ae11993d0f Add a Metro configuration with inline require/import
Summary:
We have been working on turning on inline-requires/imports and RAM bundles for React Native for a long time, however we have not made real progress on making it the default, even though it is easy. In this diff I am adding a Metro configuration to a new React Native template with the defaults set to `false` (off). This means that everyone creating a new project now or upgrading from an existing one will receive this template file. In a future release of React Native we will turn this setting on to default. From then on, new projects will be using inline-requires while existing ones that are upgrading can make an explicit choice when they are diffing their template and the latest version of it.

This approach was outlined in https://github.com/react-native-community/discussions-and-proposals/blob/master/core-meetings/2018-09-metro-meeting.md#actions-that-will-be-taken

Note: There is a weird lint-ignore thing in there like in the other template files. I'm working on getting rid of that separately.

Reviewed By: TheSavior

Differential Revision: D14030370

fbshipit-source-id: cf4c5551c795f2ea0fd1b731b352489f04b8c22e
2019-02-11 14:17:54 -08:00
Josh Justice 43b56ecb24 Separate RTL examples in RNTester (#23354)
Summary:
Splits RTLExample into separate exported examples, so they can be filtered. This will help with Detox tests.

Previously the single forceRTL toggle affected multiple examples because they all share state—although the box model examples at the end had their own toggles. Now each example has its own RTL toggle so it is always available even when examples are filtered, and so the examples don't have to share state. There is still the separate forceRTL toggle that changes the setting in `I18nManager`, which affects the default setting when the page appears, as well as the direction of the "with directional meaning" pointer icon.

[General] [Changed] - Split RTLExample into separate exported examples
Pull Request resolved: https://github.com/facebook/react-native/pull/23354

Differential Revision: D14030498

Pulled By: cpojer

fbshipit-source-id: 44eb493297f6a4832b55ef2b02a93dc5c213f337
2019-02-11 14:08:36 -08:00
Matt Oakes d9c0dfe353 Add a deprecation warning when importing NetInfo (#23383)
Summary:
Add a deprecation warning for the `NetInfo` module as part of #23313.

[General] [Deprecated] - Deprecated NetInfo as it has now been moved to react-native-community/netinfo
Pull Request resolved: https://github.com/facebook/react-native/pull/23383

Differential Revision: D14024702

Pulled By: cpojer

fbshipit-source-id: 353a9fb86feba2ca7f948c618c642e40fcdbfada
2019-02-11 13:45:47 -08:00
michalchudziak bf888a7582 Add deprecation warning while importing Slider component (#23385)
Summary:
Introducing the deprecation warning for those who are importing `Slider` component (https://github.com/facebook/react-native/issues/23313)

[General] [Deprecated] - Deprecated Slider as it has now been moved to `react-native-community/slider`
Pull Request resolved: https://github.com/facebook/react-native/pull/23385

Differential Revision: D14029819

Pulled By: cpojer

fbshipit-source-id: 7ad257124756c6bee57c3fbb1a056c09e8cc29a1
2019-02-11 13:40:52 -08:00
Krzysztof Borowy ffe37487b2 Deprecation warning for AsyncStorage (#23384)
Summary:
Added a deprecation warning for the `Async Storage`,  module as part of #23313.

[General] [Deprecated] - Async Storage [was moved to community repo](https://github.com/react-native-community/react-native-async-storage)
Pull Request resolved: https://github.com/facebook/react-native/pull/23384

Differential Revision: D14025255

Pulled By: cpojer

fbshipit-source-id: 5cabd76c650126ed77dfb8b714e05980c4d0b6da
2019-02-11 13:35:01 -08:00
Valentin Shergin 1a26f97eb0 Clang-format for all files in Fabric folder
Summary:
Trivial.
If you have troubles with rebasing on top of this revision, run this on your diff:
$ find */*.h */*.mm */*.cpp */*.m -exec clang-format -style=file -i {} \;

Reviewed By: JoshuaGross

Differential Revision: D14018903

fbshipit-source-id: fd0ce2da0e11954e683385402738c701045e727c
2019-02-11 13:07:09 -08:00
Valentin Shergin 64d6ea8b0d Moving ObjC specific clang-format rules to the common config
Summary: I found that clang-format config file allows to specify rules on a per-language basis, so I moved Objective-C specific rules to the unified config. Now we have only one clang-format file. Yay!

Reviewed By: JoshuaGross

Differential Revision: D14018902

fbshipit-source-id: 45c1e185b8f2b8151ea202b3d9a68a3886597198
2019-02-11 13:07:09 -08:00
Valentin Shergin bf58ba96f4 Fabric: Stop preallocation views on the main thread
Summary:
There is no reason to allocate views ahead of time on the main thread.

There is a chance that this view will not be mounted and we are not saving any time because it's a sequential process anyway (because we are doing it on the main thread). Moreover, the switching context can only slowdown JS execution.

Reviewed By: JoshuaGross

Differential Revision: D14019433

fbshipit-source-id: 83ac05a91e4b70cb382a55d6687752480984404e
2019-02-11 12:52:46 -08:00
gengjiawen 392e89676f add prettier check in ci (#23382)
Summary:
enforce code format
Pull Request resolved: https://github.com/facebook/react-native/pull/23382

Differential Revision: D14024609

Pulled By: cpojer

fbshipit-source-id: 21176cf8f009987e5a281bbead414374632eabee
2019-02-11 09:06:43 -08:00
Evan Bacon 62599fa8ff Add deprecation notice to ImageStore (#23330)
Summary:
- Related: #23313
- ImageStore is **iOS only**. AFAIK there is no reason this functionality isn't available on Android.
- base64 is very inefficient with the React Native bridge
- Ideally the `FileSystem` solutions will integrate Turbo Modules to circumvent bridge issues by passing direct references to files.

* [General][added] - A deprecation notice with info about third-party solutions for getting a base64-encoded string.
* [General][fixed] - Missing warnings for unimplemented platform methods.
Pull Request resolved: https://github.com/facebook/react-native/pull/23330

Differential Revision: D14022159

Pulled By: cpojer

fbshipit-source-id: 2a026ebf47cb315e9a0cfe6e3697a1799c5cbe2c
2019-02-11 01:24:03 -08:00
Dulmandakh d2fc19f4aa fix lint error/warnings (#23333)
Summary:
Fix lint errors and warning, which might be a cause of various crashes on older Android OS, using Android Support Library.

```bash
./gradlew :ReactAndroid:lint
```

[Android] [Changed] - fix lint error/warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/23333

Differential Revision: D14019322

Pulled By: mdvacca

fbshipit-source-id: 74c98da269c318cf3b114c8d9c876186369f2b8c
2019-02-09 22:30:55 -08:00
Dulmandakh 8ccc55fbd3 Prepare Groovy scripts for Kotlin DSL migration (#23355)
Summary:
Using Kotlin DSL in Gradle instead of Groovy will help detect problems early on using static typing, and it has advanced IDE support. This PR prepares Groovy script for Kotlin DSL migration per **Migrating build logic from Groovy to Kotlin** guide. Here is the excerpt:

>As a first migration step, it is recommended to prepare your Groovy build scripts by
> - unifying quotes using double quotes,
> - disambiguating function invocations and property assignments (using respectively parentheses and assignment operator).

See: https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin/

[Android] [Changed] - Prepare Gradle scripts for Kotlin DSL migration
Pull Request resolved: https://github.com/facebook/react-native/pull/23355

Differential Revision: D14018504

Pulled By: mdvacca

fbshipit-source-id: 909982c715b640f102cbe723df578c9af7bae08e
2019-02-09 10:18:07 -08:00
Dulmandakh c93cbdf1b2 Nonnull annotations for native modules (#23353)
Summary:
This adds Nonnull annotations for interfaces and classes used for native modules for Android, to improve Kotlin developer experience, but also code quality checks.

[Android] [Changed] - Nonnull annotations for native module interfaces
Pull Request resolved: https://github.com/facebook/react-native/pull/23353

Differential Revision: D14018181

Pulled By: mdvacca

fbshipit-source-id: 09a583860a6075e1d6f6df8f479369ae96497133
2019-02-09 02:40:52 -08:00
Kevin Gozali d9f34bdbb2 TM iOS: added helper to check whether a class is TurboModule compatible
Summary: Similar macro as the existing one, but this one checks for the class directly.

Reviewed By: RSNara

Differential Revision: D14016664

fbshipit-source-id: aae9a9c1cc95f56d2eff6c9021a714ed4a843db3
2019-02-08 21:08:51 -08:00
Valentin Shergin 21290b569b Fabric: Enable all Fabric tests for Android
Summary: All our C++ Fabric tests are cross-platform, so it makes sense to run them for all platforms (especially because platform may behaive differently).

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D13984574

fbshipit-source-id: e384c03c7f9839be38a1910e04ba2f7725abc378
2019-02-08 20:18:19 -08:00
David Vacca 6a71d51250 Trivial rename
Summary: Trivial rename

Reviewed By: fkgozali

Differential Revision: D14011984

fbshipit-source-id: dd2e7e0221bdad7b482c6a39b1cc877779c9704c
2019-02-08 18:55:35 -08:00
Valentin Shergin fd3b8f2000 Fabric: Introducing Better: For faster, clear and ideomatic codebase
Summary:
`Better` is a trivial collection of basic tools borrowed from other low-level general purpose libraries (like Folly, Abseil or Boost). The main goals of Better:
 - Make the codebase more portable;
 - Make the dependency list explicit (by decoupling it as a dependency list of Better);
 - Make relying on modern C++ patterns and tools in code simple and easy.
 - Make executing experiments with different dependencies easier.

 As a first example usage, this diff replaces std::unordered_map with an efficient one from folly on the one of the hottest paths.

Reviewed By: JoshuaGross

Differential Revision: D13944565

fbshipit-source-id: 5fa2c4abe6c17f7361eddcc25f968b6440d5d9db
2019-02-08 13:57:33 -08:00
Christoph Nakazawa 7ecf55fc9d Enforce rules-of-hooks via eslint
Summary:
allow-large-files

Enforce rules-of-hooks in React Native via the eslint-plugin-react-hooks plugin. See https://reactjs.org/docs/hooks-rules.html

Reviewed By: rickhanlonii

Differential Revision: D13998695

fbshipit-source-id: 48f1cde18c7112ce91d5087461875bcd0b50bf4f
2019-02-08 07:08:10 -08:00
Christoph Nakazawa ccefc700d0 React sync for revisions 6bf5e85...aa94237 (#23320)
Summary:
allow-large-files

This sync includes the following changes:
- **[45fc46bfa](https://github.com/facebook/react/commit/45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>//
- **[f2e2637c8](https://github.com/facebook/react/commit/f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (#14770) //<Brian Vaughn>//
- **[1107b9673](https://github.com/facebook/react/commit/1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (#14768) //<Sunil Pai>//
- **[0975ea327](https://github.com/facebook/react/commit/0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>//
- **[bc9818f24](https://github.com/facebook/react/commit/bc9818f24 )**: Scheduler.unstable_next (#14756) //<Andrew Clark>//
- **[ce6ecd3fb](https://github.com/facebook/react/commit/ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (#14692) //<Dan Abramov>//
- **[008a2ab9c](https://github.com/facebook/react/commit/008a2ab9c )**: 16.8.0 //<Brian Vaughn>//
- **[d1326f466](https://github.com/facebook/react/commit/d1326f466 )**: [TestUtils.act] fix return result checking  (#14758) //<Sunil Pai>//
- **[267ed9814](https://github.com/facebook/react/commit/267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (#14744) //<Sunil Pai>//
- **[fb3f7bfde](https://github.com/facebook/react/commit/fb3f7bfde )**: Avoid importing Scheduler directly (#14757) //<Andrew Clark>//
- **[e602b5291](https://github.com/facebook/react/commit/e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (#14752) //<Jessica Franco>//
- **[e489c3f9c](https://github.com/facebook/react/commit/e489c3f9c )**: Update the version with Hooks proposal in README (#14751) //<SToneX>//
- **[c21c41ecf](https://github.com/facebook/react/commit/c21c41ecf )**: Tweak invalid Hook warning and error (#14747) //<Dan Abramov>//
- **[fec00a869](https://github.com/facebook/react/commit/fec00a869 )**: Typo in comment (#14739) //<Deniz Susman>//
- **[66eb29374](https://github.com/facebook/react/commit/66eb29374 )**: Restrict effect return type to a function or nothing (#14119) //<Andrew Clark>//
- **[51c07912a](https://github.com/facebook/react/commit/51c07912a )**: Warn when second argument is passed to useCallback (#14729) //<Dan Abramov>//
- **[70d407583](https://github.com/facebook/react/commit/70d407583 )**: Move Hook mismatch warning to first mismatch site (#14720) //<Andrew Clark>//
- **[ba6477aa3](https://github.com/facebook/react/commit/ba6477aa3 )**: Improve Reducer Hook's lazy init API (#14723) //<Andrew Clark>//
- **[cb1ff430e](https://github.com/facebook/react/commit/cb1ff430e )**: Phased dispatcher (#14701) //<Andrew Clark>//
- **[9d483dcfd](https://github.com/facebook/react/commit/9d483dcfd )**: Spelling abitrarily -> arbitrarily (#14710) //<Peter Donald>//
- **[e19c9e106](https://github.com/facebook/react/commit/e19c9e106 )**: Fix issue with multiple code branches in hooks linter (#14661) //<Yurick>//
- **[f11a9c1cb](https://github.com/facebook/react/commit/f11a9c1cb )**: State update bug in concurrent mode (#14698) //<Brian Vaughn>//
- **[e679a4b6e](https://github.com/facebook/react/commit/e679a4b6e )**: Fix typo in code comment (#14696) //<Greg Hurrell>//
- **[8bcc88f2e](https://github.com/facebook/react/commit/8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (#14677) //<Dan Abramov>//
- **[6cb26774e](https://github.com/facebook/react/commit/6cb26774e )**: Enable hooks! (#14679) //<Brian Vaughn>//
- **[73962c366](https://github.com/facebook/react/commit/73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652)" (#14654) //<Dan Abramov>//
- **[994439228](https://github.com/facebook/react/commit/994439228 )**: Put DEV-only code into DEV blocks (#14673) //<Dan Abramov>//
- **[f0befae65](https://github.com/facebook/react/commit/f0befae65 )**: Tweak context invariant message (#14671) //<Dan Abramov>//
- **[a129259ad](https://github.com/facebook/react/commit/a129259ad )**: Disallow reading context during useMemo etc (#14653) //<Dan Abramov>//
- **[c068d31cc](https://github.com/facebook/react/commit/c068d31cc )**: Add unit tests for concurrent mode event dispatching (#14415) //<Sebastian Markbåge>//
- **[38247cba3](https://github.com/facebook/react/commit/38247cba3 )**: --save is no longer needed (#14302) //<SamCortopassi>//
- **[3f0bcaf0d](https://github.com/facebook/react/commit/3f0bcaf0d )**: Importing React for the first example. (#14346) //<Ramón Chancay Ortega>//
- **[ecd919a2f](https://github.com/facebook/react/commit/ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (#14585) //<Sunil Pai>//
- **[3fbebb2a0](https://github.com/facebook/react/commit/3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652) //<Dan Abramov>//
- **[5fce6488c](https://github.com/facebook/react/commit/5fce6488c )**: Revert "Disallow reading context during useMemo etc" (#14651) //<Dan Abramov>//
- **[fe2ecd276](https://github.com/facebook/react/commit/fe2ecd276 )**: Add test coverage for readContext() on the server (#14649) //<Dan Abramov>//
- **[8f45a7fdc](https://github.com/facebook/react/commit/8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (#14647) //<Dan Abramov>//
- **[1fcbd2243](https://github.com/facebook/react/commit/1fcbd2243 )**: Disallow reading context during useMemo etc (#14648) //<Dan Abramov>//
- **[2a084f51a](https://github.com/facebook/react/commit/2a084f51a )**: Warn about refs on lazy function components (#14645) //<Dan Abramov>//
- **[b5a3df6e8](https://github.com/facebook/react/commit/b5a3df6e8 )**: Fix typo (#14560) //<Linchengyi>//
- **[9c146e675](https://github.com/facebook/react/commit/9c146e675 )**: fix typo (#14316) //<liunian>//
- **[baa6d40fc](https://github.com/facebook/react/commit/baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (#14644) //<Dan Abramov>//
- **[a1414e894](https://github.com/facebook/react/commit/a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (#14643) //<Dan Abramov>//
- **[10a7a5b5c](https://github.com/facebook/react/commit/10a7a5b5c )**: Fix synchronous thenable rejection (#14633) //<Dan Abramov>//
- **[a2fa6eb98](https://github.com/facebook/react/commit/a2fa6eb98 )**: Move lazy._result assignment (#14632) //<Dan Abramov>//
- **[9120f6c2d](https://github.com/facebook/react/commit/9120f6c2d )**: Support sync thenables for lazy() (#14626) //<Dan Abramov>//
- **[b66e6e41e](https://github.com/facebook/react/commit/b66e6e41e )**: Add directory details to the package.json of all packages (#14628) //<Grey Baker>//
- **[177fb7635](https://github.com/facebook/react/commit/177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (#14625) //<Dan Abramov>//
- **[d17d0b99c](https://github.com/facebook/react/commit/d17d0b99c )**: Use public context.report interface in eslint rules (#14623) //<Sebastian Silbermann>//
- **[4f332885a](https://github.com/facebook/react/commit/4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (#14613) //<Yi-Shan, Chen>//
- **[e1cd83e49](https://github.com/facebook/react/commit/e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (#14608) //<Sunil Pai>//
- **[be457ca68](https://github.com/facebook/react/commit/be457ca68 )**: Small tweaks to SSR to match #14594 (#14618) //<Dan Abramov>//
- **[17d70df91](https://github.com/facebook/react/commit/17d70df91 )**: Warn when mixing createRoot() and old APIs (#14615) //<Dan Abramov>//
- **[4feab7fc9](https://github.com/facebook/react/commit/4feab7fc9 )**: Add hooks support to ReactShallowRenderer (#14567) //<Dominic Gannaway>//
- **[1454a8be0](https://github.com/facebook/react/commit/1454a8be0 )**: Don't bother comparing constructor when deps are not provided (#14594) //<Andrew Clark>//
- **[71b64d521](https://github.com/facebook/react/commit/71b64d521 )**: Warn if number of hooks increases (#14591) //<Andrew Clark>//
- **[790c8ef04](https://github.com/facebook/react/commit/790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (#14569) //<Andrew Clark>//
- **[7ab8a8e97](https://github.com/facebook/react/commit/7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (#14599) //<Brian Vaughn>//
- **[4392e3821](https://github.com/facebook/react/commit/4392e3821 )**: useDebugValue should throw if used in a class component (#14601) //<Brian Vaughn>//
- **[153a0b598](https://github.com/facebook/react/commit/153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (#14597) //<Brian Vaughn>//
- **[7ad9806d1](https://github.com/facebook/react/commit/7ad9806d1 )**: Tweak to avoid property read (#14593) //<Brandon Dail>//
- **[0fc154751](https://github.com/facebook/react/commit/0fc154751 )**: Avoid new Set([iterable]) for thenables (#14592) //<Brandon Dail>//
- **[edb1f5956](https://github.com/facebook/react/commit/edb1f5956 )**: Support configurable labels for custom hooks (#14559) //<Brian Vaughn>//
- **[3e15b1c69](https://github.com/facebook/react/commit/3e15b1c69 )**: make a fork for ReactCurrentDispatcher (#14588) //<Sunil Pai>//
- **[0005d1e3f](https://github.com/facebook/react/commit/0005d1e3f )**: Fix typo (#14576) //<Carl Mungazi>//
- **[f290138d3](https://github.com/facebook/react/commit/f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (#14556) //<Brian Vaughn>//
- **[b4ad8e947](https://github.com/facebook/react/commit/b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (#14565) //<Sunil Pai>//
- **[ab03e3d65](https://github.com/facebook/react/commit/ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (#14550) //<Brian Vaughn>//
- **[19ef0ec11](https://github.com/facebook/react/commit/19ef0ec11 )**: Separate current owner and dispatcher (#14548) //<Brian Vaughn>//
- **[a9b035b0c](https://github.com/facebook/react/commit/a9b035b0c )**: Separate Object.is polyfill (#14334) //<Maksim Markelov>//
- **[547e059f0](https://github.com/facebook/react/commit/547e059f0 )**: Simplify wording of key warning (#14503) //<Sophie Alpert>//
- **[3494ee57e](https://github.com/facebook/react/commit/3494ee57e )**: Update ReactUpdateQueue.js (#14521) //<Carl Mungazi>//
- **[659c13963](https://github.com/facebook/react/commit/659c13963 )**: Update ReactFiberScheduler.js (#14477) //<Carl Mungazi>//
- **[c695b2384](https://github.com/facebook/react/commit/c695b2384 )**: React v16.7.0 //<Andrew Clark>//
- **[1c5aa2f23](https://github.com/facebook/react/commit/1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>//
- **[653bc582f](https://github.com/facebook/react/commit/653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (#14455) //<Andrew Clark>//
- **[8bfef0da5](https://github.com/facebook/react/commit/8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>//
- **[4a1072194](https://github.com/facebook/react/commit/4a1072194 )**: Memoize promise listeners to prevent exponential growth (#14429) //<Andrew Clark>//
- **[535804f5c](https://github.com/facebook/react/commit/535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (#14437) //<Brian Vaughn>//
- **[2743fb7b2](https://github.com/facebook/react/commit/2743fb7b2 )**: Enable hooks by default for FB React Native renderer (#14435) //<Brian Vaughn>//
- **[7325ebe4d](https://github.com/facebook/react/commit/7325ebe4d )**: Inject overrideProps() fn to DevTools (#14427) //<Brian Vaughn>//
- **[a22880e5e](https://github.com/facebook/react/commit/a22880e5e )**: Add support for Suspense & lazy() to the react-is package (#14423) //<Pleun Vanderbauwhede>//
- **[947bddd5c](https://github.com/facebook/react/commit/947bddd5c )**: Remove redundant argument of getPlugins function (#14419) //<Heaven>//
- **[8df4d59be](https://github.com/facebook/react/commit/8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (#14053) //<Kevin Chavez>//
- **[5bb4ad737](https://github.com/facebook/react/commit/5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (#14401) //<Brian Vaughn>//
- **[98eb5ae53](https://github.com/facebook/react/commit/98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (#14392) //<Brian Vaughn>//
- **[39489e767](https://github.com/facebook/react/commit/39489e767 )**: Enable hooks in fabric (#14301) //<Spencer Ahrens>//
- **[1dc108e58](https://github.com/facebook/react/commit/1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>//

Release Notes:
[GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1)

Pull Request resolved: https://github.com/facebook/react-native/pull/23320

Reviewed By: rickhanlonii

Differential Revision: D13976467

fbshipit-source-id: 4ce198e86a54658e1c35aa36bffe4a7dc2956a2e
2019-02-08 07:08:10 -08:00
Dulmandakh b640b6faf7 nullable annotations to ReadableMap, WritableMap, ReadableArray, Writable. (#23329)
Summary:
Kotlin is getting traction and more developers write RN native modules in it. This PR adds nullable annotations to help with Kotlin null inference and improve developer experience. Also it'll help checking code quality using lint.

I skimmed through JavaOnlyMap.java, JavaOnlyArray.java, ReadableNativeArray.java, ReadableNativeMap.java, WritableNativeArray.java and WritableNativeMap.java to infer nullability.

This is breaking change to Kotlin code.

[Android] [Changed] - Add nullable annotations to ReadableMap, WritableMap, ReadableArray, Writable.
Pull Request resolved: https://github.com/facebook/react-native/pull/23329

Differential Revision: D14002571

Pulled By: cpojer

fbshipit-source-id: 899d8b3b0a5dad43e8300e6c4ea4208cca0f01a9
2019-02-08 04:16:24 -08:00
Héctor Ramos d002d30325 Danger, be nice to PRs. (#23334)
Summary:
Changed Danger's config so that it provides advice whenever it finds an issue with the pull request template, instead of posting a warning.

Updated Danger several major versions, from 2 to 7. I worked through any breaking changes, which were minimal (change `yarn danger` to `yarn danger ci`).

Added a flag to have Danger post these messages as GitHub Checks instead of as a comment. This slightly buries Danger's output, as it's no longer posted as a comment, but I believe it integrates more nicely into the GitHub interface.

[GENERAL] [Changed] - GitHub-only change: updated Danger config to be nicer to PRs
Pull Request resolved: https://github.com/facebook/react-native/pull/23334

Differential Revision: D14002313

Pulled By: cpojer

fbshipit-source-id: b97ca7b7bd164646b249b7c64b1134306e0f38a8
2019-02-08 03:36:58 -08:00