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

18188 Коммитов

Автор SHA1 Сообщение Дата
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
Samuel Susla 3f9af02bd5 Call _state.reset in prepareForRecycle
Summary: `_state` should be cleaned up in `prepareForRecycle` as this could potentially cause undesired initial render of the component.

Reviewed By: shergin

Differential Revision: D17628152

fbshipit-source-id: 0116954ab7a5b2f17099db6d9ec47c8568cae8b0
2019-09-30 04:47:25 -07:00
Samuel Susla 0d6c427517 Fix crash in ScrollView.scrollEventThrottle
Summary: Fix crash when casting `scrollEventThrottle`. `scrollEventThrottle` is passed as double from javascript.

Reviewed By: shergin

Differential Revision: D17626401

fbshipit-source-id: 0707a5a440fe7887e316054b455ba972a9291a18
2019-09-30 03:55:59 -07:00
Oleksandr Melnykov 07fe994e26 Fix Slider height in Fabric
Summary: This diff fixes the height of the Slider component in Fabric on Android. Note that the layout is still broken (no padding and the seek bar is misaligned, but it's another issue).

Reviewed By: JoshuaGross

Differential Revision: D17629798

fbshipit-source-id: af8cae909279dc92ee1c80b9be2f5c578972eafc
2019-09-30 03:51:59 -07:00
masaaki1915 231d2f95cd fix typo in comment about package (#26638)
Summary:
This PR only fixes a typo in `ModuleHolder.java`.

## Changelog

[Internal] [Fixed] - Fix typo in comment about package
Pull Request resolved: https://github.com/facebook/react-native/pull/26638

Differential Revision: D17661204

Pulled By: cpojer

fbshipit-source-id: 77ab92b7bfff300961e0a32183188a6e57e99b3d
2019-09-29 20:49:51 -07:00
Valentin Shergin e9f72978d1 Fabric: ComponentDescriptorProviderRequest, a way to register a component on demand
Summary: This diff implements the core functionality of "reactive component registration". With a new API now we have a public API that allows registering a component by request on-demand. That can be helpful in some environments where loading of all components is undesirable or impossible due to generic app design constrains.

Reviewed By: mdvacca

Differential Revision: D17211914

fbshipit-source-id: 5a957a4f6541420d70952856599b827ceec63e3b
2019-09-29 20:06:37 -07:00
Valentin Shergin c5cc27f1e9 Fabric: Introducing ComponentDescriptor::Flavor
Summary:
Currently, the same ComponentDescriptor class cannot be registered as a responder for components with different names. However, we have marginal cases where we really need it. The examples are `UnimplementedView` or possible universal interop with the classic RN or any other UI framework.

This change adds a special optional argument to ComponentDescript constructor that allows implementing this functionality.

Reviewed By: fkgozali

Differential Revision: D17211915

fbshipit-source-id: 18f59e09fe06b875a8e8975b7b2ab423489238bb
2019-09-29 20:06:37 -07:00
Valentin Shergin df229590b2 Fabric: Adding missing `noexcept` operator to functions in raw props parsing infra
Summary:
This part of the codebase is very perf sensitive and designed to work without exceptions enabled.
Most of the method was `noexcept` all the time, but some of those missing that by mistake.

Reviewed By: sammy-SC

Differential Revision: D17629426

fbshipit-source-id: b311e4b7eff8e2b7cf29518288480d3a812dda44
2019-09-29 20:04:15 -07:00
Marc Mulcahy c7aa6dc827 Add onSlidingComplete callbacks when sliders adjusted via a11y (#26600)
Summary:
When sliders are adjusted via accessibility, no onSlidingComplete callback is
generated. This causes problems for components which perform behavior in this
callback, and means that such components don't behave properly when adjusted via
accessibility. For example, if an app hosting a volume control slider only commits the volume change to the hardware on onSlidingComplete, it is impossible for a screen reader user to ever actually adjust the volume.

Ensure that sliders call the onSlidingComplete callback after adjusted via
accessibility.

## Changelog

[General] [Fix] - Add onSlidingComplete callbacks when sliders adjusted via a11y.

[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/26600

Test Plan: Prior to this change, using the RNTester slider example with a screen reader, the onSlidingComplete callback tests never shows any callbacks when the slider is adjusted. With this change applied, the callback test will show a number of callbacks corresponding to the number of times the slider was adjusted via the screen reader.

Differential Revision: D17661157

Pulled By: cpojer

fbshipit-source-id: a6eedef099c6c1b571b290c329059ac9b69b53dd
2019-09-29 19:45:06 -07:00
Vojtech Novak 113c4e229c improve error message in NativeModuleRegistryBuilder.java (#26467)
Summary:
## Motivation

I have seen a spike in users reporting this error. Unfortunately I did not receive any repros that would confirm this, but my hypothesis is that they ran into situation when `new XYZPackage()` was present in `getPackages()` method and then the CLI kicked in with autolinking and they were left with this incomplete error.

someone more knowledgeable of autolinking should review this.
Pull Request resolved: https://github.com/facebook/react-native/pull/26467

Differential Revision: D17661242

Pulled By: cpojer

fbshipit-source-id: 63dfcd85a0d41d85a0dd52f84ab16cb7ceb64ba2
2019-09-29 19:42:08 -07:00
Roshan Gautam 9caf99162d Fixes button partially showing when parent view height is 0 (#26435)
Summary:
When the parent view that wraps a button has height 0, the button is still shown partially because of the padding given for text inside Button component for iOS. Here is the issue raised for that:
https://github.com/facebook/react-native/issues/26421

Probably, we should not hard code these values, rather provide a way to provide custom style ? This is my first PR so not making big change. :D

## Changelog

[iOS] [Fixed] - Give margin instead of padding to text in Button component
Pull Request resolved: https://github.com/facebook/react-native/pull/26435

Test Plan:
When using this block of code,
```
<View style={{height:0}}>
    <Button title="There is an issue"></Button>
</View>
```
Before:
<img width="284" alt="image" src="https://user-images.githubusercontent.com/5866078/64905271-6c129700-d6f5-11e9-86c1-c301eb8123f3.png">

After:
<img width="283" alt="image" src="https://user-images.githubusercontent.com/5866078/64905284-8cdaec80-d6f5-11e9-9589-28d8d01c8ba1.png">

Differential Revision: D17661181

Pulled By: cpojer

fbshipit-source-id: 62b04123d9edb4d760bd54d96ae0615c1ccff7ab
2019-09-29 19:35:17 -07:00