Summary:
The bug is described in #22891.
It's possible this might not be the right fix, since the original type comes from the commit introducing the feature (36ad813899). But after making this change custom VoiceOver actions work in my real project and my reduced test project.
Changelog:
----------
[iOS] [Fixed] - Fix supplying an array of custom VoiceOver actions via accessibilityActions prop
Pull Request resolved: https://github.com/facebook/react-native/pull/22892
Differential Revision: D13682727
Pulled By: hramos
fbshipit-source-id: a165af4ba78d2dbeca5bffbf60beb9ba50498f8d
Summary:
Motivation:
----------
As developers want to handle multiple actions on Siri Remote input when using TVEventHandler, it is crucial to differentiate 'swap' and 'tap' events.
Changelog:
----------
[tvOS] [Changed] - 'up', 'down', 'left' and 'right' events are now connected with tapping on edges of remote. New events 'swipeUp', 'swipeDown', 'swipeLeft' and 'swipeRight' added to detect swipes.
Pull Request resolved: https://github.com/facebook/react-native/pull/22916
Differential Revision: D13682705
Pulled By: hramos
fbshipit-source-id: 233ad1cecc04ca4ced75cd00e7fcb65d224ed3ca
Summary: In order to match existing event names we need to remove the `on` prefix.
Reviewed By: mdvacca
Differential Revision: D13666673
fbshipit-source-id: c3e16aae4143ea45f45948e3e9de86fe690062cd
Summary:
Refactoring the codegen buck target from being used just for testing to a way that can be depended on for the real fabric target to replace the existing component code.
After this change, we can build a target for react native to use the codegen to create the native files for Switch. A follow up diff will be necessary to hook this up and actually replace the native files for switch.
Reviewed By: mdvacca
Differential Revision: D13662363
fbshipit-source-id: 599dd9ed9ca24ffb5c5784396f4bee7457d94d6d
Summary: Remove `$Subtype` and `$Supertype` utilities. Replacement was done on a best-effort basis. In many cases it sufficed to replace `$Supertype<T>` and `$Subtype<T>` with `T`, but when this was not possible `any | T` and `any & T` were used instead.
Reviewed By: jbrown215
Differential Revision: D13624765
fbshipit-source-id: 82ee9d43cfc318ed4bd2d84e0f4c5c1d8f488a9c
Summary:
Android App Bundle builds use the packageBundle and bundle tasks instead
of the package and assemble tasks the APK builds use. Because of this,
the resources and js bundles weren't getting copied into the final
artifact. In an App Bundle build, the merged assets must be present
during the buildPreBundle step in order to arrive in the App Bundle.
Pull Request resolved: https://github.com/facebook/react-native/pull/21738
Differential Revision: D13669288
Pulled By: cpojer
fbshipit-source-id: 0e985983f04504b69e447dbc1f3f34cf8f4eb927
Summary:
On iOS platform, RN retains launchOptions dictionary after bridge reload which can lead to unexpected consequences to a developer. The app will receive the same value for `Linking.getInitialURL` during initial launch and during bridge reload. Here's an example from our application. We use deeplinks via custom URL scheme so a user can open the app via link. Also, we reload the bridge when a user signs out. So if a user opens the app via URL, logs out, and a second user logs into the app, the app will behave as though the second user launched the app via the same deeplink. Because reload destroys the JS engine, there's nowhere for our app to remember that it already handled the deeplink activation.
On iOS Linking.getInitialURL() gets URL from the _launchOptions dictionary, so by setting it to nil we prevent retention of initialURL after reload.
This change makes iOS's behavior consistent with Android's. On Android, the launch URL is stored on the `Intent` and reloading the app involves creating a new `Intent`. Consequently, the launch URL is dropped as desired during the reload process.
Pull Request resolved: https://github.com/facebook/react-native/pull/22659
Differential Revision: D13564251
Pulled By: cpojer
fbshipit-source-id: 4c6d81f1775eb3c41b100582436f1c0f1ee6dc36
Summary:
Changelog:
----------
Help reviewers and the release process by writing your own changelog entry. See http://facebook.github.io/react-native/docs/contributing#changelog for an example.
[General] [Deprecated] - Deprecation warning for WebView as it has been extracted from core.
Pull Request resolved: https://github.com/facebook/react-native/pull/22980
Differential Revision: D13664505
Pulled By: hramos
fbshipit-source-id: 0cfc06015e77c52bed9eeebd97c8cbca6eacd8ce
Summary:
The current way the Jest preset work requires the different files to be in `<rootDir>/node_modules/react-native`. This is not necessarily true - especially in monorepoes.
If we instead do `require.resolve`, we do not need to do `rootDir` replacement in Jest.
Having a JS file as preset has been supported since Jest 23.0.0: https://github.com/facebook/jest/pull/6185
Changelog:
----------
[General] [Fixed] - use `require.resolve` in `jest-preset`
Pull Request resolved: https://github.com/facebook/react-native/pull/22972
Differential Revision: D13662758
Pulled By: hramos
fbshipit-source-id: ca79b5b89d9d05c6fe639b0d88619858e8d05da7
Summary:
Purpose
----------
This commit fixes a bug and prepares us for adding support for the `maxContentSizeMultiplier` prop (it's currently only supported on iOS).
Details
----------
Today we don't explicitly track inheritance of text props. Instead we rely on `SpannableStringBuilder` to handle this for us. Consider this example:
```
<Text style={{fontSize: 10}}>
<Text style={{letterSpacing: 5}}>
...
</Text>
</Text>
```
In today's implementation, the inner text doesn't know about `fontSize` (i.e. its `mFontSize` instance variable is `Float.NaN`). But everything works properly because the outer `Text` told `SpannableStringBuilder` to apply the font size across the entire string of text.
However, today's approach breaks down when computing the value to apply to the `SpannableStringBuilder` depends on multiple props. Suppose that RN Android supported the `maxContentSizeMultiplier` prop. Then calculating the font size to apply to the `SpannableStringBuilder` would involve both the `fontSize` prop and the `maxContentSizeMultiplier` prop. If `fontSize` was set on an outer `Text` and `maxContentSizeMultiplier` was set on an inner `Text` then the inner `Text` wouldn't be able to calculate the font size to apply to the `SpannableStringBuilder` because the outer `Text's` `fontSize` prop isn't available to it.
The `TextAttributes` class solves this problem. Every `Text` has a `TextAttributes` instance which stores its text props. During rendering, a child's `TextAttributes` is combined with its parent's and handed down the tree. In this way, during rendering a `Text` has access to the relevant text props from itself and its ancestors.
This design is inspired by the [`RCTTextAttributes`](7197aa026b/Libraries/Text/RCTTextAttributes.m) class from RN iOS.
Bug Fix
----------
This refactoring happens to fix a bug. Today, when setting `fontSize` on nested Text, `allowFontScaling` is always treated as though it is true regardless of the value on the root `Text`. For example, the following snippets should render "hello" identically, Instead, the bottom snippet renders "hello" as though `allowFontScaling` is true.
```
<Text allowFontScaling={false} style={{fontSize: 50}}>hello</Text>
<Text allowFontScaling={false}><Text style={{fontSize: 50}}>hello</Text></Text>
```
(The repro assumes you've increased your device's font setting so that the font size multiplier is not 1.0.)
Introducing the `TextAttributes` class fixed this. It forced us to think about how inheritance should work for `allowFontScaling`. In the new implementation, `Text` components use the value of `allowFontScaling` from the outermost `Text` component. This matches the behavior on iOS (the `allowFontScaling` prop gets ignored on virtual text nodes because it doesn't appear [in this list](3749da1312/Libraries/Text/Text.js (L266-L269)).)
Pull Request resolved: https://github.com/facebook/react-native/pull/22917
Reviewed By: mdvacca
Differential Revision: D13630235
Pulled By: shergin
fbshipit-source-id: e58f458de4fc3cdcbec49c8e0509da51966ef93c
Summary:
This commit moves all the turbo module files for Android to Github.
Note that gradle build is not yet enabled.
Sample Turbo Modules will be added in a later commit.
Other missing features
- Support for `CxxModule`
- Remove usage of folly::dynamic for arguments and result conversion
- Support for Promise return types.
Reviewed By: mdvacca
Differential Revision: D13647438
fbshipit-source-id: 5f1188556d6c64bfa2b2fd2146ac72b0fb456891
Summary: I was reading through the ScrollView code and realized that the documentation was incomplete, and some of the flow types were wrong.
Reviewed By: yungsters
Differential Revision: D13583133
fbshipit-source-id: 11c495681e9671e078e4d2c9df76c25b04558696
Summary: This diff reuses the ViewManager registry between UIManagerModule and Fabric, previously View Managers were being initialized twice (one for each UIManager), increasing Fabric TTI by ~77ms
Reviewed By: shergin
Differential Revision: D13640912
fbshipit-source-id: d7a9591084c66e4a2fc2384b2dae1b7fc5a228d0
Summary:
Changelog:
----------
[General] [added] - Add `templates` to `react-native` package.
We need a `template` to initialize new RN project from `react-native-cli`. We are planning to remove `templates` from `cli` to be always synced with chosen rn version. Issue for that in `react-native-cli` is here: https://github.com/react-native-community/react-native-cli/issues/39 .
cc grabbou cpojer
Pull Request resolved: https://github.com/facebook/react-native/pull/22952
Differential Revision: D13644364
Pulled By: hramos
fbshipit-source-id: d5d7a820ffacb342e1e97d83739987678ff511e9
Summary: When we actually use the codegen we will be passing in a path to a schema. Refactoring the existing buck rules to take a path to a schema instead of a fixture name so it can be reused.
Reviewed By: mdvacca
Differential Revision: D13619358
fbshipit-source-id: 1180d2e80c11b93f3cbdb0f9e848ae37bff199f4
Summary: Bump Android Build Tools to Version 28.0.3, Gradle to 4.10.2, and the Android Gradle Plugin to 3.2.1.
Reviewed By: mdvacca
Differential Revision: D13631120
fbshipit-source-id: 709aa25a7a8e1ff0bfc0a969ba6e7cd92850bc0f
Summary:
@public
Removes all `YG...Count` macros for enums and replaces them with `facebook::yoga::enums::count<YG...>()`.
This removes the need to manually maintain enum counts.
Same as D13597449, working around a defect in clang < 3.9
Reviewed By: amir-shalem
Differential Revision: D13634622
fbshipit-source-id: 344dc70e167b0caf746fe396cedd200f54e52219
Summary: Fixes a bug introduced with the example filtering in D13561744 causing the Camera Roll example to not show any pictures
Reviewed By: JoshuaGross
Differential Revision: D13622124
fbshipit-source-id: a5863dcdd9f89ae1373910f25b38e4a322796dbe
Summary: On Android, the status bar color is not always black by default. The existing code causes the status bar to revert to black once the last `<StatusBar>` component is unmounted from the "stack". This diff reverts the bar background color to what it was before, instead of assuming black.
Reviewed By: yungsters
Differential Revision: D13368136
fbshipit-source-id: ef0154f776607b57bb9400b72d521f5f485b0075
Summary:
In the past (pre D13593314), ALAssetsLibrary camera operations would pop up a permissions dialogue when appropriate and block until the user responded to the dialogue. The calls that we're now using with PHPhotoLibrary immediately return if we don't have permission to access the photo library or haven't asked before, and then asynchronously pop up a permissions dialogue, causing every first photo interaction to fail. Instead we now explicitly check for permissions or request
permissions before any operations.
Reviewed By: PeteTheHeat
Differential Revision: D13620079
fbshipit-source-id: e1befc0ddaec2c1b3334e361f5ae3a3efc5da71d
Summary: The existence of this file was confusing many in open source (5ee27ff755) and is no longer needed internally. Delete this file to remove the fork.
Reviewed By: fkgozali
Differential Revision: D13625760
fbshipit-source-id: 1be1943471b67e914377c24d445568532e378385
Summary: This was added in [this PR](https://github.com/facebook/react-native/pull/22047) with a non strict type
Reviewed By: yungsters
Differential Revision: D13617894
fbshipit-source-id: 849f83203556e2830ac725570c9053503377f4be
Summary: Was getting a lint error for this being in the glob
Reviewed By: rickhanlonii
Differential Revision: D13618406
fbshipit-source-id: cebaff99cf71c6ff949342e8cb9f36853616cf0c
Summary:
@public
Removes all `YG...Count` macros for enums and replaces them with `facebook::yoga::enums::count<YG...>()`.
This removes the need to manually maintain enum counts.
Reviewed By: shergin
Differential Revision: D13597449
fbshipit-source-id: edcee225ada4058e94f3a727246763e3cc45873d
Summary: In D13408886, I landed a PR that broke the `autoFocus` prop. This diff fixes this prop by partially reveting some of the changes in that diff.
Reviewed By: TheSavior
Differential Revision: D13611258
fbshipit-source-id: 225b9b59b2500cfac092f13c273685aaeb599ab0
Summary: Emily removed some magic that required InitializeCore for everything back in Sept/Oct. These tests have been broken for a long time, so it wasn't obvious that they broke.
Reviewed By: ejanzer
Differential Revision: D13601264
fbshipit-source-id: ea6ab7c8891207dad06cd062968d019a236cf8fc
Summary: We are working to remove additional types and eventually define everything at the top level as a public exported type of react-native. I was able to update callsites by just using ViewStyleProp in places that were expecting a prop of just one of these. It is a little bit weaker, but much simpler. If a callsite wants to only take margin, it should just take a margin prop instead of a LayoutStyle prop.
Reviewed By: rickhanlonii
Differential Revision: D13599460
fbshipit-source-id: 12c01bc58baa7f6acf33e0b8aab05dabb79c646b
Summary:
Prior to this change, when you passed text to `TextInput` via the `value` or `defaultValue` props, React Native didn't apply any of the styles in `buildSpannedFromShadowNode` to the text. This is because `spannedFromShadowNode` appends `value` after calling `buildSpannedFromShadowNode`. Many styles worked because their logic is included in both `buildSpannedFromShadowNode` and `ReactTextInputManager`. However, some only appear in `buildSpannedFromShadowNode` such as `textDecorationLine` (it would be good to understand why we need to duplicate styling logic in `buildSpannedFromShadowNode` & `ReactTextInputManager` and to know whether `ReactTextInputManager` should be handling `textDecorationLine`).
Also, this commit improves consistency between iOS and Android if you specify both `value` and children on a `TextInput`. Prior to this, iOS concatenated the strings such that the `value` prop came before the children whereas Android put the children before the `value` prop. Now Android matches iOS's behavior and puts the `value` prop before the children.
These appear to be regressions. The `value` prop used to be appended before calling `buildSpannedFromShadowNode` (this behavior appears to have been changed by accident in 80027ce6db (diff-4f5947f2fe0381c4a6373a30e596b8c3)).
The fix is to append the `value` prop before calling `buildSpannedFromShadowNode`. Additionally, we have to expose a new `start` parameter on `buildSpannedFromShadowNode` so that we can tell it to include the text from the `value` prop in the range that it styles. Without this, the start of the styled text would be immediately after `value` because `value` is appended before calling `buildSpannedFromShadowNode`
Pull Request resolved: https://github.com/facebook/react-native/pull/22461
Reviewed By: mdvacca
Differential Revision: D13282065
Pulled By: shergin
fbshipit-source-id: 4c99094741441cf54cdec0075bfd08ff7d889e66
Summary:
@public
Wraps enum definition in a single macro.
Down the line, this will allow us to add more functionality:
- Replace manual counts with `yoga::enums::count<YG...>()`
- `yoga::enums::max<YG...>()`
- A bitfield implementation with known memory layout using `max<>()`
Reviewed By: SidharthGuglani
Differential Revision: D13597259
fbshipit-source-id: 543a11a53090bedf1474d00328565ed57d059e23
Summary:
The original commit was backed out due to a build failure, which seems to be due to compiler flag misconfiguration. That has been fixed.
Original commit: f2fccbb327
Reviewed By: mdvacca
Differential Revision: D13593075
fbshipit-source-id: f3a65e8bd9830f6ac2ea829020500b4632ee2149
Summary: Replaced all deprecated ALAssets* references to roughly equivalent PHPhoto* references in RCTCameraRoll library. There are still some minor inconsistencies between iOS/Android and documentation that existed prior to this diff that need to be resolved after this.
Reviewed By: fkgozali
Differential Revision: D13593314
fbshipit-source-id: 6d3dc43383e3ad6e3dbe73d4ceceac1ba9261d9d