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

19955 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla e68f9bf768 Calling Paper TextInput setTextAndSelection view command now dirties layout
Summary:
Changelog: [Internal]

Previously `setTextAndSelection` was not dirtying layout. This would cause an issue where `setTextAndSelection` causes layout change. For example calling setTextAndSelection with empty string on a multiline auto expanding text input.

I changed one example in TextInputSharedExamples.js, "Live Re-Write (no spaces allowed) and clear" example is now multiline. This allows to test whether `setTextAndSelection` dirties layout. Enter multiline string to to the example text input and press clear. Observe that the text input shrinks to single line height.

Reviewed By: shergin

Differential Revision: D21182990

fbshipit-source-id: de8501ea0b97012cf4cdf8d5f658649139f92da6
2020-04-27 03:23:34 -07:00
Paige Sun e3e900805b Fix image instrumentation internal lifecycle
Reviewed By: fkgozali

Differential Revision: D20980822

fbshipit-source-id: d0a4a031046509425fbf6662471246ed2ab48a4c
2020-04-27 01:39:49 -07:00
Jakub Kinst b020e7c440 Fix calculating View position within a Window in split-screen mode on Android (#28449)
Summary:
On Android, when using split-screen mode, the Window-relative position of a native View is not calculated properly when the app is running on the right (or bottom) half of the screen. The coordinates are currently calculated only based on View.getLocationOnScreen() with subtracting status bar height. Scenarios, where the window does not fill the entire screen (such as split-screen mode) are not supported.

We need to use a more general solution to subtract the actual position of the window from position of the view within the screen. This PR fixes the issue by subtracting coordinates of the Window retrieved from View.getWindowVisibleDisplayFrame(), which covers all scenarios when Window can be in a different position than the screen (incl. status bar offset).

## Changelog

[Android] [Fixed] - Calculating view position within the window in split-screen mode
Pull Request resolved: https://github.com/facebook/react-native/pull/28449

Test Plan:
1. Run an app in split-screen mode on the right half of the screen
2. Call UIManagerModule.measureInWindow() from JS to fetch a position of a View within a Window
3. Observe the wrong coordinates returned
4. Try the same with the fix

Reviewed By: mdvacca

Differential Revision: D21246297

Pulled By: shergin

fbshipit-source-id: 1f54b1a5d6610be17bf05521200304db2ba263ab
2020-04-26 22:14:33 -07:00
simek dfdbf41cc3 chore: remove tvOS from the e2e CI tests (#28743)
Summary:
Refs https://github.com/facebook/react-native/issues/28706

This small PR removes `tvOS` platform and `HelloWorld-tvOS` references from the e2e CI tests script. Also a small typo in comment has been fixed.

CC: dlowder-salesforce

## Changelog

[Internal] [Removed] - remove tvOS from the e2e CI tests
Pull Request resolved: https://github.com/facebook/react-native/pull/28743

Test Plan: Exec during `node ./scripts/run-ci-e2e-tests.js --ios` was successful.

Differential Revision: D21252185

Pulled By: shergin

fbshipit-source-id: 56981f2c5c3038412e9f37a81084de87e296d7d2
2020-04-26 21:38:16 -07:00
Joshua Gross 8ca5594549 All `measure*` calls should use the latest committed version of a ShadowNode
Summary:
Because of StateReconciliation (?) it is possible, even likely, that eventually the ShadowNode that ReactJS holds onto will not be the latest ShadowNode, and will not contain the latest LayoutMetrics.

This fixes the problem by always resolving the latest committed version of the ShadowNode before measuring it.

Changelog: [Internal] Fabric measure bugfix

Reviewed By: sammy-SC, mdvacca

Differential Revision: D21248472

fbshipit-source-id: a4f034c36d89a91a804f3b4cdf35e7ae748a1b91
2020-04-26 12:28:04 -07:00
Joshua Gross 30cc158a87 ScrollView, HorizontalScrollView: support `null` contentOffset
Summary:
According to the Flow types, `contentOffset` is nullable. Support that.

Changelog: [Internal] Fix to (1) support null contentOffset in ScrollView and HorizontalScrollView, added on Android after the last release. (2) Correctly add support for contentOffset in ScrollView (I missed that when adding it to HorizontalScrollView in the previous diff).

Reviewed By: alsun2001

Differential Revision: D21243028

fbshipit-source-id: ebef9a9054a3e4dd88556739e836b7ece48fda12
2020-04-24 22:11:59 -07:00
Valentin Shergin aad99607de Fabric: Test for State Reconciliation mechanism
Summary:
It's not immediately obvious from the UI/UX when/if this mechanism breaks, so it's good to have a test.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21184718

fbshipit-source-id: 25432a1398cff3ce61f62cf433e3cb73d7a7a93f
2020-04-24 21:39:08 -07:00
Valentin Shergin fef8bc33df Fabric: Added assert in ShadowNode
Summary:
It's not allowed to return nullptr from the callback. The assert ensures it which is helpful during development.

Probably, we should consider using `gsl::not_null<>` here.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21149891

fbshipit-source-id: a5f77b35029f22b499491721036405682f812a38
2020-04-24 21:26:42 -07:00
Marc Horowitz 81734276b9 Allow use of std::tuple<> with decorators directly
Summary:
Previously, a derived class, WithTuple, was used.  This ran
into bugs in MSVC (see https://github.com/microsoft/STL/issues/121).
Instead, use specialization to get the same result using std::tuple
directly.  This avoids the bug, and is a cleaner API.

Changelog: [Internal]

Reviewed By: dulinriley

Differential Revision: D21233677

fbshipit-source-id: 1d75991847164e525b4ba70f65a90627e5f8cd56
2020-04-24 15:42:47 -07:00
simek 2b56011f9c Add Dark Mode support to the App template and NewAppScreen components (#28711)
Summary:
This PR adds support for the dark mode and dynamic theme changing to the default App template and to the related `NewAppScreen` components. Using `useColorScheme` hook forced me to refactor a bit main `App.js` file, but I think those changes are step in the right direction according to way in which React Native is used in larger apps, so new `Section` component has been extracted to reduce code redundancy/repetition inside `App`.

Additional color `darker` has been added to the `Colors` statics from `NewAppScreen` because `dark` was too bright for the Dark Mode backgrounds.

Also main `StoryBoard` on iOS has been updated to use theme based colors instead of static or hardcoded ones. There was also an unused, empty `Label` which I have removed.

~~I'm not so much experienced with Android. If someone could also update Android splash screen (if Android requires such change) it will be nice. I want to look at this later using simulator.~~
> I have updated the Android splash screen and tested this change on the Android emulator.

If you have any comment or corrections feel free to post them out, I would like to put more work into this PR if it's needed. Dark Mode this days is a part of near every OS, so it could be considered as a standard feature. I hope those changes helps people which struggle with the basic theming implementation (+ there is now an example of hook and `children` prop usage in the template).

## Changelog

[Internal] [Added] - Add dark mode support to the default app template
Pull Request resolved: https://github.com/facebook/react-native/pull/28711

Test Plan:
I have tested the App from the template on the iOS device and in Android emulator with RN `0.63.0-rc`.

Screen recording on iOS (demonstarates both modes, both splash screens and transition):
![ezgif-6-e24ee8e839c9](https://user-images.githubusercontent.com/719641/80025923-a04b0300-84e1-11ea-824a-b4363db48892.gif)

Screenshot of iOS app in Dark Mode:
![IMG_6542](https://user-images.githubusercontent.com/719641/79885748-c98f6480-83f7-11ea-8c73-1351a721d5d6.PNG)

Screenshot of iOS app splash screen in Dark Mode:
![IMG_6544](https://user-images.githubusercontent.com/719641/79960431-add29f80-8485-11ea-985c-b39176024ffa.PNG)

Screenshot of Android app in the emulator:
![Screenshot_1587566100](https://user-images.githubusercontent.com/719641/79995454-88f72000-84b7-11ea-810b-dfb70de03c2a.png)

Differential Revision: D21236148

Pulled By: shergin

fbshipit-source-id: 0c8a9534d3a3f8f8099af939243a889ac4df6cda
2020-04-24 14:35:53 -07:00
Keith Melmon fa69356742 Use RTL in RTLExample when Platform != android (#28742)
Summary:
This change upstreams a small change we did in react-native-windows to allow the RTLExample RNTester page to function correctly on Windows.  The change is part of this Pr:
https://github.com/microsoft/react-native-windows/pull/4683
Currently the direction property is gated behind a check for Platform == 'iOS', which means it only works on iOS.  Windows supports direction = 'rtl' so I've chanced this check to Platform != 'android'.

## 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] [Changed] - Changed RTLExample RNTester page to use direction = 'rtl' when Platform is not Android.
Pull Request resolved: https://github.com/facebook/react-native/pull/28742

Test Plan: Confirmed this change works correctly in RNTester on Windows.  Have not confirmed iOS as I don't have Mac hardware.

Differential Revision: D21235579

Pulled By: shergin

fbshipit-source-id: 47ab93c2bcd0dbc8347c6746081ae3c64f88faa5
2020-04-24 14:01:49 -07:00
David Vacca 4ae2de211e Remove unnecessary cast to int in TextInlineView measure functions
Summary:
This diff removes unnecessary (int) casts in the calculation of layout for TextInlineViews

changeLog: [Internal][Android] Internal optimization on the calculation of layout for TextInlineViews

Reviewed By: JoshuaGross

Differential Revision: D21211532

fbshipit-source-id: 920c1f88d042f3e1f6bfd0f560371f7482a62064
2020-04-24 01:14:03 -07:00
Tim Yung 025be8148a RN: Fix Text Layout Ignoring Parent Bounds
Summary:
Fixes text layout so that the parent bounds are correctly respected. This fixes two bugs:

- **Parent width is not respected.** This was caused by the recent change to shrink-wrap text layout.
- **Parent height is not respected.** This has always been a bug.

After this change, Android will behave like iOS.

Changelog:
[Android] [Fixed] - Text layout no longer ignores parent bounds

Reviewed By: mdvacca

Differential Revision: D21199030

fbshipit-source-id: cc072bdcff64167db1f79b7bf965e57a7396cdf4
2020-04-23 19:11:29 -07:00
Joshua Gross ed29ba13f9 Support `contentOffset` property in Android's ScrollView and HorizontalScrollView
Summary:
For a very long time, iOS has supported the `contentOffset` property but Android has not:

https://github.com/facebook/react-native/issues/6849

This property can be used, primarily, to autoscroll the ScrollView to a starting position when it is first rendered, to avoid "jumps" that occur by asynchronously scrolling to a start position.

Changelog: [Android][Changed] ScrollView now supports `contentOffset`

Reviewed By: mdvacca

Differential Revision: D21198236

fbshipit-source-id: 2b0773569ba42120cb1fcf0f3847ca98af2285e7
2020-04-23 15:39:45 -07:00
Joshua Gross bda8aaeec2 Modal: disable view flattening explicitly for the children of Modal, the content wrappers
Summary:
I noticed that in ModalHostShadowNode.java (not used in Fabric), there's an assumption that the Modal will have exactly one child on the native side; this child is explicitly specified in Modal.js.

However, in Fabric, these views are flattened and so the Modal will actually have N children - whatever children the product code passes into the Modal.

In *theory* this should be fine, but might be causing issues. Not sure.

This is an experiment and shouldn't be landed until we verify that (1) this actually matters, (2) that it fixes an issue with Modal on iOS or Android.

Changelog: [Internal] Change to make Fabric consistent with non-Fabric Modal

Reviewed By: mdvacca

Differential Revision: D21191822

fbshipit-source-id: 9d65f346387fd056649d4063d70220f637ba8828
2020-04-23 15:39:45 -07:00
Joshua Gross 17adf549e2 Clean up comments about null state wrappers
Summary:
Updating state with a null wrapper is neither desirable, nor possible. The underlying task was closed, just cleaning up comments.

Changelog: [Internal] comments only

Reviewed By: mdvacca

Differential Revision: D21186545

fbshipit-source-id: d14ddd59d42e8fd91c6e7fd50037311d4e8d0b60
2020-04-23 15:39:45 -07:00
Valentin Shergin 78b1c85747 Fabric: Simplifying Yoga and Fabric integration
Summary:
The integration with Yoga was pretty complex from day one. The first attempt to make it simpler was in D19963353 when we removed a bunch of layers of indirection. This is the second iteration that aimed to simplify the structure of methods and their responsibilities.

The only conceptual change (that I am aware of) in this diff is that now we don't support (imaginary) case where a non-leaf YogaLayoutableShadowNode can have a non-YogaLayoutableShadowNode child. In the previous version, it was a no-op, now it's not supported and an assert will fire.

Alongside with refactoring, this diff implements several helper functions that verify the invariants important for the Concurrent Layout in debug mode.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21198222

fbshipit-source-id: cc085904948056f861562af5bd2571de45a743b9
2020-04-23 15:00:46 -07:00
Jesse Katsumata a903d1b86a BackHandler: specify function return type for handler (#28192)
Summary:
Following the comment https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42618#discussion_r384584159

Modify the flowtype of BackHandler function to have more specific return type.

## Changelog

[General] [Changed] - Changed type of BackHandler to be more specific.
Pull Request resolved: https://github.com/facebook/react-native/pull/28192

Test Plan: No flow error in RNTester

Reviewed By: TheSavior

Differential Revision: D20771113

Pulled By: hramos

fbshipit-source-id: 5ca65e2a2b3f8726b8fb4606473d8fad5b0ce730
2020-04-23 14:13:06 -07:00
Tim Yung 4d9fa4b08e RN: Add `RootTag` to New Commands Codegen
Summary:
Adds support for `RootTag` in the new codegen for Native Component Commands.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21169371

fbshipit-source-id: 3b25433f3328e9c04cfe45bb176fc06d63559f14
2020-04-23 12:41:43 -07:00
Tim Yung 310b0c3af5 RN: Add `RootTag` to New NativeModule Codegen
Summary:
Adds support for `RootTag` in the new codegen for NativeModules/TurboModules.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21160788

fbshipit-source-id: 952189f6e8bc8fde8b403d4c0e77b5d66b3f03e4
2020-04-23 12:41:42 -07:00
Tim Yung 064cb12fe0 RN: Add `RootTag` Codegen Parser Test (and Cleanup)
Summary:
Adds a `RootTag` parser test for the new codegen for NativeModules/TurboModules.

I'm doing this in a prerequisite commit in order to make the diff of the diff clearer when I implement proper support for `RootTag`.

This also fixes some of the minor typos and mistakes that I noticed. I also wanted to land these benign snapshot changes independent of the upcoming behavior changes.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21160792

fbshipit-source-id: 5f29f34035da30d7afa2369dbc19e95954553e88
2020-04-23 12:41:42 -07:00
Tim Yung b8bfc50dd2 RN: Rename `{ => NativeModule}MethodTypeShape` in Codegen
Summary:
Straightforward rename to clarify the purpose of this type.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21160791

fbshipit-source-id: 422d09243edda0660815eb2f0ce51f7e56134983
2020-04-23 12:41:41 -07:00
Tim Yung 1b2bcb180c RN: Rename `{NativePrimitive => ReservedProp}TypeAnnotation` in Codegen
Summary:
Straightforward rename to clarify the purpose of this type.

The current naming made more sense before the codegen also produced code for NativeModules.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21160793

fbshipit-source-id: 6787ef298e32ff1b4d506afd831af96764f5af6f
2020-04-23 12:41:41 -07:00
Tim Yung ab9b212de8 RN: Rename `{ => Event}ObjectPropertyType` in Codegen
Summary:
Straightforward rename to clarify the purpose of this type.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21160790

fbshipit-source-id: eaf5e8c9f51e16134e153a6321857234be1aa338
2020-04-23 12:41:41 -07:00
generatedunixname89002005287564 ca162560af Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D21202121

fbshipit-source-id: 6acb53e6ca941e465b11aeac4215533c16067eed
2020-04-23 06:53:42 -07:00
Jonny Burger a2f8b9c36e Set black as default text color for <TextInput/> on iOS (#28708)
Summary:
This is a follow-up pull request to https://github.com/facebook/react-native/issues/28280 (reviewed by shergin).
This pull request tried to solve the problem of the default color in a TextInput in dark mode on iOS being white instead of black. I got suggested to solve the problem not on the level of RCTTextAttributes, but on the level of RCTUITextField.

Setting `self.textColor = [UIColor black];` in the constructor did not work, because it gets overwritten by nil in `RCTBaseTextInputView.m`. There I implemented the logic that if NSForegroundColorAttributeName color is nil then the color is being set to black. I think the `defaultTextAttributes` property confuses here, because it ends up being the effective text attributes, e.g. if I unconditionally set the default text color to black, it cannot be changed in React Native anymore. So I put the nil check in.

## Changelog

[iOS] [Fixed] - TextInput color has the same default (#000) on iOS whether in light or dark mode
Pull Request resolved: https://github.com/facebook/react-native/pull/28708

Test Plan:
I have manually tested the following:
- The default text color in light mode is black
- The default text color in dark mode is black
- The color can be changed using the `style.color` attribute
- Setting the opacity to 0.5 results in the desired behavior, the whole TextInput becoming half the opacity.
– Setting the `style.color` to rgba(0, 0, 0, 0.5) works as intended, creating a half-opaque text color.

Differential Revision: D21186579

Pulled By: shergin

fbshipit-source-id: ea6405ac6a0243c96677335169b214a2bb9ccc29
2020-04-22 23:43:34 -07:00
Will Holen d06ee3d189 Fix folly::dynamic crash when attaching a debugger to Hermes
Summary:
folly_futures was compiled with and exported -DFOLLY_MOBILE=1, while
folly_json did not. This flag disables fancy F14 data structures for
folly::dynamic in favor of a simple std::unordered_map.

This caused inlined/templated code from modules depending on
folly_futures to disagree with the implementations in folly_json,
leading to a crash.

The only such libraries were libhermes-inspector and (transitively)
libhermes-executor-debug, and these only use folly::dynamic for CDP
serialization, which is why the problem was not more apparent.

Changelog: [Internal] Fix crash when attaching a Hermes debugger

Reviewed By: mhorowitz

Differential Revision: D21193307

fbshipit-source-id: 2b795bb6f4f7f991e2adaacec62d62616117322b
2020-04-22 18:46:09 -07:00
Ramanpreet Nara 2c473e1a38 Overhaul RCTTurboModule creation and initialization
Summary:
## Problems:
In my investigation of T65656635, I realized that the TurboModule system has a number of problems:
- In TurboModules, we use 1 lock to create n TurboModules. We should change this setup to n locks for n TurboModules. This way, two threads creating two different NativeModules don't compete for the same lock. Also, this is how it's done in Android (TurboModules & NativeModules), and iOS (NativeModules).
- In TurboModules, we don't calculate "requires main queue setup" faithfully. In the legacy system, if a NativeModule has a custom `init` method or a custom `constantsToExport` method, it "requires main queue setup" with a warning.
- In TurboModules, we don't create the NativeModule on the main queue, if "requires main queue setup" is true. Instead, the NativeModule is always created on the thread that requires it.
- In TurboModules, we don't perform any concurrency control around `id<RCTTurboModule>` setup. We should.

## What this diff does
In this diff, I fixed all the aforementioned issues by re-implementing `provideRCTTurboModule:`.

**Algorithm Notes:**
- **Gist:** When `n` threads race to create NativeModule `x`, only the first thread creates and sets up `x`. All others are told to wait. Once the creator thread finishes its job, it notifies all other waiting threads, which then wake up and return the newly created NativeModule. This algorithm was initially implemented in NativeModules for Android inside (ModuleHolder.java). I modified and implemented it for TurboModules for Android, and now this diff implements it for TurboModules for iOS.
- The TurboModule cache is replace with a TurboModuleHolder map. A TurboModuleHolder manages the creation lifecycle of a TurboModule, and holds a condition variable and mutex for doing concurrency control around it. When the bridge invalidates, in TurboModuleManager, we set the `invalidating` flag to true, which prevents the insertion of new entries into the TurboModuleHolder map.
- I added a `std::mutex` to serialize calls into the TurboModuleManagerDelegate, so we don't get races if the delegate isn't thread-safe.

Changelog:
[iOS][Fixed] - Re-implement RCTTurboModuleManager provideRCTTurboModule:

Reviewed By: shergin

Differential Revision: D21170099

fbshipit-source-id: 8792812c2237d3bfc80c9834c818e011de85b0ea
2020-04-22 16:13:47 -07:00
Valentin Shergin f64b39ea6c Fabric: Introducting `ShadowNodeFamilyFragment::Value`
Summary:
`ShadowNodeFamilyFragment::Value` is a value couter-part type for `ShadowNodeFamilyFragment`.
We need that to be able safely copy data stored inside a `ShadowNodeFamilyFragment` object.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: kacieb

Differential Revision: D21169580

fbshipit-source-id: 1a485e1b2ae47bc7da9476a60466934ac9d61366
2020-04-22 15:41:56 -07:00
Valentin Shergin 3246eaec44 Fabric: `ConcreteShadowNode::initialStateData()` now accepts a `ShadowNodeFamilyFragment` instead of just a `SurfaceId`
Summary:
We need it to be able pass an `EventEmitter` object to constructed concrete State objects.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21169581

fbshipit-source-id: 3eef0310de7e2f061108aa85c1a39678a43fe85e
2020-04-22 15:41:55 -07:00
Jesse Katsumata df03228a61 remove tvOS from template (#28706)
Summary:
According to the [0.62 blog post](https://reactnative.dev/blog/2020/03/26/version-0.62), Apple TV support has moved to react-native-tvos.
The template still contains info.plist for tvOS, so I've removed them for future releases.

## 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
-->

[General] [Removed] - Removed tvOS related files from the template
Pull Request resolved: https://github.com/facebook/react-native/pull/28706

Test Plan: run `react-native init TestTemplate` and remove tvOS related files and verified that iOS and Android runs on emulator.

Differential Revision: D21182211

Pulled By: hramos

fbshipit-source-id: 41d2e19e5158d7ec103a37c01a93cf511fc1e4c9
2020-04-22 12:26:51 -07:00
generatedunixname89002005287564 bf5f3c6a79 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D21175893

fbshipit-source-id: 101734c1b968ce241a15648efdcaeabbd789952d
2020-04-22 04:45:19 -07:00
Christoph Nakazawa 2ad827be38 Remove outdated metro type definitions
Summary:
RN itself does not depend on Metro any longer, which is abstracted away into the CLI. I don't think we need those type definitions any longer as we have proper Metro definitions internally. I'm removing them because they keep showing up in biggrep when I look for things.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D21089924

fbshipit-source-id: 2845277af12dae0f0baefaf85adefffb6ef9f2a5
2020-04-22 04:06:15 -07:00
Panagiotis Vekris 57fee33898 Flow 0.123.0 in xplat/js
Summary:
Changelog: [Internal]

## Sync of generated files

Ran
```
js1 upgrade www-shared -p core_windowless
```
but had to manually revert
```
RKJSModules/Libraries/www-shared/core_windowless/logging/FBLoggerType.flow.js
RKJSModules/Libraries/www-shared/core_windowless/logging/FBLogger.js
```
because they introduced more errors

## Flow version bump
```
~/fbsource/fbcode/flow/facebook/deploy_xplat.sh 0.123.0
```

Reviewed By: gkz

Differential Revision: D21159821

fbshipit-source-id: e106fcb43e4fc525b9185f8fc8a246e6c3a6b14f
2020-04-21 22:43:24 -07:00
Tim Yung 6aab3f8946 RN: Fix Codegen Schema Buck Dependency (#28719)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28719

The Buck dependencies for the schema rule is missing the source files for the new codegen (and specifically, the parser).

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D21162993

fbshipit-source-id: 4addb6f257134e245a5d86dd427ee2536ed6d658
2020-04-21 19:15:54 -07:00
Tim Yung 5242ad931b RN: Add `RootTag` Type to TurboModule
Summary:
Adds `RootTag` as a valid type for arguments and return types in TurboModules (on both Android and iOS).

This will enable us to change `RootTag` into an opaque type. There are two compelling reasons to do this:

- JavaScript will no longer be able to safely depend on `RootTag` being a number (which means we can change this in the future).
- Call sites using `unstable_RootTagContext` will can get a `RootTag`, but call sites using the legacy `context.rootTag` will not. This means the opaque type will give us a strategy for migrating away from legacy context and eventually making `unstable_RootTagContext` the only way to access `RootTag`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: RSNara

Differential Revision: D21127170

fbshipit-source-id: baec9d7ad17b2f8c4527f1a84f604fc0d28b97eb
2020-04-21 19:15:54 -07:00
Tim Yung a850d116dc RN: Create `RootTag` Type
Summary:
Creates a `RootTag` type and refactors the `RootTagContext` module a bit.

This creates space for eventually changing `RootTag` into an opaque type that is only created once by `AppContainer`, and only consumed by native abstractions.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D21127173

fbshipit-source-id: 60177a6e5e02d6308e87f76d12a271114f8f8fe0
2020-04-21 19:15:53 -07:00
George Zahariev 0b68f3cf77 Upgrade babel-eslint in xplat/js
Summary:
`babel-eslint` is the parser you can supply to ESLint based off of Babel.

`babel-eslint` 10.1.0 is the newest production version of `babel-eslint`.

There are very few changes between 10.0.1 (the lowest previous version) and 10.1.0. There are only 3 non-version-bump commits: 2 bug fixes and enabling parsing of Flow enums.

The only project that was on a lower version than 10.0.1 was `/xplat/js/RKJSModules/Libraries/Relay/oss/__github__` - test below

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21055850

fbshipit-source-id: bae0d8af5c6d833a4dbb0ad775c8e5e78ead1051
2020-04-21 19:06:05 -07:00
sunnylqm 17f025bc26 Upgrade Flipper to 0.37.0 (#28545)
Summary:
Bump flipper to 0.37 for both iOS and Android

## Changelog

[Android] [Changed] - Upgrade Flipper to 0.37.0
[iOS] [Changed] - Upgrade Flipper to 0.37.0
Pull Request resolved: https://github.com/facebook/react-native/pull/28545

Test Plan: RNTester build pass

Reviewed By: rickhanlonii

Differential Revision: D20930069

Pulled By: hramos

fbshipit-source-id: a7cb719da3e51e6a42d27d5e64bc664398d0d3c5
2020-04-21 17:46:53 -07:00
generatedunixname89002005287564 19658a1a60 Daily `arc lint --take GOOGLEJAVAFORMAT`
Reviewed By: zertosh

Differential Revision: D21154707

fbshipit-source-id: 11956915c265f98e286638b91d66d51545e3a311
2020-04-21 09:23:49 -07:00
Samuel Susla a136b34c35 Flip text alignment in case layout direction is RTL
Summary:
Changelog: [Internal]

Flip text alignment in case layout direction is RTL.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D21130371

fbshipit-source-id: cf56ca052c17a48e321803b0f99f8a4baaa0e67b
2020-04-21 05:42:39 -07:00
David Vacca 05c76be176 Easy diff to document in code how to enable logging of Shadow Tree instrospection
Summary:
Easy diff to document in code how to enable logging of Shadow Tree instrospection

changeLog: [Internal] Internal change used on Fabric

Reviewed By: JoshuaGross

Differential Revision: D21150196

fbshipit-source-id: 8eb23ec3ea1d574b79b09333428ab52c851065dd
2020-04-20 23:31:21 -07:00
David Vacca 8c4efc94e1 Enable Yoga logging in Fabric Debug
Summary:
This diff extends Fabric to support Yoga logging

changeLog: [Internal] Internal changes in Fabric to enable yoga logging

Reviewed By: JoshuaGross

Differential Revision: D21150195

fbshipit-source-id: a2e8308a79a7b422bf9ecc3a65f822b305f02c5d
2020-04-20 23:31:21 -07:00
Joshua Gross 1fdb9ac69c Update Differ test
Summary:
Update differ test so it passes again. Previously to D21111423 (I think) nodes were being incorrectly detected as updated even if they weren't different, so now there are fewer unnecessary Update mutations generated.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21148647

fbshipit-source-id: cab6e3ecd0a457e1ac3155b3468bcc56663dab0b
2020-04-20 23:19:29 -07:00
Tom Underhill 25793eab56 Allow iOS PlatformColor strings to be ObjC or Swift UIColor selectors (#28703)
Summary:
Per discussion in https://github.com/react-native-community/releases/issues/186 the iOS `PlatformColor()` function is documented to use the semantic color names provided by the system.   The referenced HIG documentation itself links to the `UIColor` documentation for semantic colors names.   However, these names differ depending on if you are viewing the new Swift API docs or the Objective C docs.   The current Objective C implementation in react-native assumes Objective C UIColor selector names that are suffixed 'Color'.   But in Swift, Apple provides a Swift Extension on UIColor that makes aliases without the the 'Color' suffix and then makes the original selectors invalid presumably via `NS_UNAVAILABLE_SWIFT`.

Since both selector names are valid depending on if you are using Objective C or Swift, let's make both forms be legal for `PlatformColor()`.   In `RCTConvert.m` there is a dictionary of legal selector names.   The code already supports the ability to have names be aliases of other selectors via a RCTSelector metadata key.   The change adds code to the initialization of the map: it iterates over the keys in the map, which are all ObjC style UIColor selectors, and creates aliases by duplicating the entries, creating key names by stripping off the ObjC "Color" suffix, adds the RCTSelector key referring to the original and then appends these new Swift aliases to the map.

## Changelog

[iOS] [Changed] - Allow iOS PlatformColor strings to be ObjC or Swift UIColor selectors
Pull Request resolved: https://github.com/facebook/react-native/pull/28703

Test Plan:
The PlatformColorExample.js is updated to use the new, shorter Swift selector names.   There are still other examples in the same file and in unit tests that exercise the ObjC selector names.

<img width="492" alt="PlatformColor" src="https://user-images.githubusercontent.com/30053638/79809089-89ab7d00-8324-11ea-8a9d-120b92edeedf.png">

Reviewed By: shergin

Differential Revision: D21147404

Pulled By: TheSavior

fbshipit-source-id: 0273ec855e426b3a7ba97a87645859e05bcd4126
2020-04-20 20:23:04 -07:00
Valentin Shergin d639063499 Fabric: More strict policies to dirty Yoga nodes in YogaLayoutableShadowNode
Summary:
Yoga uses a dirty flag to re-layout nodes. In normal, single-threaded approach the policy for dirtying is simple: if a node was changed, we need to dirty it. In the Concurrent Yoga approach, those rules are not so simple, and it seems we haven't formalized those rules yet.

Investigating some layout issues that we have in Fabric, I tend to believe that we don't dirty as much we should. Hense this change adds mode dirtying.

Reviewed By: JoshuaGross

Differential Revision: D21092815

fbshipit-source-id: 4603c97ccb79efcdf5e6a4cc450ebe61b63effb3
2020-04-20 19:21:08 -07:00
Valentin Shergin 4afb8362ec Fabric: Fixed `getDirtied` vs `isDirty` in `YogaLayoutableShadowNode`
Summary:
This is quite a fateful mistake. `getDirtied()` returns the pointer to a function which is obviously a mistake here; we should use `isDirty()` instead.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21028569

fbshipit-source-id: 95212b31f4e32d51c594d5209f295397af3f1252
2020-04-20 19:21:08 -07:00
Rick Hanlon 77012753e5 Switch isPackagerRunning to a class method.
Summary:
This diff exports `isPackagerRunning` as a class method to be used without and instance.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21094414

fbshipit-source-id: 44becb59e3c08d66e4992c4c1b32d6efcd4fe257
2020-04-20 15:46:09 -07:00
Will Holen 33ccc0a0bc Implement Hermes.setPauseOnLoad
Summary:
This Hermes-specific mode is similar to Debugger.setPauseOnExceptions
and lets the VM know that it should enter a Pause state whenever a new
script is loaded/executed.

The debugger can then take its time to parse the source map and update
any breakpoints, before automatically continuing.

Changelog: [Internal] Implement a Hermes.setPauseOnLoad CDP call

Reviewed By: bestander

Differential Revision: D20754604

fbshipit-source-id: 7f9d0638706c99e9dcb534699b633f658e364909
2020-04-20 14:06:51 -07:00
Will Holen 04bc315eba Add support for generating custom messages
Summary:
Until now we've generated scaffolding entirely based on the official devtools
protocol spec. This diff adds support for defining custom domains in `custom.json`
which will be merged with the upstream protocol JSON definition.

ChangeLog: [Internal] Add support for Hermes-specific CDP messages

Reviewed By: bestander

Differential Revision: D20754605

fbshipit-source-id: a8075f81816a40114d1a3332192c7aa076b17848
2020-04-20 14:06:51 -07:00