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

20042 Коммитов

Автор SHA1 Сообщение Дата
generatedunixname89002005287564 673cbb3110 Daily `arc lint --take GOOGLEJAVAFORMAT`
Reviewed By: zertosh

Differential Revision: D21325542

fbshipit-source-id: d4c70da59c67c1f7dfcd36f06bbfe0eec5d4e824
2020-04-30 08:20:05 -07:00
James Ide d20ac69fc8 Replace duplicate code in AndroidInfoModule with call to AndroidInfoHelpers (#28756)
Summary:
The AndroidInfoModule class defines a `getServerHost()` method that duplicates the logic in `AndroidInfoHelpers.getServerHost(context)`. This commit makes AndroidInfoModule call into AndroidInfoHelpers so that potential future changes to `AndroidInfoHelpers.getServerHost` don't need to be duplicated in `AndroidInfoModule.getServerHost`.

## Changelog

[Android] [Changed] - Internal change to make `PlatformConstants` use the same method to determine `ServerHost` as other code paths
Pull Request resolved: https://github.com/facebook/react-native/pull/28756

Test Plan: Tested by running the RNTester app and editing the root component to print out `NativeModules.PlatformConstants.getConstants()` and verified one of the properties was: `"ServerHost": "10.0.2.2:8081"`.

Differential Revision: D21252158

Pulled By: shergin

fbshipit-source-id: b460197e5f1d972a5b91991c32a929294e358d9f
2020-04-29 22:32:28 -07:00
Valentin Shergin f746119d62 Fabric: Gating for new state reconciliation
Summary:
The change is gated by two QEs (iOS and Android).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21317797

fbshipit-source-id: 34bfd9546600d9cb3467bddfc61363a16683f81f
2020-04-29 20:56:23 -07:00
Valentin Shergin afc3c97111 Fabric: Changes in State reconciliation
Summary:
I spent the last several days thinking about state reconciliation issues, some crashes (T65586949) that suspiciously happen somewhere inside, and a bunch of issues that might be connected to that (possibly, some of T65516263 sub-task).

I cannot see some obvious problems in the current state reconciliation algorithm that might cause the crash (because of some use-after-free or other pure C++ issues), but I suspect some of the problems we experience might be caused by some details of how we reconcile states.

In the current approach, we rank all states based on the "hierarchical" history of their creation (state version is being calculated based on the version of the base tree). That's usually fine but in some cases when trees are being constructed concurrently, a logical version of a based tree does not correspond to the local version of a committed tree. In other words, the linear history of commits does not always correspond to the "hierarchical" history of trees generation that was done by different parties (e.g. React vs native state update pipeline).

In this diff, I tried to change the approach to change the algorithm to follow this logic: If some state is `obsolete` (already been committed and then replaced with newer one), we replace that with the most recent one. This change does not introduce the `obsolete` flag; is already used by State infra to avoid cloning nodes with an outdated state.

Interestingly, it fixes the issue with an empty BottomSheet on Android (T66177144). See the attached video. The hope is that it's also will

This change theoretically might affect all things that use State, so it hard to predict what can break and how. So, if we don't see obvious problems here, I would set up a GK/QE and run the experiment in prod.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21295137

fbshipit-source-id: e5613218d3e11a56623cab9bbf2540495b2b24e8
2020-04-29 20:56:22 -07:00
David Vacca f7e88387fb Enable Animated in Venice
Summary:
This diff extends venice app to render an Animation example test

changelog: [Internal][Android] Internal change to enable Animated in RN Bridgless mode

Reviewed By: PeteTheHeat

Differential Revision: D21317630

fbshipit-source-id: 9726fea9baba86191e63df909639d1d47ef5f359
2020-04-29 19:32:48 -07:00
Ramanpreet Nara 7566bb4b81 Delete .clang-tidy for jscallinvoker
Summary:
`JSCallInvoker` doesn't exist anymore, because it was renamed to `CallInvoker`. So, this `.clang-tidy` dotfile isn't necessary.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D21318061

fbshipit-source-id: 8098eef670cae35bf3c027c91f18f45eb7bcd33a
2020-04-29 18:49:08 -07:00
Your Name d8e6c45782 Move DevSettingsActivity from main to debug (#28770)
Summary:
As described in DevSettingsActivity, it should be added to the apps
debug/ instead of main/ manifest.

## Changelog
Android Changed - Move DevSettingsActivity from `main` to `debug` manifest
Pull Request resolved: https://github.com/facebook/react-native/pull/28770

Test Plan: Tested locally by building example app

Differential Revision: D21281922

Pulled By: shergin

fbshipit-source-id: ec4dc7c0ac54367aa38cca5b4146ef71cf18b73b
2020-04-29 12:27:14 -07:00
David Vacca d7299e8f76 cleanup unused TODO
Summary:
Task is closed, I'm removing the TODO. I verified that the soft error is not being triggered

changelog:[Internal][Android] Internal cleanup of fabric android

Reviewed By: sammy-SC

Differential Revision: D21303999

fbshipit-source-id: 11d4a14c71d27ffc70a6d3b955a21085dd11859b
2020-04-29 10:48:29 -07:00
Rick Hanlon e27542bb13 Don't allow download percentage to exceed expectations
Summary:
This diff updates the loading banner to protect against showing percentages over 100%

Changelog: [Fixed] [iOS] Cap loading bar percentage at 100%

Reviewed By: shergin

Differential Revision: D21295809

fbshipit-source-id: 343f53acafa126800367444562730eff4ae67af4
2020-04-29 09:28:38 -07:00
Ramanpreet Nara 97bc0845ec Guard all debug logs behind an MC
Reviewed By: PeteTheHeat

Differential Revision: D21292280

fbshipit-source-id: 1701a945f126f35a53417b57e3162372d39e75f1
2020-04-29 09:17:17 -07:00
Rick Hanlon 3fb37b4326 Speed up loading banner animations
Summary:
This diff reduces the minimum loading banner time and animation time to make the locating banner faster.

Changelog: [General] [iOS] Speed up loading banner animations

Reviewed By: PeteTheHeat

Differential Revision: D21290517

fbshipit-source-id: 111dff41df53b0246548e1da1db80c2188498a9c
2020-04-28 23:20:18 -07:00
Rick Hanlon 2b771b0129 Delay loading banner inital message by 200ms to prevent flashing
Summary:
This diff fixes an issue where the initial "Loading from Metro..." message is flashed for a few milliseconds before the download progress kicks in. It's just jarring enough to be noticed and is ~600ms too fast to be read.

This diff adds a delay so that if the loading progress starts within 200ms we go straight to the progress.

Changelog: [Fixed] [iOS] Delay loading banner message to prevent flashing messages

Reviewed By: PeteTheHeat

Differential Revision: D21281870

fbshipit-source-id: d28c1eae01c2ac9d79f356f1870f17dbb22a9d84
2020-04-28 23:20:17 -07:00
Rick Hanlon 131c497aa2 Do not update loading banner message while hiding
Summary:
This diff fixes an issue where the loading banner message could update while the banner hide animation is going, catching your eye for no reason.

Changelog: [Fixed] [iOS] Do not update loading banner message while hiding

Reviewed By: PeteTheHeat

Differential Revision: D21280786

fbshipit-source-id: a10b33cd72f263d08eea6d8e94963514affbe24d
2020-04-28 23:20:17 -07:00
Rick Hanlon 3729fe8de0 Update loading banner text and colors
Summary:
This diff updates the loading banner text and color on iOS for better UX.

Flow before:
- Loading from localhost:8081...
- Loading 20% (1000/5000)...
- Downloading JavaScript Bundle 20% (10/50)
- Downloading JavaScript Bundle...

After:
- Loading from Metro...
- Bundling 20%...
- Downloading 20%...
- Downloading...

Changelog: [Added] [iOS] Updated loading banner messages and color

Reviewed By: PeteTheHeat

Differential Revision: D21279939

fbshipit-source-id: fd7d90f85e25ce175a87087dfccf2180d49e3e98
2020-04-28 23:20:17 -07:00
Rick Hanlon 96999339b6 Add hostname to loading banner on iOS
Summary:
This diff adds a hostname to the loading banner on iOS so it's clear which server you're loading from.

Changelog: [Added] [iOS] Added hostname to loading banner.

Reviewed By: PeteTheHeat

Differential Revision: D21280252

fbshipit-source-id: d7733c056f5fb63e32b247a4fa1476ab42c7da17
2020-04-28 23:20:16 -07:00
David Vacca e9f29a3291 Reject promise when if an error occurs while processing prefetching result
Summary:
This diff rejects the promise when if an error occurs while processing prefetching result, it applies the same concept as other methods in this class (e.g. see getSizeWithHeaders)

changelog: [internal][Android] Internal change in RN Image prefetching

Reviewed By: JoshuaGross

Differential Revision: D21295612

fbshipit-source-id: c3675e5f2d9c8e38094a538b388ff63a6ea18360
2020-04-28 21:47:01 -07:00
Daiki Ihara 78d2b3c813 refine invariant error message at scrollToIndex (#28464)
Summary:
I refined the error message of scrollToIndex.

When I used scrollToIndex with `index:0` and data that length is 0, I met the odd error message `Invariant Violation scrollToIndex out of range: requested index 0 but maximum is -1`.

Next, I thought that scrollToIndex with `index:-1` meant scrollToTop without checking data length. I met `Invariant Violation: scrollToIndex out of range: requested index -1 but maximum is -1`

Finally, I wondered what will happen to use scrollToIndex with `index:-1` and data that length is `5`. The result is `Invariant Violation: scrollToIndex out of range: requested index -1 but maximum is 5`

The above error messages will confuse us. I clarified the boudaries and separated the error messages

## Changelog

[General] [Fixed] - Clarified the boundaries in error message of scrollToIndex
Pull Request resolved: https://github.com/facebook/react-native/pull/28464

Test Plan:
I added 3 test cases to cover the new error messages for VirtualizedList.
Run `yarn test` and confirm it passes.

Reviewed By: cpojer

Differential Revision: D21140133

Pulled By: TheSavior

fbshipit-source-id: 9a7a704f7ec599d833d2ed3ca2be059d950539b5
2020-04-28 19:15:05 -07:00
Emily Janzer 23d6b8d4c0 Create JRuntimeExecutor (#28779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28779

Creating a JNI wrapper class for RuntimeExecutor so we can pass it to Fabric and TurboModules in Java.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21049385

fbshipit-source-id: f833004225d9837acf6ffafd3988f89748cf12aa
2020-04-28 17:56:44 -07:00
Ramanpreet Nara e171c2b92a Fix cleanup bug
Summary:
When I initially made TurboModuleManager.getModule thread-safe, I unintentionally broken TurboModule cleanup. This diff fixes that mistake.

## Mistake
```
  Override
  public void onCatalystInstanceDestroy() {
    synchronized (mTurboModuleCleanupLock) {
      mTurboModuleCleanupStarted = true;
    }

    final Set<String> turboModuleNames = new HashSet<>(mTurboModuleHolders.keySet());

    for (final String moduleName : turboModuleNames) {
      // Retrieve the TurboModule, possibly waiting for it to finish instantiating.
      final TurboModule turboModule = getModule(moduleName); // ERROR!

      if (turboModule != null) {
        // TODO(T48014458): Rename this to invalidate()
        ((NativeModule) turboModule).onCatalystInstanceDestroy();
      }
    }

```

Before calling `getModule(moduleName)`, I set `mTurboModuleCleanupStarted = true`. This assignment makes all calls to `getModule` return `null`, which means that none of the TurboModules were having their `onCatalystInstanceDestroy()` method invoked.

Changelog:
[Android][Fixed] - TurboModule cleanup

Reviewed By: fkgozali

Differential Revision: D21290582

fbshipit-source-id: 3645b9a4f8c6f41498ebd9d51f9b5775edf2dbd7
2020-04-28 17:47:31 -07:00
Ramanpreet Nara 00b3cbfa97 Fix cleanup bug
Summary:
This is the iOS analogue to D21290582.

Changelog:
[iOS][Fixed] - TurboModule cleanup

Reviewed By: fkgozali

Differential Revision: D21290852

fbshipit-source-id: c0975a1f320ad4ad4ef16eec82eca38389c71a0a
2020-04-28 16:57:33 -07:00
Mike Grabowski afdcdc760f Update react.gradle (#28776)
Summary:
Running `./gradlew assembleRelease` fails as the path to the CLI contains a new line at the end. We don't run this command in `debug` mode, hence it passed the testing. My bad.

Fixed, checked in both `debug` with `bundleInDebug: true` and `release`.

Fixes https://github.com/facebook/react-native/issues/28700

## Changelog

[INTERNAL] [ANDROID] - Fix `React.gradle` to build Android apps in production
Pull Request resolved: https://github.com/facebook/react-native/pull/28776

Test Plan: Running `./gradlew assembleRelease` works

Reviewed By: hramos

Differential Revision: D21287789

Pulled By: TheSavior

fbshipit-source-id: dc3ec8eef7a919b072b562d2bd455e2f704bc083
2020-04-28 14:45:18 -07:00
Jason Safaiyeh 6de9f37d66 Resolve RNTester Xcode warnings (#28676)
Summary:
Resolve RNTester Xcode warnings.

## 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] [iOS] - Resolve RNTester Xcode warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/28676

Test Plan: Building RNTester no longer shows project setting warnings

Differential Revision: D21109702

Pulled By: hramos

fbshipit-source-id: f7552d3a9857ee7415cd96622a0a79797a168698
2020-04-28 14:41:48 -07:00
Ramanpreet Nara 3d20f49aff Back out "Control concurrent calls into TMMDelegate from TMM"
Summary:
Original commit changeset: d22c4abfe87f

This synchronization is redundant. See D21025965.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21283284

fbshipit-source-id: dae737fe08bbc8f60913baa6c6a58228611257ef
2020-04-28 14:33:51 -07:00
Valentin Shergin 79bc7f9fad Revert D20587945: iOS: Fix refreshControl layouting
Differential Revision:
D20587945

Original commit changeset: 94f560b17e36

fbshipit-source-id: e8ec95b2ea8632ef09e132351a1458cf97671206
2020-04-28 13:09:11 -07:00
Ramanpreet Nara 9263eb5d38 Part 2: Make CatalystInstanceImpl.getNativeModule Nullable
Summary:
This is the codemod portion of the parent diff.

I modified all call-sites to `ReactContext.getNativeModule` to do a null check on the returned NativeModule.

Changelog:
[Android][Fixed] - Check if NativeModules returned from CatalystInstanceImpl.getNativeModule are null before using them.

Reviewed By: JoshuaGross

Differential Revision: D21272028

fbshipit-source-id: 6bd16c6bf30605f2dfdf4c481352063712965342
2020-04-28 12:18:17 -07:00
Ramanpreet Nara 1cef72af04 Part 1: Make CatalystInstanceImpl.getNativeModule Nullable
Summary:
## Description
When the TurboModule and the NativeModule systems are alive at the same time, after RN cleanup, if a TurboModule is required, we return `null` from TurboModuleManager. This causes `CatalystInstanceImpl.getNativeModule` to do a lookup on NativeModule registry, which throws an `AssertionError`, because the TurboModule isn't found. Instead of throwing an `AssertionError` from `CatalystInstanceImpl.getNativeModule`, this diff instead has that method return `null` in this particular case.

## Rationale
This should eliminate the crashes we're seeing in T46487253.

## Future action
In the future, we should guard `CatalystInstanceImpl.getNativeModule` with an `if (mDestroyed) return null;` statement. This'll ensure that if NativeModules are required after React Native has started cleanup, they'll be returned as `null`. Right now, we either return the destroyed NativeModule object, or create/initialize the NativeMoulde and return it, which is wrong.

Changelog:
[Android][Changed] - Make CatalystInstance.getNativeModule nullable

Reviewed By: JoshuaGross

Differential Revision: D21272029

fbshipit-source-id: 099ad9ab9fa2146299df4cf7f86ae7a8e526bb15
2020-04-28 12:18:17 -07:00
Mark Lord b2b23a2017 Check en0..en8 when generating ip.txt for iOS debug builds (#28764)
Summary:
When generating ip.txt in an iOS debug build, search en0 through en8 for an IP address rather than only checking en0 and en1.  For example, on my Mac, the IP address I needed to use was on en5 and the IP address actually detected was a private network of one of my Parallels virtual machines (interface vnic0).

## 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] [Fixed] - Search en0 through en8 for the Metro Bundler's IP address when generating iOS debug builds
Pull Request resolved: https://github.com/facebook/react-native/pull/28764

Test Plan: Should make no difference to users for whom react-native-xcode.sh already worked. On a Mac with multiple virtual machines installed, should prevent ip.txt getting the private IP address of a virtual machine.

Differential Revision: D21280671

Pulled By: shergin

fbshipit-source-id: e6fe9c8344146626df96129968981462463201f7
2020-04-28 09:32:55 -07:00
Lulu Wu 423b55b2d7 Move ART Android files to FB internal
Summary:
## Changelog:

[General] [Changed] - Moves ART android files from RN to internal react shell.

Reviewed By: cpojer

Differential Revision: D21261077

fbshipit-source-id: 1d3dc404313192540d64991911e3599e3e86351b
2020-04-28 06:36:32 -07:00
Samuel Susla 81bdeade54 Fix broken touches on all Fabric surfaces
Reviewed By: shergin

Differential Revision: D21261996

fbshipit-source-id: f42c19295ac127eca653631faad0ced4900f4758
2020-04-27 15:15:32 -07:00
Sidharth Guglani fc5a626e38 Fix rounding error using double instead of float
Summary: Changelog: [Internal] [Yoga] Use double instead of float during rounding process to prevent loss of precision.

Reviewed By: mdvacca

Differential Revision: D21227565

fbshipit-source-id: 380b57535a356624cda8dc2017871a4ef3c882d1
2020-04-27 14:41:52 -07:00
yogevbd 702ff6d1cd 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)

Differential Revision: D20587945

Pulled By: shergin

fbshipit-source-id: 94f560b17e367f4ef5e789f40c052396949b51a3
2020-04-27 13:32:32 -07:00
Valentin Shergin 26d3bcae72 Fabric: Increasing threshold for MountingTelemetryTest
Summary:
We neede that to make the test less flaky.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21261487

fbshipit-source-id: afec45e03be10ba071a5ab808ce13f95b5f475e3
2020-04-27 12:57:09 -07:00
Samuel Susla b871979a89 Do not send events for changes coming from JavaScript
Summary:
Changelog: [Internal]

When there is a change coming from javascript, avoid triggering `onChange ` and `onSelectionChange` events since JavaScript already has these changes. This is only necessary for multiline text.

For changes coming through view commands, do not increment `_mostRecentEventCount`.

Reviewed By: shergin

Differential Revision: D21255228

fbshipit-source-id: e972dab0eb3dd21f611ee5c71d755bab593ae9cc
2020-04-27 12:33:44 -07:00
Samuel Susla 027e8f9b16 Send key when onKeyPress event is fired from TextInput
Summary:
Changelog: [Internal]

In `onKeyPress` event, we were not returning `key` property. This diff adds `key` property to `onKeyPress` event and removes other, redundant properties from `onKeyPress` event.

The implementation has been translated from Paper.

Reviewed By: shergin

Differential Revision: D21250411

fbshipit-source-id: f1e31381667acb9dec02d0b33883df8f8f5b2a4b
2020-04-27 12:33:44 -07:00
Emily Janzer 79d5b20ced Move RuntimeExecutor to its own BUCK module (#28730)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28730

Moving RuntimeExecutor out of react/utils and into its own subdir of ReactCommon. I'm doing this because I'm going to be pulling this into CatalystInstance on Android, and I don't want to pull in all the files we don't need there; also, this should hopefully make the OSS NDK stuff easier (this uses the react/utils prefix to export, and I'm not sure if you can include a '/' in a gradle module name?)

Changelog: [Internal]

Reviewed By: shergin, mdvacca

Differential Revision: D21098528

fbshipit-source-id: 9fbd72901ece522b1caec3ec34fafb8f9b327275
2020-04-27 11:39:07 -07:00
Valentin Shergin a4b15a4a88 Fabric: Marking TextInput as a leaf Yoga node
Summary:
TextInput must have `LeafYogaNode` trait to be able contain non-yoga nodes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21252322

fbshipit-source-id: 820f3ae4811cb475550419af501739c57c7164e1
2020-04-27 10:38:06 -07:00
Samuel Susla 5cf327ed83 Blur image in Image component if blurRadius prop is provided
Summary:
Apply `blurRadius` prop once image is loaded.

Changelog: [Internal][iOS]

Reviewed By: mdvacca

Differential Revision: D21227536

fbshipit-source-id: 241aa45f253a06d61e861f6719f14fabf3467b56
2020-04-27 05:32:11 -07:00
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