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

20600 Коммитов

Автор SHA1 Сообщение Дата
David Vacca 79d0a7d711 Upgrade minsdkversion of RN OSS template to API level 19
Summary:
This diff updates the minsdkversion of RN OSS template to API level 19

changelog: [Android][Deprecated] Deprecate support of Android API levels 16 to 18. The new minSDK version will be 19+ moving forward

Reviewed By: JoshuaGross

Differential Revision: D22874852

fbshipit-source-id: 1df98e422dc9debd40ab2021aafc7b165312d14b
2020-07-31 13:21:52 -07:00
Ramanpreet Nara 4cbc39a431 Rename babel-plugin-inline-view-configs to @react-native/babel-plugin-codegen
Summary:
This babel plugin will also take care of the JS TurboModule Codegen. Therefore, we should rename this into something more generic.

Changelog:
[General][Changed] Rename babel-plugin-inline-view-configs to react-native/babel-plugin-codegen

Reviewed By: rickhanlonii, cpojer

Differential Revision: D22803209

fbshipit-source-id: 416c97fea6fa0820d25bbc91033a0cbbbbbff825
2020-07-31 13:00:50 -07:00
Ramanpreet Nara 826067736f Instrument TurboModuleManager.getModule
Summary:
This instruments the following marker:
- MODULE_CREATE

**Note:** This marker isn't necessary to test the JS TurboModule codegen, since the JS codegen should only affect the C++ portion of the TurboModule infra. However, I implemented this while I was in this area of the code, for completeness.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22679888

fbshipit-source-id: aa04822bd5a7c889813fcd13ca23c0b7a1d8444a
2020-07-31 12:49:15 -07:00
Ramanpreet Nara 3741134bfb Instrument JavaTurboModule::invokeJavaMethod
Summary:
This diff instruments the following markers:
- ASYNC_METHOD_CALL
- ASYNC_METHOD_CALL_EXECUTION
- SYNC_METHOD_CALL

Changelog: [Internal]

Reviewed By: PeteTheHeat, JoshuaGross

Differential Revision: D22609409

fbshipit-source-id: 2e6752c46cb5a046a3c205b0f0ca5902275839cf
2020-07-31 12:49:14 -07:00
Ramanpreet Nara d22a121cb3 Implement asyncMethodCallFail
Summary:
The async NativeModule method call event can fail if something goes wrong when we're about do dispatch the method call.
Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D22609410

fbshipit-source-id: 699eeb78edfbefa85e417fd82318ae8e4f6f7d90
2020-07-31 12:49:14 -07:00
Ramanpreet Nara 9c35b5b8c4 Dispatch promise methods to the NativeModules thread
Summary:
In D17480605 (689233b018), I made all methods with void return types dispatch to the NativeModules thread. This diff makes the same change to methods with promise return types.

**Note:** The changes are disabled for now. I'll add an MC so that we can test this in production in a later diff.

Changelog:
[Android][Fixed] - Make promise NativeModule methods dispatch to NativeModules thread

Reviewed By: PeteTheHeat

Differential Revision: D22489338

fbshipit-source-id: d5b030871f9f7b3f48eb111225516521493cb05e
2020-07-31 12:49:14 -07:00
Anton Bryukhov aa1d31ebca Use recent Vibrator Android API (#29534)
Summary:
Android's `VibrationModule` uses deprecated `vibrate(long milliseconds)` and `vibrate(long[] pattern, int repeat)` methods. Deprecation notes: [[1]](https://developer.android.com/reference/android/os/Vibrator#vibrate(long)) [[2]](https://developer.android.com/reference/android/os/Vibrator#vibrate(long[],%20int)).
Changes in this pull request use recent `Vibrator` API for devices with API Level >= 26 (since mentioned methods were depreceted in API Level 26).

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

[Android] [Internal] - Use non-deprecated `Vibrator` API in `VibrationModule`

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

Test Plan: API is the same as before, but it uses recent `Vibrator` API.

Reviewed By: makovkastar

Differential Revision: D22857382

Pulled By: mdvacca

fbshipit-source-id: 6793a7d165fa73d81064865861ed55af2de83d52
2020-07-31 11:25:37 -07:00
David Vacca 9b34aa261c Cleanup unsed code in ReactScrollView
Summary:
This diff cleansup unsed code in ReactScrollView

changelog: [Android][Deprecated] Remove code used by Android API level < 16

Reviewed By: JoshuaGross

Differential Revision: D22771910

fbshipit-source-id: d02f7da209d3f313b22f3d4b8f6c413b32f7bc44
2020-07-31 10:44:06 -07:00
David Vacca b133427778 Cleanup unsed code on AccessibilityInfoModule
Summary:
This diff cleansup unused code on AccessibilityInfoModule class

changelog: [Android][Deprecated] Remove code used by deprecated Android API levels

Reviewed By: JoshuaGross

Differential Revision: D22771912

fbshipit-source-id: f32808fa93f75c10324e8875b85fe4e541b284b8
2020-07-31 10:44:05 -07:00
David Vacca b7d8641a28 Cleanup ForwardingCookieHandler class
Summary:
This diff cleansup the class ForwardingCookieHandler, refactoring constants and adding annotations to avoid lint errors

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22771914

fbshipit-source-id: 4fdff2df5ea103f93519c2f4504288202114b1fc
2020-07-31 10:44:05 -07:00
David Vacca f829722b54 Remove old android APIs code from ReactViewGroup
Summary:
This diff removes code that was used to support android APIs < kitkat
changelog: [Android][Deprecated] Remove calls to Android API < Kitkat

Reviewed By: JoshuaGross

Differential Revision: D22771913

fbshipit-source-id: b9bba9e94fbc8e18889b821050dcd6eace4c202d
2020-07-31 10:44:05 -07:00
David Vacca 25a40cbc61 Clean old code on ReactViewBackgroundDrawable
Summary:
This diff removes unnecessary API checks in ReactViewBackgroundDrawable

changelog: [Android][Deprecated] Remove JellyBeans Android API checks in ReactViewBackgroundDrawable classes

Reviewed By: JoshuaGross

Differential Revision: D22771911

fbshipit-source-id: bbbf3dd3fd1c3cf3f5ce294fc32bd0a31ca0f67c
2020-07-31 10:44:05 -07:00
Samuel Susla 799654b105 Make sticky header position type relative
Summary:
Changelog: [Internal]

Since D22098586 (476ab7481e) zIndex is only applied to views with position other than static.
Sticky header however needs to have its zIndex applied otherwise it goes below the content.

Reviewed By: mdvacca

Differential Revision: D22843134

fbshipit-source-id: d2e3a21441795b82c44b6d4245ccf89620fd9a8e
2020-07-31 08:48:09 -07:00
David Vacca 973198667d Upgrade react-native-github Android to support API level 19+
Summary:
This diff upgrades react-native-github Android to support API level 19+

changelog: [Android][Deprecated] Deprecate support of Android API levels 16 to 18. The new minSDK version will be 19+ moving forward

Reviewed By: JoshuaGross

Differential Revision: D22734208

fbshipit-source-id: b052721c8cfb44f8d74cf4bbb5b7a769e544d1d9
2020-07-30 17:10:10 -07:00
Steven Moyes d48f7ba748 Update ECOSYSTEM.md to reflect updated partnerships (#29527)
Summary:
To help reflect how we've collectively been thinking about partnership and engagement on React Native, this change moves Facebook into the Partners list alongside other partners like Expo, Microsoft, and others. This change helps establish that the React Native teams across Facebook & Microsoft are one big happy family :)

## 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] [Changed] - Updated ECOSYSTEM.md to reflect partnerships between Facebook, Microsoft, and others

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

Test Plan: N/A - document change

Reviewed By: cpojer

Differential Revision: D22845420

Pulled By: TheSavior

fbshipit-source-id: b3393c8749efc924b27d101d0513ae55eba55270
2020-07-30 11:18:45 -07:00
Jiayan Zhuang 0d3e535978 Add full support for AccessibilityState prop
Summary:
Changelog:[Fabric][iOS] Add full support for AccessibilityState

Since the AccessibilityState checked, busy or expanded only exist in Android and they don't have corresponding AccessibilityTrait to set, so we could just ignore the implementation in RCTViewComponentView.mm. What I did is to update the AccessibilityState values in AccessibilityPrimitives.h and accessibilityPropsConversions.h in order to enable further implementation in Android.

Reviewed By: shergin

Differential Revision: D22807584

fbshipit-source-id: f3ef048055d11314bc833357d8ca061e0fe219a4
2020-07-30 09:24:29 -07:00
Will Holen e1fa53af2e Implement Debugger.setBreakpointsActive
Summary:
Changelog: [Internal][Added] Support for toggling all breakpoints in Chrome debuggers

This implements the Debugger.setBreakpointsActive CDP message, allowing
users in Chrome to toggle all exceptions on and off.

As with V8/Chrome, setting a breakpoint will automatically re-activate
all breakpoints.

#utd-hermes-ignore-android

Reviewed By: avp

Differential Revision: D22825209

fbshipit-source-id: bda2cc59aba04443280bca46126c19bb0cdb58d7
2020-07-29 17:51:26 -07:00
Joshua Gross 3c6c5f057a Trivial: fix typos in log messages of NativeAnimatedModule
Summary:
Fix typos.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22808108

fbshipit-source-id: 7a0406d902ac92bc27ecd49fd061704539266bf2
2020-07-29 17:42:10 -07:00
Joshua Gross 934561b295 Remove complex NativeAnimated queueing mechanisms
Summary:
After D22801173 (9e6ba9ddb8) has landed, the native mechanisms in NativeAnimated to delay queued items from immediate execution are no longer necessary.

Fabric and non-Fabric animations both look smooth after deleting this code.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22807906

fbshipit-source-id: 9241fff84376f6aa9a35049cc40dfd6561effaa1
2020-07-29 17:42:10 -07:00
Joshua Gross 949dedca9f Implement BackgroundExecutor for layouts
Summary:
As a followup to D22743723 (d53fc8a3cd) on the iOS side, I implement a BackgroundExecutor that can be used from C++ to schedule layouts on their own thread, off the JS and UI thread.

This is a potential perf improvement that we will experiment with.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22826795

fbshipit-source-id: 899bd67fe1b86f52910951e9536b59a1414a304c
2020-07-29 15:41:22 -07:00
Jiawei Lv a1ed73dd64 Make some RN rules no-op for arc focus (#29510)
Summary:
## Changelog: [Internal]

## Test Plan: run buck project

Reviewed By: cute-jumper

Differential Revision: D22495239

fbshipit-source-id: b77c65632ee5fb0efd0d5980f11c48d76a4fdbb6
2020-07-29 15:11:19 -07:00
Joshua Gross 9e6ba9ddb8 Animated: queue all NativeAnimated operations until mounting effects are finished
Summary:
In Fabric, there are two subtle differences in Animated:

1) On the native side, queued NativeAnimated operations are executed more frequently
2) On the JS side there seems to be a bigger gap between AnimatedNodes being set up, and the final `componentDidMount`/`componentDidUpdate` that results in `_attachNativeEvents` being called.

This results in some visual glitching for certain features like StickyScrollViewHeader and other animations that are frequently rerendered. Rerendering an animated component relies on sync-like behavior
(new animations must be set up in the same frame that old animations are torn down, and the UI must flush any updates in the same frame). This sync-like behavior is trickier to achieve in Fabric, so
we introduce this mechanism, in Fabric only, to queued operations more aggressively on the JS side and only flush them when `componentDidMount`/`componentDidUpdate` have been called on all relevant nodes.

This seems to resolve longstanding issues with animations in Fabric on Android.

There are unrelated issues on iOS that make this difficult to test currently, so I'll keep the new path Android-only for now.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D22801173

fbshipit-source-id: 3db2235483636c9074df941cfac0a30f3f97545a
2020-07-29 12:39:10 -07:00
Nico Burns dc2df75426 Make flipper pods configurations configurable (#29074)
Summary:
This PR allows the use_flipper! helper function to be used in projects that
have more than just Debug/Release configurations. For example, a project
may have DevDebug, DevRelease, ProdDebug, and ProdRelease configurations.
These projects can now do:

```ruby
use_flipper!(configurations: ['DevDebug', 'ProdDebug'])
```

## Changelog

[iOS][Added] Ability to set which configuration to enable flipper for when using  use_flipper!

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

Test Plan:
I don't know how to run code in this repository, so I copy and pasted this function into the Podfile of an existing project. My complete Podfile is as below:

```ruby
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
require_relative '../node_modules/react-native-community/cli-platform-ios/native_modules'

project 'marketplace',
  'Dev.Debug' => :debug,
  'Dev.Release' => :release,
  'Prod.Debug' => :debug,
  'Prod.Release' => :release

def use_flipper!(versions = {}, configurations: ['Debug'])
  versions['Flipper'] ||= '~> 0.33.1'
  versions['DoubleConversion'] ||= '1.1.7'
  versions['Flipper-Folly'] ||= '~> 2.1'
  versions['Flipper-Glog'] ||= '0.3.6'
  versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
  versions['Flipper-RSocket'] ||= '~> 1.0'
  pod 'FlipperKit', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configurations => configurations
  # List all transitive dependencies for FlipperKit pods
  # to avoid them being linked in Release builds
  pod 'Flipper', versions['Flipper'], :configurations => configurations
  pod 'Flipper-DoubleConversion', versions['Flipper-DoubleConversion'], :configurations => configurations
  pod 'Flipper-Folly', versions['Flipper-Folly'], :configurations => configurations
  pod 'Flipper-Glog', versions['Flipper-Glog'], :configurations => configurations
  pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configurations => configurations
  pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configurations => configurations
  pod 'FlipperKit/Core', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/CppBridge', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FBDefines', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configurations => configurations
end

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
end

target 'marketplace' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  #use_frameworks!

  pod 'FBLazyVector', :path => '../node_modules/react-native/Libraries/FBLazyVector'
  pod 'FBReactNativeSpec', :path => '../node_modules/react-native/Libraries/FBReactNativeSpec'
  pod 'RCTRequired', :path => '../node_modules/react-native/Libraries/RCTRequired'
  pod 'RCTTypeSafety', :path => '../node_modules/react-native/Libraries/TypeSafety'
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/callinvoker', :path => '../node_modules/react-native/ReactCommon'
  pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native/ReactCommon'
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'Intercom', '~> 6.0.0'
  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  pod 'react-native-netinfo', :podspec => '../node_modules/react-native-community/netinfo/react-native-netinfo.podspec'
  pod 'BugsnagReactNative', :podspec => '../node_modules/bugsnag-react-native/BugsnagReactNative.podspec'
  pod 'rn-fetch-blob', :podspec => '../node_modules/rn-fetch-blob/rn-fetch-blob.podspec'

  use_native_modules!

  pod 'react-native-intercom', :path => '../node_modules/react-native-intercom'
  pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'react-native-camera', :path => '../node_modules/react-native-camera'

  pod 'RNCPushNotificationIOS', :path => '../node_modules/react-native-community/push-notification-ios'

  pod 'RNDateTimePicker', :path => '../node_modules/react-native-community/datetimepicker'

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!(configurations: ['Dev.Debug', 'Prod.Debug'])

  post_install do |installer|

    flipper_post_install(installer)

    installer.pods_project.targets.each do |target|

      # The following is needed to ensure the "archive" step works in XCode.
      # It removes React & Yoga from the Pods project, as it is already included in the main project.
      # Without this, you'd see errors when you archive like:
      # "Multiple commands produce ... libReact.a"
      # "Multiple commands produce ... libyoga.a"

      targets_to_ignore = %w(React yoga)

      if targets_to_ignore.include? target.name
        target.remove_from_project
      end
    end
  end
end
```

I then ran `pod install`:

```
nico:ios/ (dev*) $ pod install                                                                                [20:14:43]
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Detected React Native module pods for BVLinearGradient, RNCAsyncStorage, RNCPicker, RNCPushNotificationIOS, RNDateTimePicker, RNFBApp, RNFBAuth, RNFBDatabase, RNFBDynamicLinks, RNFBFirestore, RNFBStorage, RNSVG, RNVectorIcons, ReactNativeNavigation, react-native-camera, react-native-cameraroll, react-native-config, react-native-flipper, react-native-get-random-values, react-native-image-resizer, and react-native-intercom
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 73 dependencies from the Podfile and 88 total pods installed.

[!] use_native_modules! skipped the react-native dependency 'react-native-photo-view'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good
    example of a package.json driven podspec. See
    https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See
    https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library

[!] use_native_modules! skipped the react-native dependency 'detox'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good
    example of a package.json driven podspec. See
    https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See
    https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library
```

Reviewed By: cpojer

Differential Revision: D22795421

Pulled By: passy

fbshipit-source-id: 89ba555eadc4918e9ac464a19a318198b237e01e
2020-07-29 02:51:32 -07:00
Jiayan Zhuang 9b11cb6f1f Replace folly::Optional with better::optional in Fabric C++ files (#29518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/29518

Changelog:
[Internal] - Replace folly::Optional with better::optional in Fabric C++ file

Reviewed By: shergin

Differential Revision: D22696909

fbshipit-source-id: c9b97403ac620789922fd1b5dbcbe5d3d910ed52
2020-07-28 17:28:26 -07:00
Andrey Tserkus db474a47b7 RN: Fixed `performanceNow()` to allow debugging in Chrome
Summary:
Discovered when debugging a React Native app in Chrome. The function `performanceNow` was recently changed, so that in Chrome it now refers to `performance.now()` method. However, `now()` cannot be called standalone without a context.

Reproduced by a synthetic example in Chrome:
```
const performanceNow = window.performance.now;
performanceNow();

Uncaught TypeError: Illegal invocation
    at <anonymous>:1:1
```

Changelog:
[General] [Fixed] - Fix failure when debugging code in a browser; was caused by `performanceNow()` function.

Reviewed By: cpojer

Differential Revision: D22739176

fbshipit-source-id: f89b8a215b7b4c430ffd72a1d23539c4f1b31d24
2020-07-28 17:20:54 -07:00
Peter Argany 00bc73f625 Fix misleading comment in RCTFabricSurface API
Summary:
Using RCTFabricSurface in bridgeless mode, this comment seems incorrect to me.

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

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

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22800934

fbshipit-source-id: c396cbd3fc1749b8e7ab571c9e7bc05cd352fc14
2020-07-28 14:41:26 -07:00
Paito Anderson 0bcc686c1c Fix iOS Image.getSizeWithHeaders (#29338)
Summary:
Fixes https://github.com/facebook/react-native/issues/28632

Image.getSizeWithHeaders() was not working as intended on iOS.

## Changelog

[iOS] [Fixed] - Fixed headers in `Image.getSizeWithHeaders`.

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

Test Plan:
Used RNTester and an Image URL requiring a Bearer token to test.

Code:
<img width="720" alt="Screen Shot 2020-07-10 at 3 00 58 PM" src="https://user-images.githubusercontent.com/4108718/87189376-850cba00-c2be-11ea-851c-d9fa37d88de4.png">

With Bearer Token:
<img width="456" alt="Screen Shot 2020-07-10 at 3 02 48 PM" src="https://user-images.githubusercontent.com/4108718/87189349-7de5ac00-c2be-11ea-8d82-c74cae6d904b.png">

Without Bearer Token:
<img width="559" alt="Screen Shot 2020-07-10 at 3 04 32 PM" src="https://user-images.githubusercontent.com/4108718/87189458-aff70e00-c2be-11ea-82b7-34a14ec465f1.png">

Reviewed By: cpojer

Differential Revision: D22783037

Pulled By: PeteTheHeat

fbshipit-source-id: 3ad5026e71607c61d42316784844c5295bc1dcae
2020-07-28 13:16:28 -07:00
Rick Hanlon 4b935ae95f Correctly mock all components by setting the displayName
Summary:
In the next react sync we removed the `displayName` from forwardRef and useMemo components ([PR here](https://github.com/facebook/react/pull/18495 )).

This means we need to manually add the displayName in the mock.

Changelog: [General] [Fixed] Fix test renderer mocks to use the displayName more often.

Reviewed By: TheSavior

Differential Revision: D22775470

fbshipit-source-id: 1390dc325e34f7ccea32bbdf1c6a8f6efea3a080
2020-07-28 13:09:06 -07:00
Rick Hanlon 7af3f6e934 Add React integration tests for LogBox
Summary:
This diff adds some integration tests that throw read React errors and asserts on the LogBox data.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22752147

fbshipit-source-id: eb2e1542524d67558f2450130015164acd4d6093
2020-07-28 13:09:06 -07:00
Rick Hanlon 4720ee9aa7 Support component stack frames formatted as call stack frames in LogBox
Summary:
In the next version of React they've changed the format of component stacks from a custom format to the same format as call stacks. This diff adds handling (and test) for the new format.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22752034

fbshipit-source-id: 38d74bffd9ed623cbdd71e70103d66d8f0765fd9
2020-07-28 13:09:06 -07:00
Joshua Selbo 3094210bfe Fix test_android CI (#29509)
Summary: Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D22780016

fbshipit-source-id: 342465886748d379741e60181aafc68d46a169ee
2020-07-28 12:38:32 -07:00
Samuel Susla ffc90c7f92 Remove requestToken being nil check from [RCTNetworkTask validateRequestToken]
Summary:
Changelog: Fix [TypeError: Network request failed] on file upload

# Problem
In 3198009410 I made method `loadImageForURL` blocking and nil returning since it was no longer cancellable.

However inside `[RCTNetworkTask validateRequestToken]` was a logic counting on request token being non nil.
This diff removes this check and adds `nullable` to `[RCTImageURLLoader loadImageForURL]` making it explicit.

Reviewed By: PeteTheHeat

Differential Revision: D22767174

fbshipit-source-id: 04d5562e381912233b9c14e8156cbf145288f063
2020-07-28 12:00:57 -07:00
bill2004158 fd85b84a86 Update RCTSRWebSocket.m (#29419)
Summary:
Only add Sec-WebSocket-Protocol header if has _requestedProtocols.

## 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] - when Sec-WebSocket-Protocol header is empty vaulue, IIS server will return error 502.

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

Reviewed By: cpojer

Differential Revision: D22782867

Pulled By: PeteTheHeat

fbshipit-source-id: d588997a345929b0c11c554d4452e612a336901a
2020-07-28 11:10:14 -07:00
Patrik Tomas Chamelo 1b362f9f76 Fix ratio for color conversion
Summary: As part of our usage color detection that relies on precise values of colors, it appears that the ration used was 256, but RBGA scale is 0-255

Reviewed By: shergin

Differential Revision: D22785378

fbshipit-source-id: 87a6f9b4611ceaadbbbb75a4566f4cf9b8285b68
2020-07-27 23:40:39 -07:00
David Vacca 7ccb67a49c Fix render of ARTShape using null paths
Summary:
This diff fixes the rendering of ART Shapes that uses null paths

changelog: [internal] internal fix

Reviewed By: JoshuaGross

Differential Revision: D22780163

fbshipit-source-id: 2aded726ad47fce243ec1c28fbd4c39dd71820ef
2020-07-27 17:35:37 -07:00
Joshua Gross 07722cf746 Ignore exceptions when a Delete instruction is in the same BatchMountItem as its corresponding Create instruction during stopSurface
Summary:
See title. Basically during stopSurface a single BatchMountInstruction can contain both the Create and Delete MountItem for a single view, which will cause *only* the deletion to be executed.

There isn't really a way to prevent this and we're just trying to clean up as aggressively as possible, so we can safely ignore this.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22779189

fbshipit-source-id: c44fd736835b04c5de776346ec3d34afa4860199
2020-07-27 16:58:47 -07:00
Joshua Gross 3bab643e5d NativeAnimated: lower SoftException to NoCrashSoftException
Summary:
This exception will be more disruptive during development than necessary.

This can be upgraded again if there's a reasonable root-cause, but right now this error isn't actionable enough, is too common, and the repercussions aren't obvious.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22775734

fbshipit-source-id: 2cd9449f5b78025f7a230fbbd5f2e87bce183d04
2020-07-27 16:22:25 -07:00
Jiayan Zhuang 3c52942506 Write tests to cover additional features in RCTParagraphComponentView
Summary:
Changelog:
[Internal] - Add additional tests to cover other features in RCTParagraphComponentView.

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

Reviewed By: shergin

Differential Revision: D22668022

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

Reviewed By: shergin

Differential Revision: D22607097

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

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

I built a shadowNode tree here for future tests.

Reviewed By: shergin

Differential Revision: D22536626

fbshipit-source-id: c74b63b3319693b90c9d64b7f782a1a922b0d499
2020-07-27 15:37:31 -07:00
Peter Argany d1c3c2d084 Fork RCTAnimatedModule to unblock brideless mode
Summary:
The Animated native module cannot be converted to a TM because it has perf regressions when used in conjunction with Paper renderer. Instead of fixing these complicated perf issues (which will disappear when Fabric ships this half), temporarily fork the native module. The new fork is converted to a TM, and only used to unblock bridgeless mode testing.

Changelog:[Internal]

Reviewed By: RSNara

Differential Revision: D22651010

fbshipit-source-id: 912123ef38ac8c66025b7bba34a65ec6d98f330d
2020-07-27 15:09:33 -07:00
Luna Wei 509e9dbd5f Change signature for addTimestamp for performance logger
Summary:
Changelog:
[Internal][Added] - Change signature of `addTimestamp` for IPerformanceLogger and rename old implementation to addTimeAnnotation

Adding this because there is no current ability to add a timespan to our perf logging with pre-defined start and end timestamps. The naming is a bit confusing because the current implementation of `addTimespan` in FB doesn't add a timespan, it adds an annotation of duration. We rename the old implementation to `addTimeAnnotation/s` and update `addTimespan` to suit our needs.

Reviewed By: rubennorte

Differential Revision: D22633202

fbshipit-source-id: 0e32099241f1f3835257cbb4ad108a4f437869e6
2020-07-27 14:28:56 -07:00
Rick Hanlon 9edfc43aad Only pass Error.stack to parseErrorStack
Summary:
I want to be able parse error stacks in contexts where I have a call stack string but no error object.

This diff changes parseErrorStack to only accept the stack, instead of a whole error object.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22752048

fbshipit-source-id: b4b1cd58802eefe736130d48a82bc091241a11ee
2020-07-27 13:57:58 -07:00
Samuel Susla cd6e2b468d Back out "Back out "[RN][Fabric] Introducing LayoutableShadownode::getContentOriginOffset and use it in ScrollView""
Summary:
This diff reverts a revert of D22456266 (0060b5de55) and fixes the reason why it was reverted. Reverted in D22532594 (c0e7e1bd9c).

For reason why it was introduced in the first place, please refer to D22456266 (0060b5de55).

Problem:
`includeTransform` was not taken into account when calculating offset.

I added a unit test covering this specific scenario.

Reviewed By: shergin

Differential Revision: D22763011

fbshipit-source-id: e7d88fc19608ad1a4c7b5e594a9cc48122a2799b
2020-07-27 13:23:53 -07:00
Samuel Susla b08fff6f86 Fix race condition in KeyboardAvoidingView
Summary:
Changelog: Fix possible race condition inside `KeyboardAvoidingView`

Fabric has different order of events

In Fabric, `keyboardWillChangeFrame` event is fired before `onLayout`, but in Paper it is the other way around.
`KeyboardAvoidingView` depends on the order of events to function properly. Inside `_relativeKeyboardHeight` 0 is returned if `this._frame` is null.

To fix this, `bottom` margin is recalculated whenever `keyboardWillChangeFrame` or `onLayout` is triggered.

Reviewed By: shergin

Differential Revision: D22764192

fbshipit-source-id: 591ac59af4395a4d43c4e78e4fbc0ff118b292f8
2020-07-27 13:16:38 -07:00
Joshua Selbo 7c7f09ea60 Upgrade instrumentation tests to Mockito2
Summary: Changelog: [Internal]

Reviewed By: strulovich

Differential Revision: D22673812

fbshipit-source-id: 31cb5a71da58e778e503a47fc92538127e76ce41
2020-07-27 12:04:30 -07:00
Lulu Wu a23596f70f Enable registerSegment in Venice
Summary:
Enable registerSegment in Venice and verify bundle splitting works for Pokes with Venice.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D22666115

fbshipit-source-id: 74ef830b802634b1019d4371873aba599438de37
2020-07-27 06:36:21 -07:00
Valentin Shergin 476ab7481e Fabric: Enable zIndex only for non-`static` positioned views
Summary:
The standard says that zIndex should only be defined for non-`static` positioned views. This diff implements it.
For now, it actually enables zIndex for all views in RN because there is no way to specify `position: static` but will will give that ability by changing Flow definitions in future diffs in a couple of weeks (to ensure OTA safety).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22098586

fbshipit-source-id: 77dacbee0fe887f667ba81640b8bd759e1df11fd
2020-07-26 22:05:45 -07:00
Valentin Shergin ca6700f3c3 Fabric: ViewProps::zIndex now is `optional<int>` to be able store `auto`
Summary:
In W3C standard, `zIndex` prop can have `auto` value which is the default.
In classic React Native and in Fabric before this diff, the default value was `0`. The only difference between `auto` and `0` is that nodes with `auto` do not form stacking context whereas nodes with `0` (or any other numeric value) do. This worked fine in pre-Fabric RN where every view always formed staking context but in Fabric we need to finally implement it right.

https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
https://stackoverflow.com/a/57892072/496389

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22403383

fbshipit-source-id: 6532d180a00f22bde763e3ebadd6683b344a0672
2020-07-26 22:05:45 -07:00
Joshua Gross 41fb336ff2 NativeAnimated: Fabric constructs partial animation graphs often; warn instead of crashing
Summary:
Due to subtle differences in lifecycle on the native side, as well as in JS, Fabric constructs partial graphs more frequently than non-Fabric RN did.

We still crash if we detect a cycle, which we check for more explicitly now; and we still always crash in non-Fabric. But if we detect a partial graph in Fabric,
we warn instead of crashing. We also print the state of the graph before crashing/warning, to assist in debugging in production.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22752291

fbshipit-source-id: f452892678fbe7b5a49f93644d39d3b6ae5bda75
2020-07-25 13:45:11 -07:00