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

3208 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla ae418b83c0 Fix crash when blurring image
Summary:
Changelog: [internal]

Copy `blurRadius` into a variable instead of accessing it through a reference which might not exist when the block is dispatched.

Reviewed By: cpojer

Differential Revision: D24472850

fbshipit-source-id: 936ef671255ae0e825e1d2dfda9649824b63d297
2020-10-22 01:48:55 -07:00
Héctor Ramos 9218e0c2e6 iOS: Generate FBReactNativeSpec ObjC++ files at build time
Summary:
Removes the generated FBReactNativeSpec files from source control.

## Generating FBReactNativeSpec files

The files will be generated automatically by CocoaPods when the `RNTesterPods` Xcode workspace is generated:

```
cd packages/rn-tester
pod install
```

The spec files can be re-generated by invoking the script directly:
```
./scripts/generate-native-modules-specs.sh
```

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24261167

fbshipit-source-id: acb7ac856e5e519932e4f587f79e24f49cd84a91
2020-10-21 20:47:09 -07:00
Samuel Susla 5333ad8a61 Add unit tests for RCTComponentViewRegistry
Summary:
Changelog: [internal]

Adds unit tests for `RCTComponentViewRegistry`.

Reviewed By: shergin

Differential Revision: D24391419

fbshipit-source-id: e8adb641361c3e1394f652a1819f196d2402f493
2020-10-21 10:49:43 -07:00
Samuel Susla 36b0f7d19b Fix controller <TextInput> on iOS when inputting in Chinese/japanese
Summary:
Changelog: [internal]

Solution copied over from 892212bad2 (diff-0874427511e8753d0037472fffbe6d7ee014d831e254d4b3c12ffb1dd8ce27c9)

Reviewed By: JoshuaGross

Differential Revision: D24429166

fbshipit-source-id: 3c0588ac774041a9fd6d1b6685d94c5658f754b2
2020-10-20 15:56:56 -07:00
Valentin Shergin c642afd97d Fabric: Making `_propKeysManagedByAnimated` to preserve previous prop keys
Summary:
The previous implementation always replaced the prop set on every props update coming from Animated. Now, we merge the new set of props with the previous one.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24370751

fbshipit-source-id: 779272d47c776cc42071d3c93d06443b6c96a877
2020-10-19 19:21:22 -07:00
Valentin Shergin 28e9528c4d Fabric: QE for Preemptive views allocation feature
Summary:
Fabric has a feature that preallocates views before mounting even need them. We never tested the impact of this feature thought. This diff adds a way to enable/disable it and run an experiment.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24355612

fbshipit-source-id: fefd653e57232044cd7b28b160e12a4ef85dbb8b
2020-10-16 17:56:58 -07:00
Keion Anvaripour 34c405462f Add HERMES_BYTECODE_VERSION to JS bundle requestUrl
Summary:
Changelog:
[General][Added] - Adds the Hermes runtime bytecode version number to the JS bundle requestURL. This allows Metro with Bytecode to work with prebuilt binaries.

Reviewed By: cpojer

Differential Revision: D24327852

fbshipit-source-id: e8ee8db4f9b01f0500ab9dd851b5818c4adf3303
2020-10-16 16:39:43 -07:00
Valentin Shergin fe8cd5cf3e Fabric: Lazy initialization of RCTSurfaceTouchHandler on the main thread
Summary:
RCTSurfaceTouchHandler is not a thread-safe object and must be used (and initialized) on the main thread. Therefore we need to move the initialization to `view` method which is guaranteed to be called on the main thread.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24290776

fbshipit-source-id: fc1f2f157599aff6fca053451f89bf7cca3c812a
2020-10-15 10:47:11 -07:00
Ramanpreet Nara 5a57a538c9 Split NativeAsyncStorage into NativeAsyncLocalStorage and NativeAsyncSQLiteDBStorage
Summary:
Although the interface for both NativeModules is the same, we'd like to enforce 1 `TurboModuleRegistry.get` call per NativeModule spec file. Therefore this diff splits the one spec into two.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24325260

fbshipit-source-id: f18718e4235b7b8ccbfc44a7e48571ecf483a36c
2020-10-15 08:49:28 -07:00
Ramanpreet Nara 82187bfb6b Dispatch events even when there are no listeners
Summary:
## Rationale
For every 1 call to RCTNetworking.sendRequest, we execute 6 calls to RCTNetworking.addListener. This is followed by at least one call to RCTNetworking.removeListeners. Aside from incrementing and decrementing the `_listeners` integer, these two methods accomplish nothing else: RCTNetworking doesn't implement the `startObserving` and `stopObserving` methods.

This diff makes RCTEventEmitter dispatch events without looking at the listeners integer. In the future, this will allow us to stop making these ~8 unnecessary NativeModule calls for every Network request we send.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24272560

fbshipit-source-id: 7996eba5abfa4669a89c43a3ffa536c0faa214a8
2020-10-14 21:05:38 -07:00
Lulu Wu ea93151f21 Make RCTEventDispatcher TurboModule-compatible
Summary:
This diff ended up being a bit more complicated than I anticipated, since the source files in `ReactInternal` were depending on `RCTEventDispatcher`. I made the following changes:
1. Make `RCTEventDispatcher` a `protocol`, keep it in `ReactInternal`.
2. Rename the `RCTEventDispatcher` NativeModule to `RCTEventDispatcherModule`, make it conform to the `RCTEventEmitter` `protocol`, and move it to `CoreModules`.
3. Where necessary, replace categories of `RCTEventDispatcher` with functions.

Changelog:
[iOS][Added] - Make RCTEventDispatcher TurboModule-comaptible

Reviewed By: fkgozali

Differential Revision: D18439488

fbshipit-source-id: b3da15c29459fddf884519f33b0c3b8c036b5539
2020-10-14 02:40:10 -07:00
Scott Kyle 42d232901c Fix ASAN crash in RCTMessageThread
Summary:
This should fix a race condition uncovered by ASAN build that results in `m_shutdown` being referenced after destruction.

This mirrors a similar fix made in react-native-macos: ea7767a211

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24263156

fbshipit-source-id: 5fb1e7053c107dfb7050242fce8fcf0435e5592c
2020-10-13 15:37:52 -07:00
Peter Argany ccc4f0153d Fabric Picker Native Command support
Summary:
This adds support for a controlled  `<Picker/>` component .

Changelog: [iOS][Fabric] Fabric Picker support

Reviewed By: sammy-SC

Differential Revision: D24005475

fbshipit-source-id: c50e9918f74f6ef5cdfbfe67cb6c132c12d64916
2020-10-13 11:19:29 -07:00
Peter Argany 51e8e0b7e1 Fabric Picker styling support
Summary:
This adds support for `<Picker style={}/>` prop for text styling. It reuses most of conversion logic from BaseText. This means that it actually supports more styles than Paper Picker supported. (Paper picker only supported ~4 styles, this supports everything that Text supports, so 10+ styles).

The only tricky thing is that Picker supports multiple ways of setting text color. Both

      <Picker
        itemStyle={{color: '#008BD0'}} >
        <Picker.Item label="Java" value="java" />
        <Picker.Item label="JavaScript" value="js" />
      </Picker>

and

      <Picker>
        <Picker.Item label="Java" value="java" color={'#008BD0'} />
        <Picker.Item label="JavaScript" value="js" />
      </Picker>

technically work in Paper. I've decided to maintain this behaviour (since there's lots of product code callsites to both options).

Changelog: [iOS][Fabric] Fabric Picker support

Reviewed By: sammy-SC

Differential Revision: D23980319

fbshipit-source-id: e469a837e28af0ad97cf0e171df26ee19adff3ab
2020-10-13 11:19:29 -07:00
Peter Argany 251d5e1bbe Fabric Picker onChange event
Summary:
Implements `onChange` prop for `<Picker/>`.

Changelog: [iOS][Fabric] Fabric Picker support

Reviewed By: sammy-SC

Differential Revision: D23975689

fbshipit-source-id: 7aa81c203d420a8971e4309911a41ecfd377a318
2020-10-13 11:19:29 -07:00
Peter Argany c2e7ac1b35 Fabric picker item parsing
Summary:
This builds on previous diff to properly parse `<Picker.Item/>` into a cpp struct.

This fixes the dummy text and text color TODOs.

Changelog: [iOS][Fabric] Fabric Picker support

Reviewed By: sammy-SC

Differential Revision: D23964557

fbshipit-source-id: f42c6c9cf410bfc5e66ff078645b6378548481de
2020-10-13 11:19:29 -07:00
Peter Argany 38cb06cbd3 Initial commit for Fabric Picker
Summary:
This is a starting point for the handwritten Fabric Picker component. It is incomplete, and needs to be landed with the rest of the stack above it.

In general, this creates a new `ComponentView`, `ComponentDescriptor`, `ShadowNode`, `Props` and a few other boilerplate classes for Picker. A bunch of the logic in `ComponentView` was copied over from the Paper `RCTPicker` and `RCTPickerManager`.

What works in this diff:
- A `<Picker>` with items can be created in JS, and a corresponding `UIPicker` is created in native with placeholder text, default styling and the correct amount of items

What doesn't work yet (implemented in later diffs):
- Parsing items to use correct text and styling in native
- Events/commands

Reviewed By: sammy-SC

Differential Revision: D23941821

fbshipit-source-id: e049ca6004757fbd1361985644d5dbb8f53e1ce6
2020-10-13 11:19:29 -07:00
Peter Argany 760c10a5aa Fix new RCTDeviceInfo assert to work in bridgeless mode
Summary:
shergin added a new assert to dimensions calculations in D24038911 (e853722981). This crashes in bridgeless mode b/c no bridge.

 This diff uses `turboModuleRegistry` as a bridge workaround.  The registry is a [weak property](https://www.fburl.com/diffusion/sunv3bx9) so retain cycles shouldn't be an issue here, let me know if that's incorrect.

As a nice bonus, this fixes dynamic font sizing in bridgeless mode. It was broken before since it relied on the bridge.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24256338

fbshipit-source-id: 141d36239ac6a6e9e87ca96eea7aeec56729095d
2020-10-12 12:49:29 -07:00
simek b7167c23fc PlatformColors: add missing clearColor for iOS (#30054)
Summary:
This small PR adds missing [`clearColor`](https://developer.apple.com/documentation/uikit/uicolor/1621945-clearcolor?language=objc) to the avaiable PlatformColors on iOS.

**Please let me know** if you would like to see ["Fixed colors"](https://developer.apple.com/documentation/uikit/uicolor/standard_colors?language=objc) added to the `PlatformColors`. I can address this within this PR or create a separate one.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Added] - PlatformColors: add missing `clearColor`

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

Test Plan:
[(I had to disable the Dark Mode to fix the RNTester readability problems)](https://user-images.githubusercontent.com/719641/94453196-b35cb000-01b0-11eb-8d7d-73d48ceecf53.PNG)

Transparent/clear color has been added to the RNTester PlatformColors API example:
![IMG_6782](https://user-images.githubusercontent.com/719641/94453172-ae97fc00-01b0-11eb-9bef-1a1a387ac009.PNG)

Reviewed By: shergin

Differential Revision: D24241160

Pulled By: sammy-SC

fbshipit-source-id: 41fb51677329cc3b3f915d5d08694c07b4ef2cf3
2020-10-12 02:14:42 -07:00
Samuel Susla eb7701c1ec Search for Fabric managed view when creating Touch
Summary:
Changelog: [Internal]

If `uiTouch.view` isn't managed by Fabric, go up the view hierarchy to find first view that is.

This is important for host views wrapped by <Touchable>, otherwise touches are not delivered to the component.

Reviewed By: yungsters

Differential Revision: D24219223

fbshipit-source-id: 17b4e3460735371553ee0d30b41776a977f8eafb
2020-10-12 01:59:49 -07:00
Mark Sinkovics 748aa13747 fix: crash when insert nil value into a dictionary (#30066)
Summary:
This PR attempts to fix issue https://github.com/facebook/react-native/issues/28278 and https://github.com/facebook/react-native/issues/29525

On Crashlytics, the following error occurs in file `RCTWebSocketModule.m` at method `-[RCTWebSocketModule webSocket:didFailWithError:]` when a nil value is inserted into a dictionary as a value.

```
Fatal Exception: NSInvalidArgumentException
*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
```

This PR is following the suggestion of this: https://github.com/facebook/react-native/issues/28278#issuecomment-597461650 and it replaces the values of any property if it is nil. In detail:
- it converts `error` to empty NSString if the original value is nil
- it converts `socketID` to a NSNumber object, which stores `-1` if the original value is nil

## Changelog

[iOS] [Fixed] - A crash in WebSocket module

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

Test Plan: We were not able to reproduce the crash, but the report itself provided enough information to find a solution for this issue.

Reviewed By: shergin

Differential Revision: D24241147

Pulled By: sammy-SC

fbshipit-source-id: d5d632b49ca77b5d8be8b9c32358bef68f17d30a
2020-10-12 01:47:49 -07:00
Samuel Susla fa20f25480 Enable multitouch on RCTViewComponentView
Summary:
Changelog: [internal]

RCTViewComponent view should have multipleTouchEnabled set to YES.
Paper has it enabled by default as well.

Reviewed By: JoshuaGross, yungsters

Differential Revision: D24219076

fbshipit-source-id: 74c18632457147b944a8abbacdbecb57e57f62ef
2020-10-09 17:11:43 -07:00
Ramanpreet Nara 5535031ba4 Gate TurboModule block copy behind an MC
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24145506

fbshipit-source-id: 7e374c3bd2378cc1dcd9372d7cbb10ae445a2582
2020-10-06 18:40:20 -07:00
Valentin Shergin 7c83eaba80 Fabric: Fixed crash in `[RCTParagraphComponentView accessibilityElements]`
Summary:
Now we check for `_state` being nullptr before dereferencing this.

`accessibilityElements` (as a bunch of other methods that have the same check) can be called by OS any moment (we cannot predict when), so at some very rare moments, it can be called when the view is not fully initialized yet. To prevent crashing we just need to return some default value indicating that the view is empty.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24095654

fbshipit-source-id: d8a37f269c5bf7718acb0b512e7a9313e199398e
2020-10-04 19:12:22 -07:00
Valentin Shergin 03e120daa9 Back out "Use ConcreteStateTeller in RCTParagraphComponentView"
Summary:
RCTParagraphComponentView does not need to have the state teller because it does not change the state.
Also, we are thinking about removing State Teller, so to simplify a fix coming in the next diff, we are backout the introducing a state telled in RCTParagraphComponentView.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24095655

fbshipit-source-id: 90bd21cb8b01056c0db902a604b4088bf8c7750e
2020-10-04 19:12:22 -07:00
Dustin Shahidehpour 1511bfa028 Do another passthrough of labeling.
Summary:
At this point, I think we are ready to enable validation

Changelog: [INTERNAL]

Differential Revision: D24062829

fbshipit-source-id: c82dcd2c376e5cdeb164451e16b6fb3a666106f4
2020-10-02 08:49:06 -07:00
Samuel Susla 54fd41c9f6 Animate Switch value changes
Summary:
Changelog: [internal]

Changing value of Switch should animate except for first rendering of the switch.

Reviewed By: JoshuaGross

Differential Revision: D24046268

fbshipit-source-id: d0b2a1a4837fc8daebce2f0e6d3d82212b490ba4
2020-10-02 05:37:06 -07:00
Emily Janzer 5a1ca38305 Add ReactMarker::logTaggedMarkerWithInstanceKey
Summary:
Adding another method to ReactMarker to log a marker with both a tag and an instanceKey. The instanceKey is used to attach the event to the correct marker instance - this is used already in Java, but not in C++ yet.

The way that ReactMarker is currently set up makes this change a little more complex/confusing. For some reason I'm not totally clear on, we're using C-style exports with some platforms-specific ifdefs in ReactMarker.h (even though the impl is .cpp?). And we swap out the implementation for `logTaggedMarker` at runtime in platform-specific code (JReactMarker and RCTCxxBridge).

In this diff, I just add a new function alongside `logTaggedMarker`, `logTaggedMarkerWithInstanceKey`. I did it this way because I figured modifying `logTaggedMarker` to add an argument would be a breaking change.

Reviewed By: PeteTheHeat

Differential Revision: D23831533

fbshipit-source-id: f5b3eba1f43a80f7723fdb64cfc0a792548db2ba
2020-10-01 14:16:32 -07:00
Valentin Shergin e853722981 A couple of checks for corner cases in RCTGetDimensions and RCTExportedDimensions
Summary: We need this checks to make the results of those function more reliable.

Reviewed By: sammy-SC

Differential Revision: D24038911

fbshipit-source-id: 3b54fe3056c9508cde84ea157beebea57e7e49b6
2020-10-01 13:19:52 -07:00
Samuel Susla 9a2a4ba579 Remove handling of view commands for Fabric
Summary:
Changelog: [internal]

This code was put in when we didn't have view commands implementation in Fabric. Now we do so let's get rid of it.

Reviewed By: JoshuaGross

Differential Revision: D24046269

fbshipit-source-id: d0f203bc09bf22f5307cb1844d14b295fe3550dd
2020-10-01 12:25:59 -07:00
Samuel Susla b2c022ec54 Prevent Fabric from changing props if they are managed by Animated
Summary:
Changelog: [internal]

# Problem

Fabric doesn't know when NativeAnimatedModule control a prop and overrides its change whenever any prop changes. For example component A is animating its opacity from 1 to 0. NativeAnimatedModule starts calling `[RCTViewComponentView updateProps:oldProps:]` method interpolating opacity from 1 to 0.

After it is finished, if any prop is updated on the component. Its opacity will be set to default.

# Fix

This is a temporary problem until Unified Animation System is put in place. To work around the issue for now, we keep a set of prop keys controlled by animated and only update the prop if it isn't in this list. List is cleared when the component is reused.

Reviewed By: JoshuaGross

Differential Revision: D24046848

fbshipit-source-id: 63cca6854f97b2de764cb3ed505d328323c64525
2020-10-01 12:18:31 -07:00
Valentin Shergin 61cfa97067 Breaking a retain cycle between `RCTSurfaceTouchHandler` and `RCTFabricSurface` (another approach)
Summary:
This is a different approach to break the retain cycle: instead of detaching a view manually, we store a pointer to a view weakly.

I am working on some change that will make possible (and make use of it) to call `start` and `stop` on Surface objects mutiple times, so to make it happens we need to remove detaching from `stop` method.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24041524

fbshipit-source-id: 700b13d715d2eb84d52bf3e51e0fd2896a55baf8
2020-10-01 09:38:28 -07:00
Valentin Shergin 16afda2282 Fabric: Making `RCTFabricSurface` to hold a `RCTSurfacePresenter` weakly
Summary:
With this change a RCTFabricSurface instance will not longer to hold a `RCTSurfacePresenter`. This change will enforce the guarantee that retaining a `RCTFabricSurface` is not enough for the service to run (something also should retain a `RCTSurfacePresenter`).

For now it's a very small fix that should not anything, but this is a crusial part of some changes I am working on (one aspect of which implied calling unregistration in a `RCTFabricSurface`'s destructor). I need to decouple this part to test this change earlier and decouple this part of the complexity from the future diffs.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24039581

fbshipit-source-id: c289ae057f0cd5b438f0aa9a1eb8577e1e00b39c
2020-10-01 09:38:28 -07:00
Valentin Shergin c42183817d Fixed incorrect assert in RCTScrollViewComponentView
Summary:
This diff removes an incorrect assert and replaces it with a debug-only verification phase that compares "what we want" with "what we get".

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: PeteTheHeat

Differential Revision: D23983123

fbshipit-source-id: 03a628b4f8baa1f5fe4b55354b7c943e38b5e537
2020-09-30 19:24:18 -07:00
Paige Sun a7c026e667 Remove unused Fabric image instrumentation
Summary:
Remove the older implementation of image instrumentation in Fabric by removing, RCTImageInstrumentationProxy, ImageInstrumentation from ImageRequest, and trackURLImageContentDidSetForRequest from RCTImageLoaderWithAttributionProtocol.

Changelog: [RN][Fabric][Image] Remove unused Fabric image instrumentation

Reviewed By: fkgozali

Differential Revision: D23990606

fbshipit-source-id: 004d04025d031af11377a73e5bfb64b1e0449962
2020-09-29 14:19:09 -07:00
Samuel Susla 5ccb5f5b80 Fix dismissal animation of Modal Component
Summary:
Changelog: [Internal]

Fabric removes components bottom up (from leafs to the root).
This means that by the time Fabric hides Modal, it has no content and therefore it appears as if Modal disappears without Animation.

To fix this, we snapshot contents of the Modal before any of its contents are removed.

Reviewed By: shergin

Differential Revision: D23976244

fbshipit-source-id: 01c13b74e97f82816e8946fd9d1add1db10340b1
2020-09-29 06:44:25 -07:00
generatedunixname89002005325676 da8b50cd33 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D23986055

fbshipit-source-id: 7bfe9f06f236f8866e812db060edf3d089fe253c
2020-09-29 04:14:33 -07:00
simek 2160377574 remove most of tvOS remnants from the code (#29407)
Summary:
Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), https://github.com/facebook/react-native/issues/28706, https://github.com/facebook/react-native/issues/28743, https://github.com/facebook/react-native/issues/29018

This PR removes most of the tvOS remnants in the code. Most of the changes are related to the tvOS platform removal from `.podspec` files, tvOS specific conditionals removal (Obj-C + JS) or tvOS CI/testing pipeline related code.

In addition to the changes listed above I have removed the deprecated `Platform.isTVOS` method. I'm not sure how `Platform.isTV` method is correlated with Android TV devices support which is technically not deprecated in the core so I left this method untouched for now.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

* **[Internal] [Removed]** - remove most of tvOS remnants from the code:
  * `TVEventHandler`, `TVTouchable`, `RCTTVView`, `RCTTVRemoteHandler` and `RCTTVNavigationEventEmitter`
* **[Internal] [Removed]** - remove `TARGET_TV_OS` flag and all the usages
* **[iOS] [Removed]** - remove deprecated `Platform.isTVOS` method
* **[iOS] [Removed]** - remove deprecated and TV related props from View:
  * `isTVSelectable`, `hasTVPreferredFocus` and `tvParallaxProperties`
* **[iOS] [Removed]** - remove `BackHandler` utility implementation

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

Test Plan: Local tests (and iOS CI run) do not yield any errors, but I'm not sure how the CI pipeline would react to those changes. That is the reason why this PR is being posted as Draft. Some tweaks and code adjustment could be required.

Reviewed By: PeteTheHeat

Differential Revision: D22619441

Pulled By: shergin

fbshipit-source-id: 9aaf3840c5e8bd469c2cfcfa7c5b441ef71b30b6
2020-09-28 21:26:41 -07:00
Martin Ortega 0a0d2c990d Make the Instagram app compile again
Summary:
Wrap iOS 14 SDK code in a `#if/#endif` so that the Instagram app compiles again

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D23948336

fbshipit-source-id: 67e6ee48d1951ae405c12b4ad39cf8c9817df627
2020-09-28 12:36:04 -07:00
Samuel Susla e5006b3436 Fix slider's initial value
Summary:
Changelog: [Internal]

value needs to be set after minimum and maximum, otherwise it gets pinned to previous minimum/maximum.

Default minimum is 0 and maximum is 1. If we set value to 20 and maximum to 50, previously the value would get pinned to 1 (maximum value).

See [Apple Docs](https://developer.apple.com/documentation/uikit/uislider/1621346-value?language=objc) for more.

Reviewed By: JoshuaGross

Differential Revision: D23903545

fbshipit-source-id: 8e9dd49ced79d43b9591c7d24de59b9eaff5bdfd
2020-09-28 03:15:12 -07:00
Valentin Shergin 308f9a131a Fabric: Failing early in case if a argument of `-[RCTComponentViewFactory registerComponentViewClass:]` is nil
Summary:
Subject.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D23914517

fbshipit-source-id: 1c909e7d21b12326881990ecf855e814bf957f3c
2020-09-26 22:02:36 -07:00
Paige Sun e2fd9d4f22 Group accessible views using the view hierarchy
Summary: In iOS when a parent UIView returns YES on [shouldGroupAccessibilityChildren](https://developer.apple.com/documentation/objectivec/nsobject/1615143-shouldgroupaccessibilitychildren), VoiceOver groups together the accessible children of the parent view, regardless of their position on screen. In iOS this defaults to NO.

Reviewed By: sammy-SC

Differential Revision: D23844265

fbshipit-source-id: eb99bf0873ccfd9fb196f8f7b6eafe055f6ae810
2020-09-25 15:55:59 -07:00
Peter Argany c015f485c2 Workaround for Date Picker in iOS14
Summary:
iOS14 has introduced new styles for date picker. The default new calendar style breaks the old spinner type style.

This is a workaround to keep the spinner style as a default, until the calendar style is properly supported. According to [this github comment](https://github.com/react-native-community/datetimepicker/issues/285) it works well.

This will fix DatePicker for both Fabric and Paper, since Fabric uses the interop layer to render it.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D23935328

fbshipit-source-id: 1a7fadba274e0537f0ac4ced60e23e7c809d57dc
2020-09-25 11:43:49 -07:00
Samuel Susla 371430d7eb Fix rounding in Slider component
Summary:
Changelog: [Internal]

There was a typo in condition. We need to be comparing step prop and not value. The same condition is implemented in Paper.

Reviewed By: JoshuaGross

Differential Revision: D23903493

fbshipit-source-id: 37506d0fac63f624332041602489ab1cf378bfcc
2020-09-24 09:47:44 -07:00
Samuel Susla c907202d2b Fix touch handling in bridged paper components
Summary:
Changelog: [internal]

If view was bridged from Paper, hit testing would return Paper view which doesn't have reference to Fabric's event emitter.
To fix this, if the bridged view is returned from hit testing, it is swapped with interop view which has reference to event emitter.

Reviewed By: shergin

Differential Revision: D23840054

fbshipit-source-id: d4aa4ee8da4e1da80d2e2b69b79ed82d726f04e3
2020-09-24 01:07:23 -07:00
Scott Kyle 23717e48af Call stopObserving on correct queue
Summary:
Since `dealloc` can be called from any thread, this would result `stopObserving` being called on a different thread/queue than the specified `methodQueue`. We specifically encountered this issue with a module needing the main queue having its `stopObserving` called on a background queue.

Changelog:
[iOS][Fixed] - Call [RCTEventEmitter stopObserving] on specified method queue

Reviewed By: RSNara

Differential Revision: D23821741

fbshipit-source-id: 693c3be6876f863da6dd214a829af2cc13a09c3f
2020-09-21 17:30:34 -07:00
generatedunixname89002005287564 3f85b83653 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D23811656

fbshipit-source-id: 4104948d2e4db786998320bcfdb1598d4a497f2d
2020-09-21 04:38:18 -07:00
Valentin Shergin 57dd48b246 Fabric: Marking all JS function lambdas `noexcept` in UIManagerBinding
Summary:
Exceptions in C++ work quite differently from exceptions in other languages. To make exceptions actually work **correctly** all the code needs to be written with "exceptions in mind" (e.g., see https://www.stroustrup.com/except.pdf). In short, if the code is not "exceptions ready", throwing an exception causes memory leaks, dangling pointers, and invariant violations all over the place, which will probably cause another crashes down the road (which will be especially hard to investigate and attribute to the original issue).
Fabric Core (Layout, Props parsing, ShadowNodes management, and so on) does not use exceptions because in most (all?) the cases the exception is now recoverable. So, if a program detects some internal state invariant violation or missing some resource, *logically* it's fatal. We also don't want to pay code-size and performance tax for exception support, so that's why we don't use them. It's just not the right fit for Fabric Core.

This does not mean that exceptions don't happen though. C++ standard library can throw them... sometimes. And if our library is compiled with exceptions enabled (still the case, unfortunately), an exception can bubble to JavaScript code and losing all context down the road. And it's hard to investigate such crashes. To isolate those occasional exceptions inside C++ core we are marking all C++/JS boundaries with `noexcept` that stops the bubbling.

I hope that will give us much more informative crash reports.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D23787492

fbshipit-source-id: 0822dbf36fc680c15b02b5cd0f2d87328296b642
2020-09-18 17:07:29 -07:00
Valentin Shergin 5b93c49e76 Fabric: Using pre-cached UIColor objects for black, white, and clear colors
Summary:
This change maps the three most used colors (black, white, clear) to corresponding predefined values in UIColor. This should meaningfully reduce the overall amount of allocated UIColor/CGColor objects. In my non-scientific measures, it reduces the number of CGColor objects from ~1500 to ~1000. And... it no much at least in terms of kilobytes. However, I still think it's a good idea to implement this because I hope that can remove some work from memory allocation infra and maybe enable some optimizations that UIKit hopefully does for black and white colors. (I tend to believe that this optimization exists because UIKit even has a classes called UIDeviceWhiteColor and UICachedDeviceWhiteColor.)

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D23753506

fbshipit-source-id: 46e58dc7e6b0dcab3c83d29c7257c90ffbd95246
2020-09-17 11:12:29 -07:00
Valentin Shergin 241795cbc4 Fabric: Color conversion functions now do not depend on internal implementations of SharedColor
Summary:
This diff changes the implementation of `RCTCreateCGColorRefFromSharedColor` and `RCTUIColorFromSharedColor` in such a way that they don't rely on the fact that SharedColor is actually a `shared_ptr<CGColorRef>`. Instead, the methods just extract color components from SharedColor and create UIColor and CGColorRef objects on demand.
This allows us to change the implementation of SharedColor without worrying much about the rest of the system, which will do in the next diff.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D23753510

fbshipit-source-id: 340127527888776ebd5d241ed60c7e5220564013
2020-09-17 11:12:28 -07:00