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

17774 Коммитов

Автор SHA1 Сообщение Дата
Rick Hanlon 958b7aa9aa Add e2e tests for array object props
Summary: Adds e2e tests for the array of object prop types in the codegen

Reviewed By: rubennorte, motiz88

Differential Revision: D16814301

fbshipit-source-id: 613f32a888451c0c1b7359133b7bf88878e36916
2019-08-15 06:38:15 -07:00
Rick Hanlon 86eb4c7f62 Parse $ReadOnlyArray<$ReadOnly{}> props
Summary: Add flow type parsing for `$ReadOnlyArray<$ReadOnly<{}>>`

Reviewed By: TheSavior

Differential Revision: D16814261

fbshipit-source-id: 9442916f5d31f6d27f560332aee311b3ad8f0864
2019-08-15 06:38:15 -07:00
Rick Hanlon 243ccc541e Generate array<object> props
Summary: Adds the cxx generators for arrays of object props

Reviewed By: JoshuaGross, TheSavior

Differential Revision: D16814136

fbshipit-source-id: fa4600f60c063bfb460033f5fde43e26c04b5a3b
2019-08-15 06:38:15 -07:00
Rick Hanlon bc1c7b1096 Add array<object> props to schema
Summary: Adds arrays of objects to the codegen schema

Reviewed By: motiz88

Differential Revision: D16814117

fbshipit-source-id: 10b20446f7aac5dccc3d2cb148891a134d136d3f
2019-08-15 06:38:14 -07:00
Rick Hanlon 70fc54a20b Add e2e test for object props
Summary: Adds e2e tests for cxx and java object props

Reviewed By: JoshuaGross

Differential Revision: D16759242

fbshipit-source-id: 2307dc4b3ba26222de510cf5876c582d35fc665c
2019-08-15 06:38:14 -07:00
Rick Hanlon 56f9eb35da Add Object props support for cxx
Summary: Adds ability to codegen object props to cxx by generating the cxx structs and conversion functions |

Reviewed By: JoshuaGross

Differential Revision: D16759170

fbshipit-source-id: 7437421e59f4be42fbcd4cddc2e0ed513ae71d08
2019-08-15 06:38:14 -07:00
Pascal Hartig 35fc0add2d Remove vendored proguard annotation (#26069)
Summary:
There have been multiple complaints about combining RN with various
other FB libraries, including Litho and Flipper, because of bundled dependencies
that can't be deduplicated by Gradle.

This is one of three current conflicts:

1) Proguard annotations (this PR)
2) Yoga
3) fbjni

While the Yoga group name doesn't make a massive amount of sense
it was the easiest existing package to use and since we don't
have a better namespace for this, we might as well use this.

A similar change to Litho is landing right now.

## Changelog

[Android] [Changed] - Use centralized package for DoNotStrip annotation
Pull Request resolved: https://github.com/facebook/react-native/pull/26069

Test Plan:
```
yarn
./gradlew :RNTester:android:app:assembleDebug
```

Reviewed By: cpojer

Differential Revision: D16827430

Pulled By: passy

fbshipit-source-id: 87542b5422fee598d8e635651441f0ecd42eb9d7
2019-08-15 06:04:16 -07:00
Oleksandr Melnykov a206e91907 Generate super call to BaseViewManagerDelegate if delegate has no props
Summary: This diff adds a super call to `BaseViewManagerDelegate` if the current delegate doesn't have any props. We still want to set base view props, so we need `BaseViewManagerDelegate` to take care of this.

Reviewed By: rickhanlonii

Differential Revision: D16806648

fbshipit-source-id: 61963f2211cc7b2e7f5822c48bb0a7f50d909221
2019-08-15 03:27:13 -07:00
Rodrigo Salazar 0cf1c6df0b add the jni initializer to the build for sampling profiler
Summary: The OnLoad.cpp file is needed since it actually registers the jni functions, it wasn't included in the build so it wasn't working correctly.

Reviewed By: jbower-fb

Differential Revision: D16826230

fbshipit-source-id: 0243e456c4015879d17650737a6a27a58a3d0d9a
2019-08-15 02:52:54 -07:00
empyrical 0057cc9bf2 Deprecate Text proptypes (#26055)
Summary:
This pull request moves `Text`'s prop types to the `DeprecatedPropTypes` folder.

This was already partly in progress - there were redundant `TextPropTypes` and `DeprecatedTextPropTypes` files so I removed one, and made sure the version with the doc strings was the one used.

## Changelog

[General] [Deprecated] - Move `Text` component's proptypes to DeprecatedPropTypes
Pull Request resolved: https://github.com/facebook/react-native/pull/26055

Test Plan: Flow checks pass for iOS and Android

Differential Revision: D16801078

Pulled By: TheSavior

fbshipit-source-id: ef19300945d48d0a4a83d728ee32cdf7d1c0f0cc
2019-08-14 17:34:07 -07:00
Eli White 51133235e0 Add failure tests for duplicate props with the same name
Summary: There are a couple of cases where props can conflict which would cause undefined behavior. We'll throw to protect against that. Now that we support type spread this is more possible without someone realizing.

Reviewed By: JoshuaGross

Differential Revision: D16813884

fbshipit-source-id: 1a8fce365ab315198abdff0de6006cfe34e84fb9
2019-08-14 16:11:05 -07:00
Eli White ac6c747aac Support deeply nested spreads
Summary: Apparently I missed one more edge case. Thanks Josh for flagging!

Reviewed By: JoshuaGross

Differential Revision: D16813354

fbshipit-source-id: 6b59bc7b18184e3aa437c3b038ffd22b0fc0ba6a
2019-08-14 16:11:04 -07:00
Eli White 9ae866c072 Support spreading locally defined types deeply
Summary: We want to be able to spread props at any level, not just the top level

Reviewed By: JoshuaGross

Differential Revision: D16812884

fbshipit-source-id: 2e710141f833a7cc7ea25a91a1523a5c43b4e02c
2019-08-14 16:11:04 -07:00
Eli White 0a3967480e Support spreading locally defined types
Summary: We want to be able to spread types that are defined in the same file.

Reviewed By: JoshuaGross

Differential Revision: D16812171

fbshipit-source-id: 7cda9869ea25f0357b3f8a3b28443407b219f04b
2019-08-14 16:11:04 -07:00
Joshua Gross a02176e2ec Add support for `Double` prop type
Summary: Support a prop-type `Double`, in addition to `Float`, for flow typing and codegen of components.

Reviewed By: TheSavior

Differential Revision: D16812812

fbshipit-source-id: b5588b3218636283a4e9c5d17212dd0b92986eb9
2019-08-14 15:33:41 -07:00
Ramanpreet Nara bf78d7969a Migrate RCTImage NativeModules to CoreModules
Summary:
This diff moves RCTImageLoader, RCTImageEditingManager, and RCTImageStoreManager to CoreModules. This is necessary for us to convert all these NativeModules to TurboModules.

**Note:** As a part of this diff, I had to break apart `RCTImageLoader.h`. All the protocols that were in `RCTImageLoader` are now in their own headers. Furthermore, `RCTImageLoader`'s methods are defined in `RCTImageLoaderProtocol`, so that we can call them from classes like `RCTImageViewManager` in `RCTImage`.

Reviewed By: PeteTheHeat

Differential Revision: D16805827

fbshipit-source-id: 89f6728b0766c30b74e25f7af1be8e6b8a7e6397
2019-08-14 13:39:30 -07:00
David Vacca 441c00abc9 Revert D16543433: [Fabric][JS] Use SoundManager in Pressability and Touchable
Differential Revision:
D16543433

Original commit changeset: a2ba060bc480

fbshipit-source-id: 0ba31019fb7a9e77577e495782a3b10029575d22
2019-08-14 13:32:56 -07:00
David Vacca 9dbe5e241e Use SoundManager in Pressability and Touchable
Summary: This diff replaces the usage of UIManagerModule.playTouchSound() in Pressability and Touchable for the SoundManager.playTouchSound()

Reviewed By: yungsters

Differential Revision: D16543433

fbshipit-source-id: a2ba060bc480889c1e08c5c87086361e06974684
2019-08-14 12:38:36 -07:00
Eli White 9a31fa5fd6 Delete ensureComponentIsNative.js
Summary:
This function was used by Touchable*. It was removed from the Touchables in D6494579 in 2017. The only remaining callsite was ImageBackground which is attaching a ref directly to the View so we know it is a native component.

This is needed for some setNativeProps cleanup

Reviewed By: sahrens

Differential Revision: D16796973

fbshipit-source-id: 19379094b3b91920efac4bf1969fc22d4b80bcc6
2019-08-14 11:46:58 -07:00
empyrical d00f0882fb Add documentation to TextInput's Flow types (#26054)
Summary:
The documentation from the Flow types' respective proptypes have been copied over to `TextInput`.

## Changelog

[Internal] [Changed] - Added documentation to TextInput's Flow types
Pull Request resolved: https://github.com/facebook/react-native/pull/26054

Test Plan: `yarn flow-check-ios` and `yarn flow-check-android` both pass.

Differential Revision: D16801435

Pulled By: TheSavior

fbshipit-source-id: 7f3d75ba149259d5bbf719375320e2e325188826
2019-08-14 11:33:14 -07:00
Michał Osadnik a5ea7200da Omit getConstants for codegening if object is empty
Summary: Old codegen was omitting `getConstants` if it was empty. So do our. There's no point in providing this getter in this case.

Reviewed By: RSNara

Differential Revision: D16762230

fbshipit-source-id: 721df13a00848d23108329b152115c0f0aee8eb9
2019-08-14 05:00:09 -07:00
Michał Osadnik c0304aaa9b Add setMethodArgConversionSelector
Summary: `setMethodArgConversionSelector` is method for provinding generated structs for methods' params. It was exactly how in old codegen.

Reviewed By: RSNara

Differential Revision: D16784403

fbshipit-source-id: d35bc8160be62385527299a6b8e68c1159002853
2019-08-14 05:00:09 -07:00
Michał Osadnik 40dd48c6bd Fix name of key obtaining from dictionary in inline method in generated objcpp
Summary: It was a mistake. We should obtain value by proper key always. Previously by a mistake I hardcoded 'a'. I wasn't break anything because it wasn't used in Internationalization. However, it was a bug

Reviewed By: RSNara

Differential Revision: D16782132

fbshipit-source-id: 59f7910f2be7753c07f16f00a201de856d57e29e
2019-08-14 05:00:09 -07:00
Michał Osadnik 024ce5d1d4 Change type of params in methods' protocols to nongeneric
Summary:
It was mistake which I fix here. Type of param in protocols should be generated struct.

See generated struct in snap. It's exactly how it was in previous codegen

Reviewed By: RSNara

Differential Revision: D16770579

fbshipit-source-id: dac9c15c5d91a41ab2d06aea416f64bd7deb4476
2019-08-14 05:00:08 -07:00
Michał Osadnik d3c30cdfe1 fix optional key in structs in new codegen
Summary: Property should be marked as optional not only when value is optional, but also key.

Reviewed By: RSNara

Differential Revision: D16764332

fbshipit-source-id: d56944ef263da3aa1fce3482151c761574a83be6
2019-08-14 05:00:08 -07:00
Michał Osadnik 99614497f4 Remove multiple RTCConvert import
Summary: RTCConvert was previously imported on each protocol. It was redundant. It's enough to import it once per file

Reviewed By: RSNara

Differential Revision: D16764834

fbshipit-source-id: 9e5dcd52e38dfefa675e3e2c9f2a8f414da1a02c
2019-08-14 05:00:08 -07:00
Michał Osadnik 4a9035aa65 hadle nullable params in generated objcpp
Summary: Param of function can be optional and it should have impact on native code. Inspired by old codegen

Reviewed By: RSNara

Differential Revision: D16763884

fbshipit-source-id: dab50275f902dbe4af25824bb6128d3b37fc43cd
2019-08-14 05:00:08 -07:00
Oleksandr Melnykov a5aaca7d4f Migrate RCTAxialGradientView to JS codegen
Summary:
This diff migrates `RCTAxialGradientView` to use generated `RCTAxialGradientViewManagerDelegate` for setting its props. The following base properties have been added to `BaseViewManager`:

```
  protected void setBorderRadius(T view, float borderRadius) {}

  protected void setBorderBottomLeftRadius(T view, float borderRadius) {}

  protected void setBorderBottomRightRadius(T view, float borderRadius) {}

  protected void setBorderTopLeftRadius(T view, float borderRadius) {}

  protected void setBorderTopRightRadius(T view, float borderRadius) {}
```

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D16784173

fbshipit-source-id: f3971985efee2b6e0a5fb248b89c4809305e670c
2019-08-14 04:44:12 -07:00
jsfu 71d7d6883c fix display problems when image fails to load (#25969)
Summary:
This problem was also affecting Fabric and was fixed in D16708532.
When the image resource is changed and the new image resource fails to load, we expect the display image to fail to load, but the image still shows the image that was successfully loaded last time.

## Changelog

[iOS] [Fixed] - fix display problems when image fails to load
Pull Request resolved: https://github.com/facebook/react-native/pull/25969

Test Plan:
This is catalyst playground with following code P78264143.
TLDR of the code, it sets URL <Image> that is 404.

{F175486515}

Reviewed By: makovkastar

Differential Revision: D16783330

Pulled By: sammy-SC

fbshipit-source-id: 1cb488590ce15d957357f32a73ebf8df6cccf4cd
2019-08-14 03:35:14 -07:00
Oleksandr Melnykov 639da37dc5 Use feature flag to enable view manager delegates for setting props
Summary: This diff adds a feature flag which must be enabled if view managers should be allowed to use a delegate for setting their properties.

Reviewed By: mdvacca

Differential Revision: D16762876

fbshipit-source-id: ae3466d7f02ed02f203dbb79f5e0843e6d9fdd45
2019-08-14 03:30:14 -07:00
Joshua Gross 825e1c087c Commands: support Float arguments
Summary: Support codegen'ing commands with Float arguments.

Reviewed By: mdvacca

Differential Revision: D16785534

fbshipit-source-id: 8174ae40762c1114b87a023cb2b69b2515dc6e23
2019-08-13 13:37:24 -07:00
Adam Ernst 724fe11472 Add reexport_all_header_dependencies to (yet more) misc rules
Summary: Currently this is the default, but I plan to toggle the default to False shortly. False is better for build speed, as it forces you to separate deps and exported_deps.

Reviewed By: williamtwilson

Differential Revision: D16785991

fbshipit-source-id: 8cb73b87f1dfa50f21c0c12df1579054cdc99e6e
2019-08-13 11:14:06 -07:00
Vojtech Novak 8a82503b54 fix SectionList scrollToLocation and prevent regressions (#25997)
Summary:
Recently there were quite a few changes to this functionality, and they caused breakages

https://github.com/facebook/react-native/issues/21577
https://github.com/facebook/react-native/issues/24034
https://github.com/facebook/react-native/issues/24734
https://github.com/facebook/react-native/issues/24735

Currently,  whichever `viewOffset` I pass, it will be overridden (either by 0 or something computed in the if body). This fixes the issue and also adds tests to make sure there is no regression.

## Changelog

[Javascript] [Fixed] - VirtualizedSectionList scrollToLocation viewOffset param ignored
Pull Request resolved: https://github.com/facebook/react-native/pull/25997

Test Plan: tests pass

Differential Revision: D16784036

Pulled By: cpojer

fbshipit-source-id: 46421250993785176634b30a2629a6e12f0c2278
2019-08-13 07:52:54 -07:00
empyrical 427b54eef6 Move TextInput PropTypes to Deprecated PropTypes (#26042)
Summary:
This pull request moves `TextInput`'s proptypes to `DeprecatedTextInputPropTypes`. This is in line with what is happening with other components.

## Changelog

[General] [Deprecated] - Moved `TextInput`'s proptypes to `DeprecatedTextInputPropTypes`
Pull Request resolved: https://github.com/facebook/react-native/pull/26042

Test Plan: Flow checks pass.

Differential Revision: D16782322

Pulled By: cpojer

fbshipit-source-id: c5f9caa402c0c5cd878e7fff502d380c7b468cbd
2019-08-13 03:36:58 -07:00
jeswinsimon e104204ae0 URL: Do not prepend baseUrl if the URL is not a relative URL (#26009)
Summary:
Fix for bug https://github.com/facebook/react-native/issues/26006 URL with base is always used, even when absolute URL is provided

## Changelog

[Javascript] [Fixed] - `URL`: Base url value is ignored when the input url is not a relative url.
Pull Request resolved: https://github.com/facebook/react-native/pull/26009

Test Plan:
`new URL('http://github.com', 'http://google.com')` now returns `http://github.com/`
Added a test case to `URL-test.js` to verify the same.

Differential Revision: D16781921

Pulled By: cpojer

fbshipit-source-id: 038aca3610e34f513f603e8993f9a925b7d28626
2019-08-13 02:55:21 -07:00
Spencer Ahrens 450e4a7cb3 Add RNTester and UITestBed as dev routes in main apps
Summary: It's nice to have everything in one place, especially when touching native code where it's a pain to arc focus or buck build another target just to test some other JS.

Reviewed By: yungsters

Differential Revision: D14957052

fbshipit-source-id: fd3c388ab5b193b0fe9cebdc0c81ddbff9a714d4
2019-08-12 21:12:57 -07:00
Spencer Ahrens a9c8103baa Fix jest test crashes with animated components
Summary:
In the jest test renderer, host components have null refs by default. `createAnimatedComponent` tries to access the ref in componentDidMount, which then crashes. This is particularly problematic when trying to update test data:

https://fb.workplace.com/groups/mpen00bs/permalink/494236684721027/?comment_id=510656413079054

Just checking for null fixes the issue and shouldn't affect anything else.

Reviewed By: TheSavior, yungsters

Differential Revision: D16777137

fbshipit-source-id: 0b9f7c5734c849f36318512ceffcc42dd44c58bb
2019-08-12 20:44:50 -07:00
Ram N 054d2fc172 Move HermesSamplingProfiler to OSS
Reviewed By: willholen

Differential Revision: D16069575

fbshipit-source-id: a67d19be8790a27e6b3fbd2da0d5c9fdd1e9d53a
2019-08-12 18:23:47 -07:00
Ramanpreet Nara 47afa7c945 Improve ModuleRegistryBuilder assertion
Summary: ModuleRegistryBuilder does as assertion to verify that all `cxxModules` are instances of `CxxModuleWrapperBase::javaStaticClass()`. This assertion is causing the crash in T48554656. Since we don't know which NativeModule is causing this problem, it's difficult to get to the bottom of this. So, for now, I'm improving the assertion message in the hopes that it helps us get to the bottom of this issue.

Reviewed By: mdvacca

Differential Revision: D16774711

fbshipit-source-id: 82318b8ff5ab735ae642da81777c1b5588e8a483
2019-08-12 18:12:50 -07:00
Ram N 3a66fc7dcb Add Flipper to React Native OSS by default
Reviewed By: passy

Differential Revision: D6723578

fbshipit-source-id: f34442689f99cd94220335a171010224a12132a8
2019-08-12 14:56:02 -07:00
Rick Hanlon a60e581267 Better error message for invalid type annotation
Summary: Just a minor error message improvement

Reviewed By: TheSavior, osdnk

Differential Revision: D16759233

fbshipit-source-id: c53c54535eca683353085a8d2272c60596b52b54
2019-08-12 13:52:39 -07:00
Rick Hanlon e110f0450a Add support for parsing object props
Summary:
This diff adds support to the flow parser to parse object props to the codegen schema

This handles required and optional props, as well as required and optional object properties, WithDefault, enums, etc. Basically everything is supported that is supported at the top level

Reviewed By: TheSavior, osdnk

Differential Revision: D16759198

fbshipit-source-id: 6f501f4738f84f20a940235ba74f7bae93e64eef
2019-08-12 13:52:39 -07:00
Rick Hanlon e6c1e81c60 Move generateStructName to CppHelpers
Summary: We'll need this helper in the prop files now so let's move it over to the generic cpp helpers

Reviewed By: TheSavior

Differential Revision: D16759164

fbshipit-source-id: 8765ffee3bd8219b5f0dc8677362ec45f0a8e2c5
2019-08-12 13:52:39 -07:00
Rick Hanlon ebb412ab00 Add Object props support for Java
Summary: This diff adds Java handling for object props

Reviewed By: TheSavior

Differential Revision: D16759139

fbshipit-source-id: e47956dc43cd1eb4abd58636bf111dde8d7244cc
2019-08-12 13:52:38 -07:00
Rick Hanlon 50b821df49 Add view config support for Object props
Summary: This diff adds handling for object prop types in the view config codegen

Reviewed By: TheSavior

Differential Revision: D16759136

fbshipit-source-id: ff4020f9cffe30f14a1356ac95afd7c9a1062c05
2019-08-12 13:52:38 -07:00
Rick Hanlon 76b8b1dc8b Add object prop tests for unchanged fixtures
Summary:
This diff adds snapshot updates for the new object props test fixtures whose implementation does not need to change (e.g. event emitter files will not change when object props are implemented). This is for easier reviewability in later diffs.

Notes that in the files that will change, we're temporarily filtering the OBJECT_PROPS test fixture

Reviewed By: TheSavior

Differential Revision: D16759124

fbshipit-source-id: 8aae063614f762c8bd7bf092b0d274804c38dd14
2019-08-12 13:52:38 -07:00
Rick Hanlon 06259a7575 Add Object type to schema
Summary: This diff adds ObjectTypeAnnotation to the codegen schema, throwing for the missing implementation sites added in the next diffs for easier review-ability. Also adds a schema fixture that is flow checked for review, but does not export it because the tests would fail

Reviewed By: TheSavior

Differential Revision: D16759109

fbshipit-source-id: 75c93623e8c1ae2003c7cc638e8e3447f0e7aa38
2019-08-12 13:52:37 -07:00
Samuel Susla e6debfe1dd Fix crash during reload on Marketplace Home
Summary:
# What's the problem?

`RCTSurfacePresenter._scheduler` is deallocated in `RCTSurfacePresenter.handleBridgeWillReloadNotification`.

It shouldn't be used before `RCTSurfacePresenter.handleJavaScriptDidLoadNotification` is called because that's when new `RCTSurfacePresenter._batchedBridge` is created, scheduler depends on this new `RCTSurfacePresenter._batchedBridge`.

But it is, it means that it is created with the old bridge, this means that it gets deallocated right away.

First access point of old bridge is in `RCTSurfacePresenter.setMinimumSize`.

# What's the fix?

Make sure surface has correct stage before calling layout methods.

The other idea was  to return early in `RCTSurfacePresenter.setMinimumSize` in case bridge isn't setup.

# Problems?
1. Following error still appears after reload
{F176556210}

2. There is a white space for a while. By white space a mean the screen stays white for a short period of time before displaying content.

Reviewed By: fkgozali, JoshuaGross

Differential Revision: D16762443

fbshipit-source-id: 5a2a880b0f5345f268291c86811264f42f6058b3
2019-08-12 10:52:44 -07:00
Samuel Susla 5cde7d29a3 Fix handling of failed image downloads
Summary:
If you have following scenario

1. Have <Image> component with valid URL
2. Due to user action set <Image> to incorrect URL (something that 404s)

Currently 1st image stay visible to the user.
This is the case for both Fabric and Paper.

Paper is being fixed -> https://github.com/facebook/react-native/pull/25919

Reviewed By: fkgozali

Differential Revision: D16708532

fbshipit-source-id: ffdea5421faead4730e7b117a3b9f6e21869da70
2019-08-12 09:32:25 -07:00
Michał Pierzchała 5edd1c674c - Bump CLI to ^3.0.0-alpha.1 (#26028)
Summary:
Bumps the CLI to v3 alpha which includes Metro 0.56

## Changelog

[Internal] [Changed] - Bump CLI to ^3.0.0-alpha.1
Pull Request resolved: https://github.com/facebook/react-native/pull/26028

Test Plan: None

Differential Revision: D16763732

Pulled By: cpojer

fbshipit-source-id: 8f35fb80913f623cb44d37208f49040d4a33b07b
2019-08-12 09:11:04 -07:00