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

18198 Коммитов

Автор SHA1 Сообщение Дата
Emily Janzer ad9b07d390 Throw a different exception when no ViewManager is found
Summary: Adding a second exception with a different error message so we can tell how the ViewManagerRegistry was created when it fails to find a view manager.

Reviewed By: rickhanlonii, JoshuaGross

Differential Revision: D17759060

fbshipit-source-id: 4415fa7440395f7e5730d2b77088f16a1a6a819d
2019-10-04 15:03:28 -07:00
Emily Janzer c3a07b6dcc Use volatile for sDidInit in ReactBridge
Summary: In D17747958 I added a function to check the value of a static variable, but forgot to make sure it was accessed in a thread-safe manner. Adding `volatile` to the flag

Reviewed By: makovkastar

Differential Revision: D17763888

fbshipit-source-id: f227b69de1a0df6493424da3b276529555999f70
2019-10-04 11:00:08 -07:00
Rachel Nabors cf7759e6e0 Linking to the ReactJS code of conduct. (#26725)
Summary:
## Overview

Recently, React Native switched over to a new code of conduct based on the contributors' covenant [here](https://github.com/facebook/react-native/blob/master/CODE_OF_CONDUCT.md). This PR updates CONTRIBUTING.md to link to this updated CoC.
Pull Request resolved: https://github.com/facebook/react-native/pull/26725

Differential Revision: D17765083

Pulled By: rickhanlonii

fbshipit-source-id: f7d085f078e1c7d99f6358554381582536a4ae1f
2019-10-04 10:57:00 -07:00
Samuel Susla 07fd3125c8 Migrate MVP SafeAreaView to Fabric
Reviewed By: shergin

Differential Revision: D17736209

fbshipit-source-id: e70c309f2599cdcb8f234d96915546032b71d223
2019-10-04 07:07:36 -07:00
masaaki1915 ae3f7a7616 fix typo in code (#26655)
Summary:
This PR only fixes a typo in `ShadowNode.cpp`

## Changelog

[Internal] [Fixed] - Fix typo in `ShadowNode.cpp`
Pull Request resolved: https://github.com/facebook/react-native/pull/26655

Differential Revision: D17743059

Pulled By: TheSavior

fbshipit-source-id: 6bbaf54b712c0a80da8dfafea2634309279a8f21
2019-10-03 23:12:37 -07:00
Emily Janzer 7d8b7ff3aa Don't call ReactBridge.staticInit() on the main thread
Summary: Adding a hook to check if ReactBridge is initialized so we can avoid loading the .so on the main thread.

Reviewed By: fkgozali

Differential Revision: D17747958

fbshipit-source-id: 5969afa57dc1b446c03bc68eaa9e1385fe17c461
2019-10-03 16:21:28 -07:00
Adam Ernst a45e6a8b5f React Native supermodule
Summary: #nocancel

Reviewed By: fkgozali

Differential Revision: D17747685

fbshipit-source-id: 9bad072d3549959528612c2f0329799853d4b675
2019-10-03 15:43:38 -07:00
Alexander Kawrykow 42152a3fa3 Support removeClippedSubviews for horizontal ScrollViews
Summary:
Currently, horizontal `ScrollViews` don't properly support `removeClippedSubviews`.

This is because the container view, `ReactHorizontalScrollContainerView` extends from regular `ViewGroup` instead of `ReactViewGroup` so doesn't have all the logic around clipping children.

Moreover, the `ReactHorizontalScrollContainerViewManager` doesn't actually support the `removeClippedSubviews` prop

This change:
- Makes  `ReactHorizontalScrollContainerView` extend from `ReactViewGroup` while maintaining the special logic around RTL scrolling
- Factors out a common `ReactClippingViewManager` which will be used to bridge all components which extend `ReactViewGroup` and support clipping. It has the logic for adding/removing children and getting child counts while considering clipped subviews
- `ReactViewManager` now extends this new `ReactClippingViewManager`
- `ReactHorizontalScrollContainerViewManager` also extends `ReactClippingViewManager`

Reviewed By: JoshuaGross

Differential Revision: D17708630

fbshipit-source-id: d257566ee54ad46f6d62f176a657c596bba96aa4
2019-10-03 15:37:13 -07:00
Eli White 21f1cce148 Remove unused code
Summary:
There are some unused imports and variables. This was flagged by running
```
$ js1 lint --only "no-unused-vars: [1, {vars: 'all', args: 'none', ignoreRestSiblings: true}]" ~/fbsource/xplat/js/react-native-github --only "react/jsx-uses-vars" --only "react/jsx-uses-react" --fast
```

Changelog:
Internal

Reviewed By: zackargyle, JoshuaGross

Differential Revision: D17724836

fbshipit-source-id: 2b6a44f55c878d659c9c23f5878ba34f21f8bb69
2019-10-03 14:33:59 -07:00
Ramanpreet Nara d7864d20d5 Mark plugin function definitions used
Summary: We need to mark the OSS plugin functions with `__attribute__((used))`, so that the compiler doesn't strip them out.

Reviewed By: fkgozali

Differential Revision: D17742818

fbshipit-source-id: df8055286cace850cea21bb6f09eb5ee6b587c0e
2019-10-03 13:06:06 -07:00
luancurti d66931987a Fix platform ios get version type (#26639)
Summary:
Fix flow type platform ios get version

## Changelog

[INTERNAL] [FIXED] - Fix flow type platform ios get version

## Test Plan
Pull Request resolved: https://github.com/facebook/react-native/pull/26639

Differential Revision: D17743074

Pulled By: TheSavior

fbshipit-source-id: de97c612dbf615a8ede1905cb158f258c9ce5737
2019-10-03 12:29:47 -07:00
Samuel Susla e62a4c7988 Apply props to Paper component
Reviewed By: shergin

Differential Revision: D17710855

fbshipit-source-id: ab6864a22fd8df019b2619c2976876e176e07689
2019-10-03 08:37:29 -07:00
Samuel Susla 3f8221ddd9 Add coordinator class
Summary:
ComponentDescriptor owns a coordinator which is initialised with ViewManager that it represents.

Coordinator is passed to ComponentView through state and ComponentView asks the coordinator for view.

Later, ComponentView will ask coordinator to configure view with specified props.

Reviewed By: shergin

Differential Revision: D17670444

fbshipit-source-id: e920c5c4f033884c4b539ce711286f71c887d896
2019-10-03 08:37:29 -07:00
Samuel Susla 74608ee4ab Stage 1: printing props to screen
Summary:
# LegacyViewManagerInterop is born

LegacyViewManagerInterop is a component that should make it possible for legacy components to work in Fabric, new renderer.
This is just a first stage that prints keys of props to screen together with component name.

Reviewed By: shergin

Differential Revision: D17552827

fbshipit-source-id: c3e062f413727729e6a9b683c60f59f0292cc63b
2019-10-03 08:37:28 -07:00
Samuel Susla a261e6dfb2 Fix recycling of Switch
Reviewed By: shergin

Differential Revision: D17714863

fbshipit-source-id: 8a90a08328f007c782689b4e711d252bd2e22538
2019-10-03 03:59:47 -07:00
Samuel Susla eb08b428b6 Add setValue command to RCTSwitchManager
Reviewed By: shergin

Differential Revision: D17714133

fbshipit-source-id: ccb89be1b763678f44f1271e4d5882afd37ccf65
2019-10-03 03:59:47 -07:00
Oleksandr Melnykov bdb4278523 Fix Switch measurement on Android
Summary:
Fabric expects the measure method to return the size in density-independent pixels, but getMeasuredWidth and getMeasuredHeight return pixels on Android, so we have to convert these values before returning to C++.

Check the method createUpdateLayoutMountItem in Binding.cpp:

```
local_ref<JMountItem::javaobject> createUpdateLayoutMountItem(
    const jni::global_ref<jobject> &javaUIManager,
    const ShadowViewMutation &mutation) {
     ...

    int x = round(frame.origin.x * pointScaleFactor);
    int y = round(frame.origin.y * pointScaleFactor);
    int w = round(frame.size.width * pointScaleFactor);
    int h = round(frame.size.height * pointScaleFactor);
    auto layoutDirection = toInt(newChildShadowView.layoutMetrics.layoutDirection);
    return updateLayoutInstruction(
        javaUIManager, newChildShadowView.tag, x, y, w, h, layoutDirection);
  }

  return nullptr;
}
```

We are interested in the next two lines:
```
int w = round(frame.size.width * pointScaleFactor);
int h = round(frame.size.height * pointScaleFactor);
```

`frame.size.width` and `frame.size.height` are the values returned from the measure method in Java and they are multiplied by the screen density to get the size in pixels, which means Fabric expects these values to be DIPs.

Reviewed By: shergin

Differential Revision: D17626834

fbshipit-source-id: f9856b5d0796c75c26c84adf11e1652b22a1ddef
2019-10-03 03:15:21 -07:00
Oleksandr Melnykov 299c984964 Pass surface ID to measure function in Java to retrieve themed Context
Summary:
We use `ViewManager.onMeasure` to perform measurements of Android views and pass the measured size back to Yoga. For Android in order to the report correct dimensions of a View, this View must be created using a Context that has a theme associated with it. Before, `onMeasure` only had ReactApplicationContext passed as the first parameter and ReactSwitch, for example, could not be measured correctly (because it uses the size of the thumb drawable, which is extracted from the current theme). This diff adds surfaceId as the first parameter of `FabricUIManager.measure`, so that we can retrieve ThemedReactContext and pass it to `ViewManager.onMeasure`.

The size of the Switch component is still incorrect, but at least the size reported back to Yoga is the same as in Paper. So there is more investigation necessary why this happens in Fabric. I will investigate and publish another diff with the fix.

Reviewed By: JoshuaGross, shergin

Differential Revision: D17625959

fbshipit-source-id: 48197a61240fb13042bef3e9f5d681acacc702fb
2019-10-03 03:15:20 -07:00
Oleksandr Melnykov d0dd1aed29 Integrate AndroidSwitch into Fabric on Android
Summary:
In this diff we integrate the Switch component on Android in Fabric. Since the component has a custom measure function, we need to write some C++ to call the measure method in Java.

The component isn't fully functional yet (setNativeProps isn't supported in Fabric) and has some problems with measuring itself. I will fix the component in the next diffs in this stack.

Reviewed By: JoshuaGross

Differential Revision: D17571258

fbshipit-source-id: be4e201495b9b197ddec44ee3484357bfb6225a8
2019-10-03 03:15:20 -07:00
Frieder Bluemle 6aae8e0756 Update Android Gradle plugin to 3.5.1 (#26694)
Summary:
Android Studio 3.5.1 is now available in the stable channel

https://androidstudio.googleblog.com/2019/10/android-studio-351-available.html

## Changelog

[Android] [Changed] - Update Android Gradle plugin to 3.5.1
Pull Request resolved: https://github.com/facebook/react-native/pull/26694

Test Plan: Build project

Differential Revision: D17729849

Pulled By: cpojer

fbshipit-source-id: 0a0ba7a38ff5be096b56a6470c3ea4912a053d94
2019-10-02 17:44:29 -07:00
Mehdi Mulani 12d60c1049 iOS: Allow redbox to be toggled in debug builds
Summary: This adds the option to enable or disable the redbox.

Reviewed By: JoshuaGross

Differential Revision: D17720770

fbshipit-source-id: b9e9c948d53f7f284a48b6bd182dc2da47874d1c
2019-10-02 14:43:32 -07:00
Mehdi Mulani 7da85ef4cc iOS: Change RCTLog red box behaviour to a runtime check
Summary:
This changes RCTLog to look for RCTRedBox at runtime and if so, send a log message to it.
This allows people to add their own redbox customizations that could be present at non-debug time.

Reviewed By: PeteTheHeat

Differential Revision: D17718913

fbshipit-source-id: e4545e112af2ff2ad197a0a82551ae4c6911ece9
2019-10-02 14:43:32 -07:00
Luna Wei ea1e8bbd34 Add queryCache to ImageLoader native module
Summary:
[iOS] [Added] - Add definition for `queryCache` in ImageLoader

This diff is related to moving RCTImageViewManager's commands to a native module, ImageLoader.

Reviewed By: zackargyle, TheSavior

Differential Revision: D17714521

fbshipit-source-id: 722cc17a2ebb03e72d7c080dfc4d0aa6d7440e85
2019-10-02 14:05:12 -07:00
Luna Wei 40667a8147 Add prefetchImage to ImageLoader native module
Summary:
[iOS] [Added] - Add `prefetchImage` to ImageLoader native module.

This diff is related to moving RCTImageViewManager's commands to a native module, ImageLoader.

Reviewed By: zackargyle, TheSavior

Differential Revision: D17714519

fbshipit-source-id: 0a50f640cf0c5668a11dd5d40553c257ebbd9d2b
2019-10-02 14:05:12 -07:00
Luna Wei db20260b03 Add getSizeWithHeaders to ImageLoader turbomodule
Summary:
Define getSizeWithHeaders in ImageLoader native module.

This diff is related to moving RCTImageViewManager's commands to a native module, ImageLoader.
See it's usage here: D17704091

Reviewed By: TheSavior

Differential Revision: D17693907

fbshipit-source-id: 3c2d7b19ac68ead831e780c4ee23e3ed0643be3a
2019-10-02 14:05:12 -07:00
Emily Janzer 7a6478465d Throw pending JNI errors after Java method discovery in TM
Summary: I was trying to debug an issue with a method signature mismatch last week, but was having trouble figuring out the problem because the error I was getting was unrelated - apparently JNI will sometimes swallow the error and just fail mysteriously later on. Ramanpreet showed me this macro that will throw any pending exceptions, so let's do that after we try to lookup the Java method in case it fails.

Reviewed By: RSNara

Differential Revision: D17680121

fbshipit-source-id: 1f23e49014f7cc1616e111386d440637e6a74677
2019-10-02 12:03:13 -07:00
Eli White da8ae011bb Fix exception in scrollResponderScrollNativeHandleToKeyboard when ref is null
Summary:
We are seeing these errors in prod:

```
TypeError: Cannot read property '_nativeTag' of null

at
ReactNativeFiberHostComponent.prototype.measureLayout(ReactNativeRenderer-prod.fb.js:1594)
ScrollResponderMixin.scrollResponderScrollNativeHandleToKeyboard(ScrollResponder.js:557)
```

This error is coming from these lines: 69c38e5a63/Libraries/Components/ScrollResponder.js (L563-L567)

Either `nodeHandle` is null or `this.getInnerViewRef()`. If `nodeHandle` was null, we'd get an error that we can't call `measureLayout` on null. So `this.getInnerViewRef()` must be null.

In the React Native Renderer this error of `_nativeTag of null` is coming from this line: db8afe4f63/packages/react-native-renderer/src/ReactNativeFiberHostComponent.js (L84)

Which means indeed `this.getInnerViewRef()` is null.

So adding a null check here which is what we do at all the other product callsites of `measureLayout`. Flow should have caught this, but because ScrollView is one of the only components left using mixins (ScrollResponder), `this.getInnerViewRef` is typed as `any` instead of what it should be:

```
?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>
```

If `scrollResponder` was typed correctly then Flow would have caught this.

Changelog:
[Fixed] Exception in scrollResponderScrollNativeHandleToKeyboard when ref is null

Reviewed By: mmmulani

Differential Revision: D17717150

fbshipit-source-id: d7bc4c897ad259fb588e8100f37ccfb8a5d07874
2019-10-02 11:28:50 -07:00
Ramanpreet Nara de20eb7e11 Refactor RCTActionSheetManager to use RCTConvertVecToArray and RCTConvertOptionalVecToArray
Summary: Previously, I introduced methods to convert `facebook::react::LazyVector<T>` to `NSArray*`, but I realized that there are already methods available in `RCTConvertHelpers` that do this for us. So, I'm switching over to using those methods instead.

Reviewed By: fkgozali

Differential Revision: D17716914

fbshipit-source-id: e1ef7636e36b594bc558d7025573082bd2bccab9
2019-10-02 11:06:40 -07:00
Ramanpreet Nara 48653a2a63 Make RCTBridgingToOptionalVec understand kCFNull
Summary:
When converting an array into a Vec, we should also check whether the array pointer is `kCFNull`.

In TurboModules, when an object's property is mapped to null, we simply do not insert that property into the corresponding `NSDictionary`. This causes the `NSDictionary` lookup to return `nil`. In the legacy infra, it looks like we may insert `kCFNull` into the `NSDictionary`, which will cause the lookup to return `kCFNull`.

Reviewed By: fkgozali

Differential Revision: D17716785

fbshipit-source-id: 62ffbe14aec7040edd6b3ce687769a285b14b5a1
2019-10-02 11:01:59 -07:00
Elisa Lou 8dcb6ee91f android: update dark mode minimum (#26623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/26623

I noticed the min version was 10. It is actually 9 if we consider users with developer option turned on.

Changelog:
[Android][Fixed] - Updated Appearance module to allow Android 9/P devices.

Differential Revision: D17632656

fbshipit-source-id: 893699ae37ab1cef64fe2547e0f2d6858bf3c48c
2019-10-01 13:33:39 -07:00
Gunnar Kudrjavets b53d3d80f9 Fix free page calculations on iOS
Summary:
[iOS] [Fixed] - Fix how the amount of free memory is calculated to mimic the logic Apple uses.

For example, see https://opensource.apple.com/source/system_cmds/system_cmds-805.250.2/vm_stat.tproj/vm_stat.c.auto.html for how `vm_stat` does it:

```
sspstat("Pages free:", (uint64_t) (vm_stat.free_count - vm_stat.speculative_count));
```

Reviewed By: shergin

Differential Revision: D17671714

fbshipit-source-id: 18ef31e17a0527a9bef7a408922cd687260866db
2019-10-01 12:06:44 -07:00
Oleksandr Melnykov 769d51824e Fix setting component padding in Fabric
Summary: This diff fixes the issue with view paddings in Fabric introduced in D17081799. In Paper setting padding on a view was only supported for Text and TextInput components (see https://fburl.com/codesearch/6r6lu5vd). We want to keep Fabric backwards compatible, so we delegate setting the padding to the view manager instead of setting it directly on the view. In this way we can have a no-op implementation in the base view manager and implement this method only in view managers that support setting padding (ReactTextInputManager and ReactTextViewManager at the moment).

Reviewed By: JoshuaGross

Differential Revision: D17665011

fbshipit-source-id: 38bc56278e002bd34881cfcb9ed79df579f79e28
2019-10-01 11:38:21 -07:00
Ramanpreet Nara 601981a67d Make CameraRoll NativeModules TurboModule-compatible
Summary:
Aside from RCTCameraRollManager, this diff makes the following NativeModules TurboModule-compatible:
- RCTAssetsLibraryRequestHandler
- RCTImagePickerManager
- RCTPhotoLibraryImageLoader

I couldn't convert CameraRollManager to a TurboModule because its NativeMoudle spec is located in fb-internal code. We should probably just move all these NativeModules outside of react-native-github. See: T54882565.

Reviewed By: PeteTheHeat

Differential Revision: D17678033

fbshipit-source-id: 4d10b7b1ad4e167bb9e46ff2bfd1559a5092e201
2019-10-01 11:15:09 -07:00
Ramanpreet Nara 3908702de9 Make RCTFileReaderModule and RCTBlobManager TurboModule-compatible
Summary: Make RCTFileReaderModule and RCTBlobModule TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D17583286

fbshipit-source-id: 4cab350aadce00c03a6c631a6b57e86f35484d2f
2019-10-01 11:15:09 -07:00
Ramanpreet Nara bf063f425f Make RCTSettingsManager TurboModule-compatible
Summary: Make RCTSettingsManager TurboModule-compatible.

Reviewed By: PeteTheHeat

Differential Revision: D17581374

fbshipit-source-id: 22ec6237ea8b504ff826d0fe7b3db2fabfee9f80
2019-10-01 11:15:08 -07:00
Ramanpreet Nara 789e9fbff0 Make RCTVibration TurboModule-compatible
Summary: Making RCTVibration TurboModule-compatible.

Reviewed By: PeteTheHeat

Differential Revision: D17581373

fbshipit-source-id: a7aa2d12e7251d332c855435c2f0d83d87f0d2ac
2019-10-01 11:15:08 -07:00
Ramanpreet Nara 1d7de28379 Make update-plugins.js script support multiple libraries
Summary:
Some NativeModules belong to their own buck target (separate from `ReactInternal`). We shouldn't move those NativeModules to `CoreModuels`, because that would unnecessarily bloat `CoreModules`.

In this diff, I extended the `update-plugins.js` script to also generate plugin stubs for those additional targets. This way, we can convert those NativeModules to TurboModules without moving them to CoreModules.

Now, in `update-plugins.js`, we have this array:

```
const libraries = [
  {
    name: 'CoreModules',
    outputFiles: {
      ios: ['CoreModulesPlugins.h', 'CoreModulesPlugins.mm'],
      android: [],
    },
    outputPath: {
      ios: `${GITHUB_DIR}/React/CoreModules`,
      android: '',
    },
  },
];
```

To codegen another pair of plugin files for another target, simply insert to this array.

**Note:** We'll have to modify RNTesterTurboModuleProvider, but I can take care of that when I setup RNTester for TurboModules.

Reviewed By: fkgozali

Differential Revision: D17671288

fbshipit-source-id: 412d2e730682f82740241506f241dcfb4d302e99
2019-10-01 11:15:08 -07:00
Oleksandr Melnykov b21a941923 Fix order of method execution in Fabric ViewManager
Summary:
Because of the changes made in Fabric, the order of the execution of some methods in ViewManager has changed. In Paper the following order was guaranteed: `createViewInstance -> addEventEmitters -> updateProperties -> onAfterUpdateTransaction`. But in Fabric, the order is the following: `createViewInstance -> updateProperties -> onAfterUpdateTransaction -> addEventEmitters`. This change can actually break some existing view managers, because they rely on the fact that `addEventEmitters` will be called before `onAfterUpdateTransaction`. Check ReactVideoManager:

```
ReactModule(name = ReactVideoManager.REACT_CLASS)
public class ReactVideoManager extends SimpleViewManager<ReactVideoPlayer>
    implements VideoManagerInterface<ReactVideoPlayer> {
...

  Override
  protected void onAfterUpdateTransaction(ReactVideoPlayer view) {
    super.onAfterUpdateTransaction(view);
    view.commitChanges();
  }

 Override
  protected void addEventEmitters(
      final ThemedReactContext reactContext, final ReactVideoPlayer view) {
    view.setStateChangedListener(
        new ReactVideoPlayer.PlayerStateChangedListener() {
...
}
```

As you can see there is a state change listener registered in `addEventEmitters` and `view.commitChanges()` can actually cause a state change. It means that if `onAfterUpdateTransaction` is executed before `addEventEmitters`, the state change listener will be added after a state change has happened and the event will be missed.

Reviewed By: JoshuaGross

Differential Revision: D17600308

fbshipit-source-id: 044e09e0d64973c8237876311d37c057a1ba384e
2019-10-01 03:56:39 -07:00
Oleksandr Melnykov 36b7febe8f Integrate Video into Fabric on Android
Summary: This diff makes the Video component compatible with Fabric on Android.

Reviewed By: JoshuaGross

Differential Revision: D17450815

fbshipit-source-id: 5e47d8cdca96f9fbe72902bac7dd157f7b5fdb1a
2019-10-01 03:56:39 -07:00
Emily Janzer 774502510b Convert SourceCode module to TurboModule
Summary: Converting the SourceCode native module to TurboModules. Checking in the Java class generated from the JS spec and extending it in the module implementation.

Reviewed By: fkgozali

Differential Revision: D17586276

fbshipit-source-id: 3d2080f1280791e81a0366d0aab101d960d11157
2019-09-30 18:03:37 -07:00
Valentin Shergin 3e23a21025 Fixing crash in ComponentDescriptorRegistry
Summary: Until ComponentDescriptorProviderRequest is not fully implemented we need to disable the assert because it enforces constraints that we don't satisfy yet.

Reviewed By: JoshuaGross

Differential Revision: D17677856

fbshipit-source-id: bdf96a04a16981f1c639f646f254e8f3dd799419
2019-09-30 17:30:18 -07:00
Ramanpreet Nara 101125f891 Make RCTActionSheetManager TurboModule-compatible
Summary: RCTActionSheetManager is now hooked up to the NativeModule codegen. It's also TurboModule-compatible.

Reviewed By: PeteTheHeat

Differential Revision: D16966007

fbshipit-source-id: 8fdd32cf9fa09ccda9f38513bb0ac9896f8af1b0
2019-09-30 14:32:21 -07:00
Samuel Susla 9e4266e9d0 Fix RCTRefreshControl component name in Fabric
Summary: Map `RCTRefreshControl` to `PullToRefreshView` when retrieving component descriptor from registry.

Reviewed By: shergin

Differential Revision: D17665287

fbshipit-source-id: 7dc038e8cd8e8078714daa8163327abd8e95b886
2019-09-30 12:39:48 -07:00
Rick Hanlon d0324f693c Move reason to a constant
Summary: Moves the reason to a constant because APPARENTLY this is a best practice in this establishment

Reviewed By: sammy-SC

Differential Revision: D17627819

fbshipit-source-id: 328fad8b7482d0e379a41b5f8c841f71db2bb5ac
2019-09-30 07:03:51 -07:00
Rick Hanlon 7e49a632c2 Send fast refresh stats
Summary: Report fast refreshes to the native module that handles reporting

Reviewed By: cpojer

Differential Revision: D17528523

fbshipit-source-id: 6f8a0b72a18c2d08ab160dc8b6621fce5420a473
2019-09-30 07:03:51 -07:00
Rick Hanlon 2d95668aa8 Add fastRefresh to NativeDevSettings
Summary: This diff adds a method to call whenever a fast refresh happens. Right now this is only useful for reporting.

Reviewed By: cpojer

Differential Revision: D17528033

fbshipit-source-id: 17e82abe7a3e2bab6829de5adecda853fe5335c5
2019-09-30 07:03:51 -07:00
Rick Hanlon 4cea628e0c Add reloadWithReason to Fast Refresh
Summary: This diff adds reload reasons to Fast Refresh. This will help us understand why, for internal Facebook users, Fast Refresh is bailing out to a full reload so that we can improve it for everyone.

Reviewed By: cpojer

Differential Revision: D17499348

fbshipit-source-id: b6e73dc3f396c8531a0872f5572a13928450bb3b
2019-09-30 07:03:51 -07:00
Rick Hanlon 549cac63cb Add reloadWithReason to DevSettings
Summary:
This diff adds reloadWithReason to the NativeDevSettings and updates the exposed DevSettings.reload method to send to it if it's available (setting an 'uncategorized' reason if one isn't set.

[General][Feature] Update DevSettings.reload to accept a reason

Reviewed By: RSNara

Differential Revision: D17499343

fbshipit-source-id: e8c9724800f93d3b9a5d2a8fe9f689d51947d39b
2019-09-30 07:03:50 -07:00
Rick Hanlon 2ccc8fbc28 Add and use reloadWithReason to iOS
Summary:
This diff adds a new reloading method reloadWithReason that allows callers to provide a reason for why a reload was requested.

This reason is useful for understanding why users are reloading, and why Fast Refresh is bailing out to a full reload. I also updated the places we reload with the reasons listed below.

**Standard native reasons:**
- Redbox
- Command
- Global hotkey
- Profiling controls
- Dev menu - reload
- Dev menu - reset to default
- Dev menu - apply changes

**From JavaScript (added in a later diff):**
- Fast Refresh - Unrecoverable
- Fast Refresh - No root boundary
- Fast Refresh - Invalidated boundary
- Fast Refresh - Invalidated root boundary

**Misc reasons and fallback for when a reason is unavailable:**
- Unknown from JS
- Uncategorized from JS
- Unknown from bridge
- Unknown from cxx bridge
- Requested from bridge
- Custom executor class reset

Reviewed By: cpojer

Differential Revision: D17499339

fbshipit-source-id: 12a21ffa05708c9b921d93911f190cdffc5c78d5
2019-09-30 07:03:50 -07:00
Samuel Susla 59b96fe9a3 Fix crash in Paragraph component
Reviewed By: shergin

Differential Revision: D17627622

fbshipit-source-id: 02c47fcf29ca9b5aa19536a8ebdc199a3e356130
2019-09-30 05:06:13 -07:00