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

3112 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla 154ce78972 Take viewport offset into account in UIManager.measureInWindow
Summary:
Changelog: [Internal]

Fabric's UIManager.measureInWindow didn't take viewport's offset into account. This diff fixes it by including viewport's offset in `LayoutContext`.

Reviewed By: JoshuaGross

Differential Revision: D23021903

fbshipit-source-id: 9106a8789d66fe19d8cb0a9378ee5bc8f2c83005
2020-08-10 12:52:23 -07:00
Samuel Susla 3be9f3ef2c Make RCTSurface and RCTFabricSurface conform to common protocol
Summary:
Changelog: [internal]

RCTSurface and RCTFabricSurface are two distinct classes that need to have the same interface otherwise the program crashes. This diff ties their interfaces through a protocol, triggering a build time error if they diverge.

Reviewed By: PeteTheHeat, JoshuaGross

Differential Revision: D23021837

fbshipit-source-id: 09ce345298ec2b45ac5a3fd2e0d3f5fa757a174f
2020-08-10 12:52:23 -07:00
Peter Argany ffdfbbec08 Support bridgeless in RCTEventDispatcher
Summary:
This ties the stack together, utilizes new TM functionality to avoid using the bridge in `RCTEventDispatcher`.

Changelog: [Internal]

Differential Revision: D22962320

fbshipit-source-id: de4e001a4a6ce232c37d7feed1e0c0d1d70a80f8
2020-08-07 11:55:51 -07:00
Peter Argany c494d590fb Workarounds for two bridge methods: dispatchToJSThread and enqueueJSCall:
Summary:
To get `RCTNativeAnimatedModule` working bridgeless, I need to get `RCTEventDispatcher` working bridgeless.

To get `RCTEventDispatcher` working bridgeless, I need to support 2 new bridge methods:
- `- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args`
- `- (void)dispatchBlock:(dispatch_block_t)block queue:(dispatch_queue_t)queue;`

For (1) I copied the bridge impl exactly. For (2), the bridge only dispatches to JS thread, else uses `dispatch_async`. I only added support for dispatching to JS thread, callers can `dispatch_async` themselves if they want to.

Changelog: [Internal]

Differential Revision: D22962292

fbshipit-source-id: e34d15aee72f80dffcaa945bfda05ea415f66df7
2020-08-07 11:55:51 -07:00
Peter Argany fcb667059d Fix refresh control redbox
Summary: Changelog:[Internal]

Reviewed By: Vince0613

Differential Revision: D22989945

fbshipit-source-id: 735da1cf103b2465663ecb6abfd49e512aff9a1e
2020-08-06 17:31:47 -07:00
Jiayan Zhuang dd040a87a7 Implement localization for accessibility guide words (#29576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/29576

Changelog:
[Internal] - Implement localization for accessibility guide words

Reviewed By: PeteTheHeat

Differential Revision: D22419882

fbshipit-source-id: 85fc4e741df3c59b64173c027a3c4e61b01bad4c
2020-08-06 16:38:56 -07:00
Devon Deonarine f319ff321c iOS: Update RCTAlertManager to use new RCTAlertController (#29295)
Summary:
This should fix https://github.com/facebook/react-native/issues/29082 and https://github.com/facebook/react-native/issues/10471

Currently when an alert is being shown while a modal is being dismissed, it causes the alert not to show and In some cases it causes the UI to become unresponsive. I think this was caused by using RCTPresentedViewController to try and display the Alert the currently presented view. The View the Alert was going to be shown on is dismissed and the modal doesn't show. I implemented a new RCTAlertController to show the alert on top of the view, the modal being dismissed should now not interfere with the alert being shown.

## Changelog

[iOS] [Fixed] - Fixed showing Alert while closing a Modal

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

Test Plan:
To recreate the bug:

1. npx react-native init Test --version 0.63.0-rc.1
2. Paste the following code into App.js

```javascript
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * format
 * flow strict-local
 */

import React from 'react';
import {
  SafeAreaView,
  StyleSheet,
  View,
  Text,
  StatusBar,
  Modal,
  Alert
} from 'react-native';

const App: () => React$Node = () => {
  const [visible, setVisible] = React.useState(false)

  const onShowModal = () => {
    setVisible(true)
  }

  onCloseBroken = () => {
    setVisible(false)
    Alert.alert('Alert', 'Alert won\'t show')
  }

  onCloseWorking = () => {
    setVisible(false)
    setTimeout(() => Alert.alert('Alert', 'Works fine'), 10)
  }

  return (
    <>
      <StatusBar barStyle="dark-content" />
      <SafeAreaView style={styles.container}>
        <Text onPress={onShowModal}>Show modal</Text>
      </SafeAreaView>
      <Modal animationType="fade" visible={visible} onRequestClose={onCloseWorking} >
        <View style={styles.container}>
          <Text onPress={onCloseBroken}>Close modal immediately</Text>
          <Text onPress={onCloseWorking}>Close modal with delay</Text>
        </View>
      </Modal>
    </>
  )
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'space-around',
  },
})

export default App

```

3. cd Test && npx react-native run-ios
4. Show the modal and click the `Close modal immediately` button

The first button doesn't show the alert, the second does because it gets rendered after the modal view is dismissed. After this commit, the alert always shows on top of every view properly. You can test by pointing the react native package to my branch by modifying the package json file like this

```
    "react-native": "https://github.com/devon94/react-native.git#fix-ios-modal"
```

I was unable to reproduce the case where it causes the UI to be responsive in the test app but was able to reproduce it in our react native app at work. I can provide a video later if needed but the code is too complex to simplify into a test case.

Reviewed By: sammy-SC

Differential Revision: D22783371

Pulled By: PeteTheHeat

fbshipit-source-id: 3e359645c610074ea855ee5686c59bdb9d6b696b
2020-08-06 16:20:47 -07:00
Jiayan Zhuang 07640dce69 Build the basic RCTLocalizationProvider
Summary:
Changelog:
[Internal][Add] - Build the basic RCTLocalizationProvider

RCTLocalizationProvider is to enable the localization in fabric. But I'd start with internal apps now.

Reviewed By: PeteTheHeat

Differential Revision: D22704051

fbshipit-source-id: 845693a131c325f3c3d92b2ff491d5421966ad3e
2020-08-06 14:35:35 -07:00
Jiayan Zhuang 3f405dcbd2 Add support for accessibilityRole = "switch"
Summary:
Changelog:
[Internal] - Add support for accessibilityRole = "switch"

Reviewed By: sammy-SC

Differential Revision: D22906500

fbshipit-source-id: 81dfbfd56a24c89ffedc0fde5a63f7bdeed0c5db
2020-08-06 13:16:48 -07:00
Jiayan Zhuang 6fa9dbabfc Update accessibilityState prop
Summary:
Changelog:
[Internal] - Add default value for accessibilityState "checked" and handle unhandled states.

It is also work for the case that accessibilityRole = "switch" and accessibilityState is set.

Reviewed By: sammy-SC

Differential Revision: D22914427

fbshipit-source-id: 4767a21f3bd109019b57bc09918758a38fbdea93
2020-08-06 12:14:38 -07:00
Nicholas Tinsley 389b0b4bd1 Mark RN method as requiring iOS 10+
Summary:
as title. The output of Buck suggested I add this, so I did and it let me build.

Changelog:
[Internal][Fixed] - Added iOS 10 method compatibility macro

Reviewed By: PeteTheHeat

Differential Revision: D22955013

fbshipit-source-id: 6aa03b164adca480e7c6f661b221c9bd3ee6c4f1
2020-08-05 14:49:07 -07:00
Yogev Ben David 1b0fb9bead iOS: Fix refreshControl layouting (#28236)
Summary:
In `react-native-navigation` we allow the usage of native iOS navigationBar **largeTitle** which cause the title to "jump" when pulling to refresh.
We found that the layout calculations of the refreshControl element mess up the system behaviour.

## Changelog

[iOS] [Fixed] - Fix refreshControl messes up navigationBar largeTitles

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

Test Plan:
### Before the fix:
![before](https://user-images.githubusercontent.com/10794586/75991307-f7c7ec00-5efe-11ea-8cd9-ab8c3fbe1dc1.gif)

### And after:
![after](https://user-images.githubusercontent.com/10794586/75990618-d9152580-5efd-11ea-8c72-5deb6d83a840.gif)

### How it looks like with react-native init app after the fix:
![ezgif com-video-to-gif (4)](https://user-images.githubusercontent.com/10794586/77253369-54970680-6c62-11ea-9ad6-3265e23044e6.gif)

Reviewed By: sammy-SC

Differential Revision: D22782680

Pulled By: PeteTheHeat

fbshipit-source-id: f86ccd0a6ad492312029a69b392cd525450fe594
2020-08-05 11:51:30 -07:00
Jiayan Zhuang df66b7a4d2 Add UIContentSizeCategoryDidChangeNotification to re-render text
Summary:
Changelog:
[Internal] - Add UIContentSizeCategoryDidChangeNotification to re-render text

We don't need to restart the app to re-render text now, but we still need to swipe the screen or click on buttons to force to refresh. We may address this in the future.

Reviewed By: PeteTheHeat

Differential Revision: D22867293

fbshipit-source-id: 4747a45adc2bdc638cf7ef9c07a9484e48600583
2020-08-04 15:12:14 -07:00
Jiayan Zhuang a422592c95 Delete WEBKIT_IOS_10_APIS_AVAILABLE
Summary:
Changelog:
[Internal][Removed] - Delete WEBKIT_IOS_10_APIS_AVAILABLE because React Native doesn't support iOS 9 and WEBKIT_IOS_10_APIS_AVAILABLE would always be true.

Reviewed By: PeteTheHeat

Differential Revision: D22768504

fbshipit-source-id: 76dbf967260b26ee6c0a45d8ae099f137a3a4ec7
2020-08-04 09:10:00 -07:00
Samuel Susla 22584954cd Account for view offset in bottom sheet
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22887857

fbshipit-source-id: 97194737a5c7c83f0ff9b35d90608c5e7e9b6bab
2020-08-04 01:50:56 -07:00
Samuel Susla a1b6f7bd9e Fabric: Asserting if the RuntimeExecutor callback in RCTRuntimeExecutorFromBridge is not called
Summary:
The implementation of RuntimeExecutor must execute all provided callbacks. However, the implementation of RCTRuntimeExecutorFromBridge cannot guarantee it because it relies on Bridge to make the call. In this diff, we wrap the callback into a callable that asserts if it's not being called before destruction.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D22810439

fbshipit-source-id: f11932019ab6ccbab7e65db5919e0c64dcaf37ed
2020-08-03 10:45:14 -07:00
Samuel Susla f838c7e5c3 Fabric: Asserts in RCTRuntimeExecutorFromBridge
Summary:
The implementation of RuntimeExecutor must execute all provided callbacks. However, the implementation has some branches that lead to such cases. To understand if this happens and when we need to add some asserts.

Changelog: [Internal] Fabric-specific internal change.

Differential Revision: D22810440

fbshipit-source-id: 7c29b765045b644fe0ad9d56b4c253dfe9395c31
2020-08-03 10:45:14 -07:00
Samuel Susla c452b826df Implement ScrollView.snapToOffsets and associated props
Summary:
Changelog: [Internal]
Implementation is copied from Paper.

Reviewed By: shergin

Differential Revision: D22820677

fbshipit-source-id: 8eed7ecd4dc766e8579a89707849e041adb073eb
2020-08-03 07:08:29 -07:00
Samuel Susla 94d0078653 Implement ScrollView.snapToInterval and associated props
Summary:
Changelog: [Internal]

Implementation is copied from Paper.

Reviewed By: shergin

Differential Revision: D22794554

fbshipit-source-id: ccfa777356932d81aa986349fba1685acf65d7f1
2020-08-03 07:08:29 -07:00
Joshua Gross e3302eeeab LayoutAnimations: call onSuccess, onFailure callbacks
Summary:
Hook up onSuccess and onFailure callbacks to LayoutAnimations.

Note that in non-Fabric RN, onSuccess is not known to work in Android. I could not find any uses of onFailure and it's not documented, so for now, it is only called if the setup of the animation fails.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22889352

fbshipit-source-id: 4306debb350388dd2b7a2cbfe295eb99723988e2
2020-08-02 16:37:03 -07:00
David Vacca 3093010ea5 move fabric to ReactCommon/react/renderer
Summary:
This diff moves fabric C++ code from ReactCommon/fabric to ReactCommon/react/renderer
As part of this diff I also refactored components, codegen and callsites on CatalystApp, FB4A and venice

Script: P137350694

changelog: [internal] internal refactor

Reviewed By: fkgozali

Differential Revision: D22852139

fbshipit-source-id: f85310ba858b6afd81abfd9cbe6d70b28eca7415
2020-07-31 13:34:29 -07:00
Peter Argany 00bc73f625 Fix misleading comment in RCTFabricSurface API
Summary:
Using RCTFabricSurface in bridgeless mode, this comment seems incorrect to me.

`[_surface start]`  needs to be called after initialization, or else the stage and `SurfacePresenter` registration never happen.

Maybe this comment used to be true, but it is misleading with the current implementation.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22800934

fbshipit-source-id: c396cbd3fc1749b8e7ab571c9e7bc05cd352fc14
2020-07-28 14:41:26 -07:00
Jiayan Zhuang 3c52942506 Write tests to cover additional features in RCTParagraphComponentView
Summary:
Changelog:
[Internal] - Add additional tests to cover other features in RCTParagraphComponentView.

I mainly test the correctness of attributedString and fragments in the RCTParagraphComponentView.

Reviewed By: shergin

Differential Revision: D22668022

fbshipit-source-id: 6879eb6b6a6ace9e6e05f1486d4e4034ebfd73bc
2020-07-27 16:05:53 -07:00
Jiayan Zhuang 894b3aa389 Build the basic RCTParagraphComponentViewTests
Summary:
Changelog:
[Internal] - Build the basic RCTParagraphComponentViewTests. Add the content of tests.
I mainly test the cases of text with multiple links inside, text with link which crosses multiple lines and truncated text with link.

Reviewed By: shergin

Differential Revision: D22607097

fbshipit-source-id: c98b8d4c5424a3e51e2869f50bc5038f969e45e8
2020-07-27 15:37:31 -07:00
Jiayan Zhuang c03a6aba49 Setup the ShadowNode tree for RCTParagraphComponentViewTests (#29470)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/29470

Changelog:
[Internal] - Build the framework of the RCTParagraphComponentViewTests and do some setup.

I built a shadowNode tree here for future tests.

Reviewed By: shergin

Differential Revision: D22536626

fbshipit-source-id: c74b63b3319693b90c9d64b7f782a1a922b0d499
2020-07-27 15:37:31 -07:00
Valentin Shergin 8d613c6f32 Fabric: Implementation of BackgroundExecutor on iOS (and gating)
Summary:
This is an implementation of `BackgroundExecutor` on iOS.
In case if the experiment is successful, we will make it mandatory for all platforms.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D22743722

fbshipit-source-id: 7756d2947e962720b9970d48c74929ab407c0440
2020-07-24 23:52:48 -07:00
Peter Argany 9d3cefbbca Delete unused RCTAdditionalJavaScriptDidLoadNotification
Summary:
This notification was never used, I'd rather not have someone start relying on it, and need to figure out how to migrate them in bridgeless mode.

Changelog:[Internal]

Reviewed By: cpojer, RSNara

Differential Revision: D22513602

fbshipit-source-id: 80b179af8408abc6646a73380b4a66cade3f75f2
2020-07-23 17:11:32 -07:00
Peter Argany 448db78a88 Fix loading from Metro in Bridgeless mode (#29453)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/29453

Problem Statement: A native module needs to call a function on `ReactInstance` (in this case `loadScript`). Typically, this is handled by the bridge.
Current Bridgeless Solution: Create a new protocol (in this case `RCTJSScriptLoaderModule`) which lets a block be passed in TM init to forward the method call to `ReactInstance`. This is the best thing I could think of right now.

Changelog:[Internal]

Reviewed By: RSNara

Differential Revision: D22512748

fbshipit-source-id: e6559279b6e299e17d1199407129ad3902c41e6b
2020-07-23 17:11:32 -07:00
Peter Argany 91d16bbd9f Hardcode @available(iOS 10) to YES
Summary:
RN removed support for iOS 9 last year, therefore iOS10+ is always available.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D22655069

fbshipit-source-id: 77e85e0403ea7ea0febc8766c10bb6f94ea417ad
2020-07-22 11:00:32 -07:00
Jimmy Zhang bbb7bef539 Remove unnecessary packager running check when saved JSLocation is empty
Summary:
Changelog:
When the JSLocation is nil, checking whether the address is running is unnesarry and wasting time, adding a JSLocation length check to mitigate that.

Reviewed By: cpojer

Differential Revision: D22644574

fbshipit-source-id: c51fc1a8976ebc25cba2653581e1bfa479a1d70d
2020-07-21 09:55:11 -07:00
Valentin Shergin ec60ebe792 Introducing `YGPositionTypeStatic`
Summary:
Changelog: [Internal] Fabric-specific internal change.
This diff introduces a new value for `YGPositionType`: `YGPositionTypeStatic`.
No part of Yoga, RN, Litho or CK uses this value yet. `relative` and `static` values behave the same way for now. We also do not change any defaults. So, it should be fine.

Reviewed By: SidharthGuglani

Differential Revision: D22386732

fbshipit-source-id: 39cd9e818458ac2a91efb175f24a74c8c303ff08
2020-07-20 00:33:22 -07:00
Jiayan Zhuang 5ac524bdbc Add a condition to exclude accessibilityRole that not currently used
Summary:
Changelog:
[Internal] - Add an condition to exclude accessibilityRole that not currently used

Since I've added all the possible values in accessibilityRole enum, it is necessary to gate what needs to be an accessibilityElement. SO I add a condition to exclude accessibilityRole that not currently used.

Reviewed By: shergin

Differential Revision: D22559136

fbshipit-source-id: 910d59132984872b5a9816b8e390117b7b1e2e71
2020-07-16 08:34:31 -07:00
Valentin Shergin 9f699ae185 Fabric: Using TelemetryController in RCTMountingManager on iOS
Summary:
Here we use `TelemetryController` to instrument mounting transactions in RCTMoutingManagers and wire that with RCTMountingTransactionObserving protocol. Now, performance trackers (flags) that we use can obtain this information and report to some server-side infrastructure. (Which will be implemented in future diffs.)

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D22490581

fbshipit-source-id: 37695560437ae0e27845c3bda2030fe6fa4c6735
2020-07-15 23:30:33 -07:00
Jiayan Zhuang 4320359686 Reword the guide words
Summary:
Changelog:
[Internal] - Reword the guide words to make it more generic.

Considering the case that some languages are RTL so swiping right cannot guarantee to move to the link. iOS can handle the order of the words and accessibilityElements according to the language. But the accessibilityHint we hardcoded would be an issue. So we decided to reword it to be more generic.

Reviewed By: PeteTheHeat

Differential Revision: D22422498

fbshipit-source-id: 175711317961663d0b0b47e04d2ab600f63446fe
2020-07-14 11:24:32 -07:00
Jiayan Zhuang 8c602e271e Solve truncation attributed string case
Summary:
Changelog:
[Internal] - Add a `accessibilityHint` to the first accessibilityElement so that it will tell user double tap to expand or truncate the text after reading the whole text. Also add the `accessibilityRole` in `FBTextWithEntities` when shouldTruncated is true, which allow us to specially distinguish the shouldTruncated text.

Reviewed By: sammy-SC

Differential Revision: D22339875

fbshipit-source-id: ce22fe9d86eeba5a2750022acd2cdd2c06a1dc79
2020-07-14 09:55:32 -07:00
Ramanpreet Nara e549f6984e Gate TurboModule eager initialization
Summary:
TurboModule eager initialization is a bit dangerous if we get it wrong, which we did (twice): T69449176.

This diff gates TurboModule eager init behind a MC, so that we can control (i.e: turn off/on, and do gradually rollout of) TurobModule eager initialization in isolation from the larger TurboModules experiment.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22460359

fbshipit-source-id: 3b8dce0529f1739bd68b8b16d6a28aa572d82c2c
2020-07-09 16:24:31 -07:00
Ramanpreet Nara a27c295f53 Rename RCTTurboModuleLookupDelegate to RCTTurboModuleRegistry
Summary:
## Why?
1. RCTTurboModuleLookupDelegate sounds a bit nebulous.
2. In JS and Java, we use a `TurboModuleRegistry` interface to require TurboModules. So, this diff will make JS, Java, and ObjC consistent.

Changelog:
[Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22405754

fbshipit-source-id: 30c85c246b39d198c5b8c6ca4432a3196ca0ebfd
2020-07-07 16:25:11 -07:00
Ramanpreet Nara 103c863eaa Eagerly initialize TurboModules before executing JS bundle
Summary:
## Context
1. In FBReactModule jsExecutorForBridge, we asynchronously initialize a list of TurboModules on the main queue: https://fburl.com/diffusion/i56wi3px
2. After initializing the bridge, we start executing the JS bundle, here: e23e9328aa/React/CxxBridge/RCTCxxBridge.mm (L414-L417). Since bridge initialization knows nothing about TurboModule eager initialization, this happens concurrently with 1, and starts requiring NativeModules/TurboModules on the JS thread.

## The Race
1. Both the main thread and the JS thread race to create a TurboModule that requires main queue setup.
2. The JS thread wins, and starts creating the TurboModule. Meanwhile, the main thread blocks, waiting on a signal here, in RCTTurboModuleManager: e23e9328aa/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm (L430)
3. The JS thread tries to dispatch_sync to the main queue to setup the TurboModule because the TurboModule requires main queue setup, here: e23e9328aa/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm (L402)
4. We deadlock.

## The fix
Succinctly, NativeModule eager initialization finishes before execute the JS bundle, but TurboModule initialization doesn't. This diff corrects that mistake.

The changes in this diff:
1. The RN application via the TurboModuleManager delegate can now optionally provide the names of all eagerly initialized TurboModules by implementing two methods `getEagerInitModuleNames`, `getEagerInitMainQueueModuleNames`.
2. The TurboModuleManager grabs these two lists from the delegate, and exposes them to its owner via the `RCTTurboModuleRegistry` protocol.
3. The RCTCxxBridge, which already owns a `id<RCTTurboModuleRegistry>` object, uses it to eagerly initialize the TurboModules in these two lists with the correct timing requirements.

This is exactly how we implement eager initialization in Android.

**Note:** Right now, phase one and two of TurboModule eager initialization happen after phase one and two of NativeModule eager initialization. We could make the timing even more correct by initializing the TurboModules at the exact same time we initialize the NativeModules. However, that would require a bit more surgery on the bridge, and the bridge delegate. I think this is good enough for now.

Changelog:
[iOS][Fixed] - Fix TurboModule eager init race

Reviewed By: PeteTheHeat

Differential Revision: D22406171

fbshipit-source-id: 4715be0bceb478a8e4aa206180c0316eaaf287e8
2020-07-07 16:25:10 -07:00
Ramanpreet Nara 5c24746a48 Correct JSRequireEnding marker start in RCTModuleData gatherConstants
Summary:
`RCTModuleData gatherConstants` is [used by `RCTModuleData exportedConstants` to compute and return the constants exported to JS](https://fburl.com/diffusion/ssg4jbeu). However, `RCTModuleData gatherConstants` is also [used by `RCTCxxBridge` to pre-compute NativeModule constants during bridge startup](https://fburl.com/diffusion/nfmjc1ke). Therefore, since `RCTModuleData gatherConstants` can be used outside the context of a JS require, we cannot start the JSRequireEnding marker inside `RCTModuleData gatherConstants` directly.

This diff moves the body of `RCTModuleData gatherConstants` into `gatherConstantsAndSignalJSRequireEnding:(BOOL)startMarkers`:
 - `RCTModuleData gatherConstants` calls `RCTModuleData gatherConstantsAndSignalJSRequireEnding:NO`
 - `RCTModuleData exportedConstants` calls `RCTModuleData gatherConstantsAndSignalJSRequireEnding:YES`. **Note:** This is okay, because `RCTModuleData exportedConstants` is only called inside `RCTNativeModule::getConstants()`.

This should make sure that we don't start the JSRequireEnding marker outside of a JS require.

Reviewed By: PeteTheHeat

Differential Revision: D22371889

fbshipit-source-id: de17b857259572fb0f840a22072a16b5e465cabd
2020-07-07 15:33:49 -07:00
Valentin Shergin f2fdc1a5df Fabric: Simplifying RCTPerformMountInstructions
Summary:
This diff inlines all mount-instruction functions into a single one - RCTPerformMountInstructions.
The main purpose is to reduce the number of calls to `RCTComponentViewRegistry` for some instructions. E.g., before the change, the `Insert` (or `Update`) instruction had seven identical calls to the registry. That's not a huge deal but there is no need to pay for it either. Maybe it can save us a couple of milliseconds during TTI.

The code of those functions is quite straight-forward, so this change probably even improves readability.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22402987

fbshipit-source-id: 043a4114ba42622e9ed226f4d5e41ed45c1b066c
2020-07-07 12:01:56 -07:00
Jiayan Zhuang ac0f4b42c5 Add additional accessibilityElements for embedded links
Summary:
Changelog:
[Internal] - Add the additional accessibilityElement for embedded links

Reviewed By: sammy-SC

Differential Revision: D22296547

fbshipit-source-id: 286cd3cb19d288d584ecd94a8201a28851ca042f
2020-07-06 15:00:58 -07:00
Jiayan Zhuang 10a800da25 Complete the basic RCTParagraphComponentAccessibilityProvider
Summary:
Changelog:
[Internal] - add the first accessibilityElement

Reviewed By: shergin

Differential Revision: D22249310

fbshipit-source-id: e0f1920377eb9d7a22737cf7437b1c5bd7195c5d
2020-07-06 15:00:58 -07:00
Jimmy Zhang 3d882495d5 Check whether packager is running in RCTBundleURLProvider for saved JSLocation
Summary:
Changelog:
Adding packager running check when RCTBundleURLProvider is returning JSLocation, this prevents an invalid address from being returned which might cause various issues.

Reviewed By: cpojer

Differential Revision: D22390156

fbshipit-source-id: a20dbf63103158a34cbf6dc0ae8349b2f9e5b0a8
2020-07-06 09:08:44 -07:00
Valentin Shergin 4716d2282e Fabric: Fixes in computing visible frame in `RCTScrollViewComponentView`
Summary:
This refined algorithm now takes a zoom/scale into account and deals with `contentInset` properly.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22382482

fbshipit-source-id: 7e9d34d3bababf68e624c045c308957e7e5c9d84
2020-07-04 15:25:43 -07:00
Samuel Susla 42c8dead62 Restore contentOffset from state if necesarry
Summary:
Changelog: [Internal]

When JS Inspector is activated, ScrollView is unmounted and then mounted again with same state.

 ScrollView's content offset was being set to 0 inside `[RCTScrollViewComponentView prepareForRecycle]` during unmount but when it is mounted again, we ignored value inside state.

Reviewed By: shergin

Differential Revision: D22333125

fbshipit-source-id: f232dc95b695605f4819f29d8e0bf14b2f3e9150
2020-07-03 11:15:26 -07:00
Christoph Nakazawa 6d6c68c2c6 "The Metro Server" -> Metro
Summary:
Pet Peeve: Metro is a brand name. You don't say "the Metro server" just like you don't say "the iPhone phone". This is a leftover from when it used to be called "the packager server".

Note: It makes sense to refer to "the Metro server" when talking about it in the context of Metro's features, like if you are discussing "Metro's bundling" and "Metro's server". However, when talking about the tool itself, just Metro is enough.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22330966

fbshipit-source-id: 667618363c641884df543d88cac65d1e44956ad3
2020-07-02 14:51:18 -07:00
Jiayan Zhuang ffa07254de Build the framework for RCTParagraphComponentAccessibilityProvider
Summary:
Changelog:
[iOS][Added] - This is the first step to build RCTParagraphComponentAccessibilityProvider.  The main idea of RCTParagraphComponentAccessibilityProvider is to provide an array of accessible elements for the AttributedString in PCTParagraphComponentView.

Reviewed By: sammy-SC

Differential Revision: D22214855

fbshipit-source-id: 69d47555e86452620f89a4b2e21ed6065c8e669c
2020-07-02 08:55:39 -07:00
Valentin Shergin 26d8d41735 Fabric: More asserts in iOS mounting infra
Summary:
The change contains a bunch of additional asserts that verify some assumptions on which mounting relies on. Working on the previous diffs I realized that it's very easy to broke those and then spend hours trying to understand what exactly went wrong.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22324087

fbshipit-source-id: 1152c40248885d02bde62a493a574868c3732273
2020-07-01 20:37:49 -07:00
Valentin Shergin 8320ad37f2 Fabric: Using `overflowInset` in on-demain view mounting in <ScrollView>
Summary:
Now we can use `overflowInset` to check if the view's descendants overflow.

```
  ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
   A cell w/o overflow content
  │                           │

  └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
  ┌───────────────────────────┐                 ┌───────────────────────────┐
  │A cell w/ overflow content │                 │A cell w/ overflow content │
  │             ┌───────────┐ │   <━━━━━━━━━>   │             ┌───────────┐ │
  │             │A thing    │ │                 │             │A thing    │ │
  └─────────────┤that       ├─┘                 └─────────────┤that       ├─┘
  ┌ ─ ─ ─ ─ ─ ─ ┤overflows  ├ ┐                 Inset ********│overflows  │**
                │ended up   │                   Overflow******│ended up   │**
  │             │being      │ │                 **************│being      │**
                │visible.   │                   **************│visible.   │**
  └ ─ ─ ─ ─ ─ ─ ┤           ├ ┘                 **************│           │**
  ┌─────────────┤           ├─┐                 **************│           │**
  │             │           │ │                 **************│           │**
  │             │           │ │                 **************│           │**
╔═│             │           │ │═╗             ╔═**************│           │**═╗
║ └─────────────┤           ├─┘ ║             ║ **************│           │** ║
║ ┌─────────────┤           ├─┐ ║             ║ **************│           │** ║
║ │             │           │ │ ║             ║ **************│           │** ║
║ │             │           │ │ ║             ║ **************│           │** ║
║ │             └───────────┘ │ ║             ║ **************└───────────┘** ║
║ └───────────────────────────┘ ║             ║                               ║
║ ┌───────────────────────────┐ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ └───────────────────────────┘ ║             ║                               ║
║ ┌───────────────────────────┐ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ └───────────────────────────┘ ║             ║                               ║
║ ┌───────────────────────────┐ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ └───────────────────────────┘ ║             ║                               ║
║ ┌───────────────────────────┐ ║             ║                               ║
║ │                           │ ║             ║                               ║
║ │                           │ ║             ║                               ║
╚═│                           │═╝             ╚═══════════════════════════════╝
  └───────────────────────────┘
  ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐

  │                           │

  └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
  ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐

  │                           │

  └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
```

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22325808

fbshipit-source-id: e80ae196fc9158358a67c6706b0a2ddec6d47ee9
2020-07-01 18:25:14 -07:00
Valentin Shergin e223f2c2bf Fabric: Gating for on-demand view mounting in ScrollView
Summary:
Just gating.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22325692

fbshipit-source-id: 14cdfb4bf10ad00e090a91659138639360020fca
2020-07-01 18:25:14 -07:00