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

709 Коммитов

Автор SHA1 Сообщение Дата
Michael Bolin 9064c18376 Fix sketchy null checks induced by new formatting in Prettier 2.0
Summary:
Update code to prepare for Prettier 2.0, which will
reformat `a || (b || c)` to `a || b || c`.

Changelog: [Internal] prepare for Prettier 2.0

Reviewed By: kassens

Differential Revision: D20639483

fbshipit-source-id: c2932b1495884684172ba9291d56c546f51711b8
2020-03-25 10:06:24 -07:00
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Ramanpreet Nara 652fa1b8d4 Add a perfLogger argument to getTurboModuleWithJSInvoker:
Summary:
## Purpose
We must modify the `getTurboModuleWithJsInvoker:` method of all our NativeModules to also accept a `id<RCTTurboModulePerformanceLogger>` object. This performance logger object should then be forwarded to the `Native*SpecJSI` constructor.

## Script
Run the following script via Node:
```
var withSpaces = (...args) => args.join('\s*')

var regexString = withSpaces(
  '-',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<turboModuleClass>(facebook::react::|react::|::|)TurboModule)',
  '>',
  '\)',
  'getTurboModuleWithJsInvoker',
  ':',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<callInvokerClass>(facebook::react::|react::|::|)CallInvoker)',
  '>',
  '\)',
  'jsInvoker',
  '{',
  'return',
  'std::make_shared',
  '<',
  '(?<specName>(facebook::react::|react::|::|)Native[A-Za-z0-9]+SpecJSI)',
  '>',
  '\(',
  '(?<arg1>[A-Za-z0-9]+)',
  ',',
  '(?<arg2>[A-Za-z0-9]+)',
  '\)',
  ';',
  '}',
)

var replaceString = `- (std::shared_ptr<$<turboModuleClass>>)
    getTurboModuleWithJsInvoker:(std::shared_ptr<$<callInvokerClass>>)jsInvoker
                     perfLogger:(id<RCTTurboModulePerformanceLogger>)perfLogger
{
  return std::make_shared<$<specName>>($<arg1>, $<arg2>, perfLogger);
}`

const exec = (cmd) => require('child_process').execSync(cmd, { encoding: 'utf8' });
const abspath = (filename) => `${process.env.HOME}/${filename}`;
const relpath = (filename) => filename.replace(process.env.HOME + '/', '');
const readFile = (filename) => require('fs').readFileSync(filename, 'utf8');
const writeFile = (filename, content) => require('fs').writeFileSync(filename, content);

function main() {
  const tmFiles = exec('cd ~/fbsource && xbgs -n 10000 -l getTurboModuleWithJsInvoker:').split('\n').filter(Boolean);

  tmFiles
    .filter((filename) => !filename.includes('microsoft-fork-of-react-native'))
    .map(abspath)
    .forEach((filename) => {
      const source = readFile(filename);
      const newSource = source.replace(new RegExp(regexString, 'g'), replaceString);

      if (source == newSource) {
        console.log(relpath(filename));
      }

      writeFile(filename, newSource);
    });
}

if (!module.parent) {
  main();
}
```

Also, run: `pushd ~/fbsource && js1 build oss-native-modules-specs -p ios && js1 build oss-native-modules-specs -p android && popd;`

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D20478718

fbshipit-source-id: 89ee27ed8a0338a66a9b2dbb716168a4c4582c44
2020-03-18 11:01:15 -07:00
Ramanpreet Nara 39aae1038b Perflogger codemod manual changes
Summary:
Just includes the manual changes to get the perf logger moved to the ObjCTurboModule constructor.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D20498443

fbshipit-source-id: e607588f47ccc8ae199cd97043b09dfaff7a72dd
2020-03-18 11:01:15 -07:00
Jesse Katsumata 66e7a4c1aa Fix outdated urls (#28285)
Summary:
Fixed some url in the code that was outdated.

## Changelog

[Internal] [Fixed] - Fix outdated url in Image Example of RNTester and comment in StyleSheet Type
Pull Request resolved: https://github.com/facebook/react-native/pull/28285

Test Plan: Url can be accessed, and content displayed makes sense.

Differential Revision: D20464293

Pulled By: shergin

fbshipit-source-id: f0c97f7a95ed2a3d6c396cff6cda0bdaab7f5c35
2020-03-15 22:58:14 -07:00
Pascal Hartig db12255645 Upgrade Flipper Android to 0.33.1 (#28275)
Summary:
Upgrades Flipper to 0.33.1 for both the Android template and RNTester.

## Changelog

[Android] [Changed] - Upgrade Flipper dependency to 0.33.1
Pull Request resolved: https://github.com/facebook/react-native/pull/28275

Test Plan: Still trying to figure out how to get my Gradle setup working again. Until then, CI.

Reviewed By: cpojer, mweststrate

Differential Revision: D20369480

Pulled By: TheSavior

fbshipit-source-id: 048c944819168a352214349f6a83407a587479c9
2020-03-10 14:05:33 -07:00
Alec Larson 37436752f5 Add RNTester example for multi-line interleaved <View> and <Text> (#28242)
Summary:
Currently, using `alignSelf: "baseline"` on a `<View>` nested in a `<Text>` fails to position the view properly. Using `alignItems: "baseline"` on the parent `<Text>` doesn't work either.

/cc shergin

### Current Result
![rn-baseline-nested-view](https://user-images.githubusercontent.com/1925840/76032574-29918080-5f08-11ea-8ee8-cf3106ef0e06.jpg)

### Expected Result
![rn-baseline-nested-text](https://user-images.githubusercontent.com/1925840/76032575-2a2a1700-5f08-11ea-9efa-4026bc824ed5.jpg)
Pull Request resolved: https://github.com/facebook/react-native/pull/28242

Reviewed By: PeteTheHeat

Differential Revision: D20308202

Pulled By: shergin

fbshipit-source-id: adb75b763db1c3e879cb90d469a80ee8262a3609
2020-03-10 00:02:21 -07:00
Logan Daniels b85cb0cf7a Back out "Moving towards UIWindowScene support"
Summary:
Original commit changeset: ae2a4478e2e7

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D20289851

fbshipit-source-id: 1167ce8f5135411b80630b523c91c10e2b7eece1
2020-03-05 15:58:44 -08:00
Logan Daniels f4538e5777 Back out "UIViewController-based status bar management"
Summary:
Original commit changeset: 9ae1384ee20a

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D20289822

fbshipit-source-id: 0db9d99bea458e150d33b3407c256b862dedb9c1
2020-03-05 15:58:43 -08:00
radex 80e6d672f3 UIViewController-based status bar management (#25919)
Summary:
{emoji:26a0} This is a follow up to https://github.com/facebook/react-native/issues/25425 -- which isn't merged yet… See 2a286257a6..125aedbedc for actual diff

Currently, StatusBar native module manages the status bar on iOS globally, using `UIApplication.` APIs. This is bad because:

- those APIs have been deprecated for 4 years
- Apple really, really wants you to have an explicitly defined view controller, and control the status bar there
- it [breaks external native components](https://github.com/facebook/react-native/issues/25181#issuecomment-506792819)
- it's [not compatible with iPadOS 13 multi window support](https://github.com/facebook/react-native/issues/25181#issuecomment-506690818)

for those reasons I we should transition towards view controller-based status bar management.

With that, there is a need to introduce a default React Native root view controller, so I added `RCTRootViewController`. Using it is completely opt-in and there is no breaking change here. However I believe this should be a part of the template for new RN iOS apps.

Additionally, I added `RCTRootViewControllerProtocol` with hooks needed for RCTStatusBarManager to control the status bar. This means apps that want to have total control over their view controller can still opt in to react native VC-based status bar by conforming their root view controller to this protocol.

## Changelog

[iOS] [Added] - Added `RCTRootViewController` and `RCTRootViewControllerProtocol`
[iOS] [Fixed] - `UIViewControllerBasedStatusBarAppearance=YES` no longer triggers an error as long as you use `RCTRootViewController`
[iOS] [Fixed] - Status bar style is now correctly changed in multi-window iPadOS 13 apps if you use `RCTRootViewController` and set `UIViewControllerBasedStatusBarAppearance=YES`
Pull Request resolved: https://github.com/facebook/react-native/pull/25919

Test Plan: - Open RNTester → StatusBar → and check that no features broke

Reviewed By: fkgozali

Differential Revision: D16957766

Pulled By: hramos

fbshipit-source-id: 9ae1384ee20a06933053c4404b8237810f1e7c2c
2020-03-04 14:25:12 -08:00
radex b58e176af0 Moving towards UIWindowScene support (#28058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28058

I'm taking the first step towards supporting iOS 13 UIScene APIs and modernizing React Native not to assume an app only has a single window. See discussion here: https://github.com/facebook/react-native/issues/25181#issuecomment-505612941

The approach I'm taking is to take advantage of `RootTagContext` and passing it to NativeModules so that they can identify correctly which window they refer to. Here I'm just laying groundwork.

- [x] `Alert` and `ActionSheetIOS` take an optional `rootTag` argument that will cause them to appear on the correct window
- [x] `StatusBar` methods also have `rootTag` argument added, but it's not fully hooked up on the native side — this turns out to require some more work, see: https://github.com/facebook/react-native/issues/25181#issuecomment-506690818
- [x] `setNetworkActivityIndicatorVisible` is deprecated in iOS 13
- [x] `RCTPerfMonitor`, `RCTProfile` no longer assume `UIApplicationDelegate` has a `window` property (no longer the best practice) — they now just render on the key window

Next steps: Add VC-based status bar management (if I get the OK on https://github.com/facebook/react-native/issues/25181#issuecomment-506690818 ), add multiple window demo to RNTester, deprecate Dimensions in favor of a layout context, consider adding hook-based APIs for native modules such as Alert that automatically know which rootTag to pass

## Changelog

[Internal] [Changed] - Modernize Modal to use RootTagContext
[iOS] [Changed] - `Alert`, `ActionSheetIOS`, `StatusBar` methods now take an optional `surface` argument (for future iPadOS 13 support)
[iOS] [Changed] - RCTPresentedViewController now takes a nullable `window` arg
[Internal] [Changed] - Do not assume `UIApplicationDelegate` has a `window` property
Pull Request resolved: https://github.com/facebook/react-native/pull/25425

Test Plan:
- Open RNTester and:
- go to Modal and check if it still works
- Alert → see if works
- ACtionSheetIOS → see if it works
- StatusBar → see if it works
- Share → see if it works

Reviewed By: PeteTheHeat

Differential Revision: D16957751

Pulled By: hramos

fbshipit-source-id: ae2a4478e2e7f8d2be3022c9c4861561ec244a26
2020-03-04 14:25:12 -08:00
Tom Underhill f4de45800f PlatformColor implementations for iOS and Android (#27908)
Summary:
This Pull Request implements the PlatformColor proposal discussed at https://github.com/react-native-community/discussions-and-proposals/issues/126.   The changes include implementations for iOS and Android as well as a PlatformColorExample page in RNTester.

Every native platform has the concept of system defined colors. Instead of specifying a concrete color value the app developer can choose a system color that varies in appearance depending on a system theme settings such Light or Dark mode, accessibility settings such as a High Contrast mode, and even its context within the app such as the traits of a containing view or window.

The proposal is to add true platform color support to react-native by extending the Flow type `ColorValue` with platform specific color type information for each platform and to provide a convenience function, `PlatformColor()`, for instantiating platform specific ColorValue objects.

`PlatformColor(name [, name ...])` where `name` is a system color name on a given platform.  If `name` does not resolve to a color for any reason, the next `name` in the argument list will be resolved and so on.   If none of the names resolve, a RedBox error occurs.  This allows a latest platform color to be used, but if running on an older platform it will fallback to a previous version.
 The function returns a `ColorValue`.

On iOS the values of `name` is one of the iOS [UI Element](https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors) or [Standard Color](https://developer.apple.com/documentation/uikit/uicolor/standard_colors) names such as `labelColor` or `systemFillColor`.

On Android the `name` values are the same [app resource](https://developer.android.com/guide/topics/resources/providing-resources) path strings that can be expressed in XML:
XML Resource:
`@ [<package_name>:]<resource_type>/<resource_name>`
Style reference from current theme:
`?[<package_name>:][<resource_type>/]<resource_name>`
For example:
- `?android:colorError`
- `?android:attr/colorError`
- `?attr/colorPrimary`
- `?colorPrimaryDark`
- `android:color/holo_purple`
- `color/catalyst_redbox_background`

On iOS another type of system dynamic color can be created using the `IOSDynamicColor({dark: <color>, light:<color>})` method.   The arguments are a tuple containing custom colors for light and dark themes. Such dynamic colors are useful for branding colors or other app specific colors that still respond automatically to system setting changes.

Example: `<View style={{ backgroundColor: IOSDynamicColor({light: 'black', dark: 'white'}) }}/>`

Other platforms could create platform specific functions similar to `IOSDynamicColor` per the needs of those platforms.   For example, macOS has a similar dynamic color type that could be implemented via a `MacDynamicColor`.   On Windows custom brushes that tint or otherwise modify a system brush could be created using a platform specific method.

## Changelog

[General] [Added] - Added PlatformColor implementations for iOS and Android
Pull Request resolved: https://github.com/facebook/react-native/pull/27908

Test Plan:
The changes have been tested using the RNTester test app for iOS and Android.   On iOS a set of XCTestCase's were added to the Unit Tests.

<img width="924" alt="PlatformColor-ios-android" src="https://user-images.githubusercontent.com/30053638/73472497-ff183a80-433f-11ea-90d8-2b04338bbe79.png">

In addition `PlatformColor` support has been added to other out-of-tree platforms such as macOS and Windows has been implemented using these changes:

react-native for macOS branch: https://github.com/microsoft/react-native/compare/master...tom-un:tomun/platformcolors

react-native for Windows branch: https://github.com/microsoft/react-native-windows/compare/master...tom-un:tomun/platformcolors

iOS
|Light|Dark|
|{F229354502}|{F229354515}|

Android
|Light|Dark|
|{F230114392}|{F230114490}|

{F230122700}

Reviewed By: hramos

Differential Revision: D19837753

Pulled By: TheSavior

fbshipit-source-id: 82ca70d40802f3b24591bfd4b94b61f3c38ba829
2020-03-02 15:12:09 -08:00
Ramanpreet Nara 6a9a76e420 Make RCTDevLoadingView TurboModule-compatible
Summary:
This is a redo of D16969764, with a few extensions.

## Changes
1. Move `RCTDevLoadingView.{h,m}` to `CoreModuels/RCTDevLoadingView.{h,mm}`
2. Extract ObjC API of `RCTDevLodingView` into `RCTDevLoadingViewProtocol` in `ReactInternal`.
3. Create API `RCTDevLoadingViewSetEnabled.h` in `ReactInternal` to enable/disable `RCTDevLoadingView`

Changelog:
[iOS][Added] - Make RCTDevLoadingView TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18642554

fbshipit-source-id: 6b62e27e128d98254b7a6d018399ec1c06e274fc
2020-02-27 17:06:13 -08:00
Hans Halverson a3d9e91203 Move suppression to primary locations in xplat/js
Summary:
We will soon be enforcing that flow suppressions will only apply when on an error's primary location ([post](https://fb.workplace.com/groups/179614562644215/permalink/559286354677032/)). This diff uses the codemod created in D20008770 to move all suppression comments to their primary locations in the  `xplat/js` flow root, and deletes suppression comments that are not on any primary locations.

This diff was generated with:
```
~/fbsource/fbcode/flow/packages/flow-dev-tools/bin/tool suppression-primary-locations --json-file ~/www/errors.json  ~/fbsource/xplat/js
hg st -n | xargs grep -l -P '@(partially-)?generated' | xargs hg revert
hg st -n | xargs grep -l 'format' | xargs prettier --write
```

Changelog: [Internal]

bypass-lint

Reviewed By: dsainati1

Differential Revision: D20122544

fbshipit-source-id: d94e409aadb18bb399a1ddbf9f3f2494fe4fb54c
2020-02-27 12:14:57 -08:00
Rachel Nabors c0d8c1db90 Updating the URLs to point at new domain name reactnative.dev
Summary:
We recently updated React Native's docs site to have its own domain reactnative.dev and needed to update the URLs in the source code

CHANGELOG:
[INTERNAL]

Reviewed By: hramos

Differential Revision: D20072842

fbshipit-source-id: 1970d9214c872a6e7abf697d99f8f5360b3b308e
2020-02-24 13:09:11 -08:00
Pieter De Baets bdafc55f50 Make animation types exact
Summary: Changelog: [General][Changed] Improved flowtype support for Animated

Reviewed By: cpojer

Differential Revision: D20002839

fbshipit-source-id: 537ac00b3fe408585d34a0ffac8adc598e01d1b7
2020-02-21 06:54:03 -08:00
Eli White 3212f7dfe8 Release Pressable!
Summary:
*Pressable* is a component which is intended to replace the Touchable* components such as *TouchableWithoutFeedback* and *TouchableOpacity*. The motivation is to make it easier to create custom visual touch feedback so that React Native apps are not easily identified by the “signature opacity fade” touch feedback.

We see this component as eventually deprecating all of the existing Touchable components.

Changelog:
[Added][General] New <Pressable> Component to make it easier to create touchable elements

Reviewed By: yungsters

Differential Revision: D19674480

fbshipit-source-id: 765d657f023caea459f02da25376e4d5a2efff8b
2020-02-20 19:27:20 -08:00
Vojtech Novak 7f2a79f40b allow custom ripple radius on TouchableNativeFeedback (#28009)
Summary:
motivation: there are cases where one'd like to control the radius of the ripple effect that's present on TouchableNativeFeedback  - in my case, I want to make sure that both icons and text have the same ripple appearance, but that's currently not possible as far as I can tell.

Currently (afaik) the only way to set  (upper) ripple limits is by specifying width, height and border radius ( + `overflow: hidden`), and this works well for icons which can usually be bounded by a square, but not for text which can have rectangular shape.

This PR adds `rippleRadius` parameter to `SelectableBackground()`, `SelectableBackgroundBorderless()` and `Ripple()` static functions present on `TouchableNativeFeedback`. It can make the ripple smaller but also larger. The result looks like this:

added to RNTester:

![SVID_20200219_182027_1](https://user-images.githubusercontent.com/1566403/74858131-147ff380-5345-11ea-8a9e-2730b79eec38.gif)

difference from the other ripples:

![SVID_20200209_110918_1](https://user-images.githubusercontent.com/1566403/74109152-4513a080-4b81-11ea-8ec3-bb5862c57244.gif)

I'm ofc open to changing the api if needed, but I'm not sure there's much space for manoeuvring. While I was at it, I did a slight refactor of the class into several smaller, more focused methods.

It's possible that in some cases, this might help to work around this issue https://github.com/facebook/react-native/issues/6480.

## Changelog

[Android] [Added] - allow setting custom ripple radius on TouchableNativeFeedback
Pull Request resolved: https://github.com/facebook/react-native/pull/28009

Test Plan: I tested this locally using RNTester

Reviewed By: TheSavior

Differential Revision: D20004509

Pulled By: mdvacca

fbshipit-source-id: 10de1754d54c17878f36a3859705c1188f15c2a2
2020-02-20 15:29:07 -08:00
Eloy Durán 4118d79826 Rename autolinking-ios.rb script and bring RNTester and template in line. (#28077)
Summary:
Make the script ready for picking in 0.62.0-rc.3.

* Rename the script to remove ambiguity. “autolinking” is a CLI feature where 3rd-party pods are automatically discovered: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
* Make the Flipper version of the pods configurable, as requested [here](https://github.com/facebook/react-native/pull/28044#discussion_r378662636).
* Make RNTester’s Podfile use the same form as the template–including enabling Flipper by moving the CPP define into the right place in the Xcode project and out of the Podfile.
* Get rid of Podfile.lock thrashing by making the default CDN spec source explicit.

## Changelog

[iOS] [Changed] - Disambiguate autolinking-ios.rb script from CLI’s “autolinking” feature and bring RNTester & template in line.
Pull Request resolved: https://github.com/facebook/react-native/pull/28077

Test Plan: RNTester builds, as does a new application.

Reviewed By: PeteTheHeat

Differential Revision: D19956392

Pulled By: TheSavior

fbshipit-source-id: 6c800ddb646b49fc45c088978e2794cd7b60ea48
2020-02-19 15:19:26 -08:00
Rick Hanlon af710ab177 Switch from YellowBox.ignoreWarnings to LogBox.ignoreLogs
Summary:
Migrates internal calls from ignoreWarnings to ignoreLogs so we can remove YellowBox.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D19813781

fbshipit-source-id: 16c7b3f2cd38cba1901eccb4d5b9a2396a37ba1b
2020-02-18 06:19:46 -08:00
Pritesh Nandgaonkar cb80e3b599 @allow-large-files [Flipper][RN] Integrated Flipper in RNTester application
Summary:
Changelog: [iOS] [Fixed]

Integrated Flipper in RNTester application and made sure that flipper connects with RNTester application

allow-large-files

Reviewed By: rickhanlonii

Differential Revision: D19813213

fbshipit-source-id: f0c7a5a42ffaccd488582b0f42ce37aea946c636
2020-02-12 04:49:19 -08:00
Jason Safaiyeh 39cb675121 Resolve deprecated localizations (#27968)
Summary:
Resolved deprecated localization warnings thrown by Xcode.

## Changelog

[Internal] [Fixed] - Resolved deprecated localization warning
Pull Request resolved: https://github.com/facebook/react-native/pull/27968

Test Plan: * Build RNTester, there should be no warnings about deprecated localizations

Differential Revision: D19779176

Pulled By: hramos

fbshipit-source-id: 159988ef811697060b21bed6e698e5398d29fc46
2020-02-11 14:19:03 -08:00
Chad Smith 29d3dfbd19 add Detox integrations to Android RNTester app
Summary:
This diff adds required Detox integrations to the RNTester app to be able to run Detox end-to-end tests on the Android version of the app.

* Instructions at https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md were followed.
* The `minSdkVersion` version for the app was bumped to 18, as required by Detox.
* I also added build and test configurations in `package.json`
*  The debug app is able to run some of the existing tests, but the release app instacrashes. I do not know the reason for the instacrash at this time.
* CI integrations to build and test the Android app will be added in future diffs

Changelog:
[Internal] add Detox integrations to the RNTester Android app

Reviewed By: TheSavior

Differential Revision: D19566834

fbshipit-source-id: 5dd506bbdbb426a5db18146e5dc7c450a27b1d0c
2020-02-11 10:09:18 -08:00
Janic Duplessis 2c1913f0b3 Implement `adjustsFontSizeToFit` on Android (#26389)
Summary:
This adds support for `adjustsFontSizeToFit` and `minimumFontScale` on Android. The implementation tries to match closely the behaviour on iOS (hardcoded 4px min size for example). It uses a simpler linear algorithm for now, opened to improving it now if it is a deal breaker or in a follow up.

See https://twitter.com/janicduplessis/status/1171147709979516929 for a more detailed thread about the implementation

## Changelog

[Android] [Added] - Implement `adjustsFontSizeToFit` on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/26389

Test Plan: Tested by adding the existing `adjustsFontSizeToFit` example from the iOS text page to android. Also added a case for limiting size by using `maxHeight` instead of `numberOfLines`.

Reviewed By: mdvacca

Differential Revision: D17285473

Pulled By: JoshuaGross

fbshipit-source-id: 43dbdb05e2d6418e9a390d11f921518bfa58e697
2020-02-10 15:00:41 -08:00
Pascal Hartig 4bb0b4f205 Remove `pickFirst` arguments (#27964)
Summary:
This is no longer necessary with the new Flipper release.
Pull Request resolved: https://github.com/facebook/react-native/pull/27964

Test Plan:
This was a built-time problem so the CI jobs would catch this.

## Changelog

[Android] [Removed] - pickFirst options for RNTester and template

Differential Revision: D19815829

Pulled By: passy

fbshipit-source-id: d8f66e64e7e922b8ea18ad6eeec3a1c8e6bc77fa
2020-02-10 13:39:22 -08:00
Will Holen 2bc2b43fd3 Fix RNTester ignoring build mode and always using JSC
Summary:
RNTester ended up using JSC for both jscDebug and hermesDebug. Now it uses the
correct one. It still includes all executors, but it's a step in the right
direction.

ChangeLog: [General] [Fixed] RNTester now uses the VM specified in the build flavor

Reviewed By: passy

Differential Revision: D19752239

fbshipit-source-id: 0db4e5201fc80c2a0b91531e3f4333148c1d9c7c
2020-02-10 11:07:06 -08:00
Paige Sun edfdafc7a1 Resolve and reject promise for PushNotificationIOS.requestPermissions
Summary:
**Resolve/Reject Promise**
* Add onFulfill and onReject to the `PushNotificationIOS.requestPermissions()` Promise

**Replace Apple-deprecated notification method**
* Old: In iOS 10, `UIApplication.registerUserNotificationSettings` was deprecated. Calling this would then call the AppDelegate's lifecycle function `didRegisterUserNotificationSettings`, and then in the AppDelegate, we'd call `RCTPushNotificationManager.didRegisterUserNotificationSettings` to return the user settings.
[registerusernotificationsettings Doc](https://developer.apple.com/documentation/uikit/uiapplication/1622932-registerusernotificationsettings?language=objc)

* New: Replace deprecated function with Apple's recommended `UNUserNotificationCenter.currentNotificationCenter getNotificationSettingsWithCompletionHandler`, which no longer needs the AppDelegate lifecycle method because it directly returns the user's settings in a completion hander.
[requestauthorizationwithoptions Doc](https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649527-requestauthorizationwithoptions?language=objc)

**Add Tests**
* Add tests on `PushNotificationIOSExample.js` to test that the onFulfill and onReject are called
* On `PushNotificationIOSExample.js`, instead of asking permission upon page load, ask for permission when the user taps the button "Request Notifications (Should Display Alert)".
* Before, asking for permission multiple times before would result in the RN error "cannot call requestPermissions twice before the first has returned", now you can ask for permission as many times as you want because I've removed the now unused `RCTPromiseResolveBlock`.

**Future**
If this works on device (we have to land this to test push on device), we can delete `RTCPushNotificationManager.didRegisterUserNotificationSettings` which is being called from several apps.

Changelog:
[iOS] [Added]  Resolve and reject promise for PushNotificationIOS.requestPermissions

Reviewed By: PeteTheHeat

Differential Revision: D19700061

fbshipit-source-id: 02ba815787efc9047f33ffcdfafe962b134afe6d
2020-02-07 08:50:26 -08:00
Pieter De Baets 46dcce0031 Remove unused callFunctionReturnResultAndFlushedQueue
Summary: Changelog: [Internal] Remove unused BatchedBridge.callFunctionReturnResultAndFlushedQueue

Reviewed By: sammy-SC

Differential Revision: D19740946

fbshipit-source-id: 9919d52074180d0fcfb7c0929005f0d925578912
2020-02-05 13:02:06 -08:00
Rick Hanlon 3797a6d464 Add androidx.swiperefreshlayout to RNTester build.gradle
Summary:
Suggested fix from passy

Changelog: [General] [Fixed] RNTester instacrash from missing androidx dependency

Reviewed By: passy

Differential Revision: D19741935

fbshipit-source-id: 62e02169a92b7418471d2228a3d75ffffbe7a6a6
2020-02-05 04:32:42 -08:00
Chad Smith 14fcda880c use fb images in RNTester app
Summary:
This test has been failing internally because it attempts to access external images during CI execution, which it is blocked from doing. Because Detox synchronizes with the app to make sure network requests and animations are complete before continuing, the test waits indefinitely for these images to be fetched.

This diff makes the following changes
* External images are replaced with fb-hosted images
* Timeout threshold is reduced
* Detox initialization is broken out into two steps to help debug any future instances of this occurring
* If Detox is blocked for over 20 seconds, diagnostic messages will be printed indicating why it's being blocked

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D19671592

fbshipit-source-id: 368c683101ed7fc68578fc7758061b31c96c241d
2020-02-03 21:18:46 -08:00
Ramanpreet Nara ff3b839e9a Make RCTTestModule TurboModule-compatible
Reviewed By: fkgozali

Differential Revision: D18545790

fbshipit-source-id: 035df69671ec44d13b79b014bfe90f5af9f43e58
2020-02-01 15:19:40 -08:00
Jason Safaiyeh 6579d8f5bc Integrate Flipper in RNTester on Android (#27631)
Summary:
0.62 Flipper Support items: https://github.com/facebook/react-native/issues/27565
Made RNTester's Android Flipper implementation consistent with the template.
~~Added Flipper to the iOS build.~~
<img width="1259" alt="Screen Shot 2019-12-28 at 7 06 42 PM" src="https://user-images.githubusercontent.com/8675043/71551835-37290800-29a5-11ea-9eac-b119a69a68c1.png">

## Changelog

[Internal] [Added] - RNTester Android Fipper updates
Pull Request resolved: https://github.com/facebook/react-native/pull/27631

Test Plan: Run RNTester and see if it connects to Flipper.

Reviewed By: rickhanlonii

Differential Revision: D19345093

Pulled By: passy

fbshipit-source-id: 6957c1ca3f4a5bb7f0e581c5daf8ddeac5d87eea
2020-01-29 07:52:53 -08:00
Jesse Katsumata 5b8f4ef195 Clear some lint warnings (#27893)
Summary:
Applied linting for warnings that seemed trivial.

## Changelog

[Internal] [Fixed] - clear lint warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/27893

Test Plan: yarn lint

Differential Revision: D19619569

Pulled By: cpojer

fbshipit-source-id: f9f02838c56e94abc1590686c8443c6c6e6f44ca
2020-01-29 04:36:28 -08:00
Eli White fb5d95177b Add Detox tests for TextInput
Summary:
Adding some tests for TextInput.

Changelog:
[Internal] Add Detox tests for TextInput

Reviewed By: mdvacca

Differential Revision: D19568013

fbshipit-source-id: d8d5bf998bc7aced55641bf8f8f5b37355c98768
2020-01-28 17:33:21 -08:00
Pascal Hartig 8259a9d369 Use new Flipper SDK (#27833)
Summary:
The FBJNI compat issue is gone so this is working now. �

Still a bit ugly to set up, but that's on our ToDo. Next: Template.

## Changelog

[Android] [Fixed] - Use modern Flipper SDK version for RNTester
Pull Request resolved: https://github.com/facebook/react-native/pull/27833

Test Plan:
```
./gradlew :RNTester:android:app:installHermesDebug
```

![Screenshot 2020-01-22 at 09 30 22](https://user-images.githubusercontent.com/9906/72883088-9c012500-3cfb-11ea-9997-b38831196259.png)

Reviewed By: cpojer

Differential Revision: D19513412

Pulled By: passy

fbshipit-source-id: af118bd364ab316732e2a1e657fa1b682bf7da59
2020-01-28 06:49:38 -08:00
Kudo Chien a27e31c059 Upgrade Folly to v2020.01.13.00 (#27810)
Summary:
Upgrade Folly to v2020.01.13.00. Fixes https://github.com/facebook/react-native/issues/27640

## Changelog

[iOS] [Changed] - Upgrade Folly to v2020.01.13.00
Pull Request resolved: https://github.com/facebook/react-native/pull/27810

Test Plan: Test by building and running RNTester

Reviewed By: mdvacca

Differential Revision: D19483115

Pulled By: fkgozali

fbshipit-source-id: 4a85325a95b5f7857da75995d587218740d8b077
2020-01-21 12:44:00 -08:00
Pascal Hartig 9ad5e72b77 Migrate to FBJNI (#27729)
Summary:
This is an incomplete effort to migrate from libfb to libfbjni. This is needed to restore the compatibility with Flipper and other FB Android projects that make use of FBJNI. Effectively, the outcome is that `fbjni` no longer has a checked-in copy here, but instead relies on the public artifacts published at github.com/facebookincubator/fbjni that can be deduplicated at build-time.

**A non-exhaustive list of tasks:**

* [X] Gradle builds the SDK and RNTester for Android.
* [X] Buck build for rntester works in OSS.
* [ ] Move from `java-only` release to full `fbjni` release. This requires finding a solution for stripping out `.so` files that the old `Android.mk` insists on including in the final artifacts and will clash with the full distribution.
* [ ] Import this and fix potential internal build issues.
* [ ] Verify that the changes made to the Hermes integration don't have any unintended consequences.

## Changelog

[Android] [Changed] - Migrated from libfb to libfbjni for JNI calls
Pull Request resolved: https://github.com/facebook/react-native/pull/27729

Test Plan:
- CI is already passing again for Gradle and Buck in OSS.
- After applying the following patch, RNTester builds and works with the latest Flipper SDK:

```
 diff --git a/RNTester/android/app/build.gradle b/RNTester/android/app/build.gradle
index b8a6437d7..eac942104 100644
 --- a/RNTester/android/app/build.gradle
+++ b/RNTester/android/app/build.gradle
@@ -170,10 +170,19 @@ dependencies {
     debugImplementation files(hermesPath + "hermes-debug.aar")
     releaseImplementation files(hermesPath + "hermes-release.aar")

-    debugImplementation("com.facebook.flipper🐬0.23.4") {
+    debugImplementation("com.facebook.flipper🐬+") {
         exclude group:'com.facebook.yoga'
-        exclude group:'com.facebook.flipper', module: 'fbjni'
-        exclude group:'com.facebook.litho', module: 'litho-annotations'
+        exclude group:'com.facebook.fbjni'
+    }
+
+    debugImplementation("com.facebook.flipper:flipper-network-plugin:+") {
+        exclude group:'com.facebook.yoga'
+        exclude group:'com.facebook.fbjni'
+    }
+
+    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:+") {
+        exclude group:'com.facebook.yoga'
+        exclude group:'com.facebook.fbjni'
     }

     if (useIntlJsc) {
```

Reviewed By: mdvacca

Differential Revision: D19345270

Pulled By: passy

fbshipit-source-id: 33811e7f97f44f2ec5999e1c35339909dc4fd3b1
2020-01-21 02:32:50 -08:00
Peter Argany 459c54c407 Refactor RCTTurboModuleManager to take in a CallInvoker
Summary:
In bridgeless mode, `RCTTurboModuleManager` is initialized with a nil bridge. This has mostly worked, since `RCTBridge` doesn't do too many things for TMM (some notifs and perf markers). The one important thing it provides is a `_jsInvoker`.

In bridgeless mode, up until this point `_jsInvoker` has been nil, and turbo modules were not able to call functions on the JS thread. This diff fixes that.

Reviewed By: RSNara

Differential Revision: D19437174

fbshipit-source-id: 86bfc0a47bd9576e7d3203b860e86446eb0b63dd
2020-01-17 15:55:25 -08:00
Jordan Brown 434526e13d Get rid of implicit exact object in PickerExample
Summary:
In order to be sure that 0.62 does not require an exact-by-default codebase, we should get rid of any `{}` occurrences inside of react-native-github. If all the object types in react-native-github are either explicitly exact `{||}` or explicitly inexact `{...}` then those object types will have consistent semantics regardless of the Flow settings in the client codebase.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D19347283

fbshipit-source-id: 4c199bd7f1684b70df1b1c717941d0d477f67117
2020-01-16 12:46:07 -08:00
Héctor Ramos 9fb2ca0b53 Bump Xcode to 11.2.1 (#27434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/27434
Pull Request resolved: https://github.com/facebook/react-native/pull/27295

- Use Xcode version 11.2.1 in both internal and external tests.
- Update snapshot reference images to use iPhone 8 test device.

Xcode 11.3.0 will be available in Sandcastle in the next week or so.

Changelog:

[Internal] - Bump Xcode version used in tests to 11.2.1.
[Internal] - Update iOS Snapshots.

Reviewed By: cs01

Differential Revision: D18849584

fbshipit-source-id: 9e3b92f080a4dc6a15dac0535b7562ff6a5c08a9
2020-01-14 13:30:05 -08:00
Oleksandr Melnykov 1e6e37a3a8 Use commands instead of setNativeProps for AndroidSwipeRefreshLayout
Summary:
As a part of the migration from setNativeProps in Fabric and Paper, we are replacing it by view commands in the RefreshControl component on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18475450

fbshipit-source-id: ad89547fada3444f725fd9b00e8482cfc8f4d7fc
2020-01-14 03:53:57 -08:00
Rick Hanlon 5cd0c8a4d2 Bump detox simulator version to work with latest xcode (#27733)
Summary:
The latest xcode version removed iPhone 6s, so we need to bump to the latest simulator listed that has 3d touch.

## Changelog

[General] [Fix] - Bump e2e simulator version
Pull Request resolved: https://github.com/facebook/react-native/pull/27733

Test Plan: - `yarn build-ios-e2e && yarn test-ios-e2e `

Reviewed By: hramos, sammy-SC

Differential Revision: D19345576

Pulled By: rickhanlonii

fbshipit-source-id: 428cb83ccb899409e972551f18df580174adee91
2020-01-13 11:15:55 -08:00
Panagiotis Vekris 15ce226f5f v0.115 in xplat/js
Summary:
https://our.intern.facebook.com/intern/wiki/Flow/Flow_Release_Process/Updating_Internal_Repositories/#update-xplat-js

reverted manually:
```
RKJSModules/Apps/Jobs/top_level_components/JobsCandidateDetailView.js
RKJSModules/Apps/MobileHome/ui/sevs/v2/MobileHomeSevsDetailsEscalationLogRow.js
RKJSModules/Apps/MobileHome/ui/sevs/v2/MobileHomeSevsDetailsHeaderMetadata.js
RKJSModules/Apps/MobileHome/ui/user/MobileHomeUserDetails.js
RKJSModules/Apps/Profile/ProfileEdit/apps/ProfileEditCollegeApp.js
RKJSModules/Apps/Profile/ProfileEdit/apps/ProfileEditWorkApp.js
metro/packages/metro/src/cli.js
RKJSModules/Apps/AdsLWI/Surfaces/AdsLWICallToActionEditorSurface.js
react-native-github/jest/preprocessor.js
```

Changelog: [Internal]

allow-large-files

Reviewed By: jbrown215

Differential Revision: D19292958

fbshipit-source-id: 4aa969bf2d0f2f5857e68a7e31ff4dcaf29e67cd
2020-01-06 18:06:26 -08:00
Kevin Gozali 829a2237d2 iOS/tvOS 9.0 ==> 10.0 in .xcodeproj
Summary:
Updated leftover configs to require iOS/tvOS 10.0+.

Changelog: [iOS] [Deprecated] - Deprecated iOS/tvOS 9.x support

Reviewed By: mmmulani

Differential Revision: D19269953

fbshipit-source-id: e4a60b744c1424094922bd47bcccc93a165c3d9b
2020-01-03 10:42:25 -08:00
Kevin Gozali 674b591809 iOS: Deprecate iOS 9 / tvOS 9 SDK support
Summary:
It is time to target SDK version 10.0+.

Changelog: [iOS] [Deprecated] - Deprecating support for iOS/tvOS SDK 9.x, 10.0+ is now required

Reviewed By: mdvacca

Differential Revision: D19265731

fbshipit-source-id: 93b6f9e8f61c5b36ff69e80d3f18256aa96cc2c0
2020-01-02 12:52:12 -08:00
Héctor Ramos be355a24b7 Re-sync with internal repository 2019-12-19 13:42:21 -08:00
Kevin Gonzales 0a525b6d9d Support for accessibility Label prop to the Picker component (#27342)
Summary:
With a Picker we would like to allow accessibility labels to be passed as a prop for situations where we want go give more detail. For example if we have a number picker that will be used for a timer instead of just saying 3, we might want to say 3 hours.

## Changelog
[General] [Added] - Picker test with an accessibility label prop
[General] [Added] - Support for accessibility Label prop to the Picker component
Pull Request resolved: https://github.com/facebook/react-native/pull/27342

Test Plan: Test plan is testing in RNTester making sure the examples work

Differential Revision: D18770184

Pulled By: hramos

fbshipit-source-id: e6f8ab4a9c50f3fb46342198441ecc71394913d3
2019-12-17 16:48:17 -08:00
Héctor Ramos d153e8a209 Fix testBundleURL in react-native-oss-ios
Summary:
The react-native-oss-ios job has been failing when testBundleURL gets a local filesystem URL instead of a packager URL.

Setting CI_USE_PACKAGER allows us to force the test to use the packager.

Changelog:
[Internal]

Reviewed By: mmmulani

Differential Revision: D19105213

fbshipit-source-id: a58089bf278ca0f08dd3f4df94e9fe8ce9a63376
2019-12-16 18:21:15 -08:00
Pascal Hartig 68bf0e32e7 Fix RNTester integration with Flipper (#27482)
Summary:
There was a reflective call to a non-existent class. It did, however,
exist in the template, so I copied it over from there and updated
the references accordingly.
Pull Request resolved: https://github.com/facebook/react-native/pull/27482

Test Plan:
Built it and ran it. Works again with the latest Flipper desktop app.

![Screenshot 2019-12-11 16 02 40](https://user-images.githubusercontent.com/9906/70637975-02405580-1c30-11ea-9fec-23860c59cdb6.png)

Reviewed By: rickhanlonii

Differential Revision: D18933530

Pulled By: passy

fbshipit-source-id: 4515d7baaad9a9fff9a4b66e1cbf8a75889e6e45
2019-12-16 03:14:49 -08:00