Commit Graph

13929 Commits

Author SHA1 Message Date
Valentin Shergin 483c45cff0 Fabric: Shadow node shallowing was removed from preventive cloning in UIManager
Summary:
@public
We do preventing cloning in UIManager especially to add a layer to Shadow Node source chain,
so apparently there is no point illuminate that by calling `shallowSourceNode`.

Reviewed By: fkgozali

Differential Revision: D8585163

fbshipit-source-id: 3743edc30bf2183c420fd79ce1e59d68ceaa278b
2018-06-22 11:57:41 -07:00
Valentin Shergin 48b9a6f887 Fabric: Temporary experimental integration between old and new UIManagers
Summary:
@public
We need this to enable measuring, responder-chain management and another features powered by UIManager commands.
As soon we have Fabric specifc command-delivery pipeline this must be reverted.

Reviewed By: fkgozali

Differential Revision: D8552360

fbshipit-source-id: d56e12d38c32d8ad98cb230671bac1f35e87e647
2018-06-22 11:57:41 -07:00
Valentin Shergin af75d93dad Fabric: Bunch of unimplemented yet component was aliased to <View>
Summary:
@public
We need this temporary for testing until we support them all.

Reviewed By: mdvacca

Differential Revision: D8552361

fbshipit-source-id: 25f48cebcf5a665a24b92803dd7738f947ca74b2
2018-06-22 11:57:41 -07:00
Valentin Shergin 36c052ad96 Fabric: Default support of `displayType` and `layoutDirection` layout metrics
Summary:
@public
Quite trivial.

Reviewed By: mdvacca

Differential Revision: D8528922

fbshipit-source-id: 1e21f988317eecc7aa659fd9b51600b9e2b7d69f
2018-06-22 11:57:40 -07:00
Valentin Shergin 803c14bd98 Fabric: Support for uniformed borders of <View>
Summary:
@public
For now we only support trivial uniformed (all sides are equal) border rendering (which can be direclty mapped to CALayer features).
Support of the more complex and fancy borders is comming soon.

Reviewed By: mdvacca

Differential Revision: D8528923

fbshipit-source-id: 0883cdc2b855fc63d399e1a93010f259f0628f48
2018-06-22 11:57:40 -07:00
Valentin Shergin ad78971569 Fabric: Added support of `accessibilityCustomActions` for <View>
Summary:
@public
Another small but important piece of Accessibility Support.

Reviewed By: mdvacca

Differential Revision: D8528921

fbshipit-source-id: d4ba87bab702d76a90e9ddb751999193243cdc74
2018-06-22 11:57:40 -07:00
Valentin Shergin 3ea4a3309f Fabric: Conversion functions between NSString and std::string
Summary:
@public
Trivial. It's also nice this we have a default encoding now.

Reviewed By: fkgozali

Differential Revision: D8528919

fbshipit-source-id: 0853eca828f22ead1a337fea3d7a2fc9a48e84c8
2018-06-22 11:57:39 -07:00
David Vacca 93b568cc51 Add sealing assertion in fabric
Summary: This diff checks if ReactShadowNode is sealed before updaing it.

Reviewed By: fkgozali

Differential Revision: D8584768

fbshipit-source-id: 64163d4bf124263d92153f68914c617f007fd90d
2018-06-22 11:36:04 -07:00
David Vacca 001e217f33 Introduce "Sealing" of ReactShadowNodes
Summary: This diff introduces the concept of "Seal" ReactShadowNodes. This new field will be used to guarantee immutability of commited ReactShodow Nodes.

Reviewed By: fkgozali

Differential Revision: D8552709

fbshipit-source-id: dfd95730f10341af0dd762f8a8aa186563cf33e9
2018-06-22 11:36:04 -07:00
David Vacca f19c36116c Clean-up parent / owner reference of children during clonning
Summary: This diff cleans up the parent / owner references for children of ReactShadowNode / YogaNode during cloning. The reason of this behavior is to avoid retaining every generation of trees during cloning. This fixes a memory leak detected when running the ProgressBarExample.android.js in catalyst app

Reviewed By: fkgozali

Differential Revision: D8019894

fbshipit-source-id: b0d38f0c836ffec534f64fa1adbd7511ecf3473d
2018-06-22 11:36:04 -07:00
Ziqi Chen 74627d4833 Revert D8528543: Added Ignore color inversion prop to components in marketplace
Differential Revision:
D8528543

Original commit changeset: 63caf592bc71

fbshipit-source-id: 7bfcfbba744ac1e15753f52aebe104f53e5e9d5f
2018-06-22 11:02:35 -07:00
Rafael Oleza 33ba5e8fa2 Stop using projectRoots from RN cli
Summary:
This diff tries to fix an issue that started appearing in RN master when the latest metro version is used (more info here: c5ce762697 (commitcomment-29443117)).

The problem is that RN is still reading `projectRoots` from the Metro config and trying to call `concat()` on them. Latest Metro sets the default `projectRoots` to null, so this fails.

Also, a couple other things have been done:

* Make sure that the `projectRoot` and `watchFolder` objects from args are passed to Metro (so they contain the overrides from the CLI arguments).
* Add a `--projectRoot` CLI arg, replacing the `--root` one (this is not actually needed, since it does the same as `--watchFolders`

Differential Revision: D8567229

fbshipit-source-id: 3b76fd8e23d201a4097e9dfba3a512d64f348cb0
2018-06-22 08:17:57 -07:00
Valentin Shergin 8ef539e0c2 Fabric: `fromDynamic`: Parsing vector type when source has no array
Summary:
@public
If some prop has `std::vector` type, it possible that on JS side we want to pass just one element of the array.
And in this case we sometimes drop array initialization (`[]`) part, so instead of passing `[{x:1, y:1}]` we pass `{x:1, y:1}`.
This diff adds support for that.

Reviewed By: mdvacca

Differential Revision: D8526572

fbshipit-source-id: 33d4369ac48cac3eb1c534f477d8259e76e0c547
2018-06-22 07:32:50 -07:00
Valentin Shergin f6aa5db0e4 Fabric: RCTImageComponentView
Summary:
@public
This is iOS-specific implementation of <Image> view.
Not all props and features are supported yet.
Known issues:
 - Animated GIFs;
 - CA transitions during image appearance.

Reviewed By: mdvacca

Differential Revision: D8526570

fbshipit-source-id: a4b1dca583b139b8a09431565a79f051fae67a36
2018-06-22 07:32:50 -07:00
Valentin Shergin b09457b4d2 Fabric: <Image> component, xplat part
Summary:
@public
This diff implements basics of cross-platform part of <Image> component.
Known issues:
- Events does not work yet.
- Some quite specific image source parameters (like custom http headers) are not supported yet.

Reviewed By: fkgozali

Differential Revision: D8526575

fbshipit-source-id: ecc97d9fda2b2e65bb1b079af057f8e176a161e5
2018-06-22 07:32:50 -07:00
Valentin Shergin 979ea2094e Fabric: Introducing ImageManager
Summary:
@public
ImageManager coordinates all work related to loading image bitmaps for <Image> component.
The particular iOS implementation uses RCTImageLoader from RCTImage module under the hood.

Reviewed By: fkgozali

Differential Revision: D8526571

fbshipit-source-id: a0d927972d30113eed6e0cd169fceee17610181d
2018-06-22 07:32:49 -07:00
Valentin Shergin eabf29e320 Fabric: Getting rid of many `auto &&`
Summary:
@public
After reading about move-semantic and rvalue refs I realized that we (I) definitely overuse  `auto &&` (aka universal reference) construction. Even if this is harmless, does not look good and idiomatic.
Whenever I used that from a semantical point of view I always meant  "I need an alias for this" which is actually "read-only reference" which is `const auto &`.
This is also fit good to our policy where "everything is const (immutable) by default".
Hence I change that to how it should be.

Reviewed By: fkgozali

Differential Revision: D8475637

fbshipit-source-id: 0a691ededa0e798db8ffa053bff0f400913ab7b8
2018-06-22 07:32:49 -07:00
Valentin Shergin c674303dfd Fabric: Introducing `ContextContainer`
Summary:
@public
`ContextContainer` is general purpose DI container for Fabric.
We need this to communicate some enviroment-specific and/or platform-specific modules down to cross-platform C++ code.
The first one will be ImageManager. Soon.

Reviewed By: fkgozali

Differential Revision: D8475636

fbshipit-source-id: 0afc65063f818d0bab736cd2c55c6fdd21b629ac
2018-06-22 07:32:49 -07:00
Valentin Shergin 0a20f47021 Fabric: Proxying `pointScaleFactor` to Yoga Config
Summary:
@public
This diff changes how we store and manage Yoga Config in layoutable shadow nodes.
Previously we have `shared_ptr` to single shared yoga config (one to many relationships); now we initiate and store yoga config with yoga node (one to one relationship).
Cons:
 - Less memory efficient.
Pros:
 - Much more flexible model. Configuration can be tweaked on a per-node basis.
 - More performant. Dealing with `shared_ptr` is expensive because of atomic ref-counter. (This is not really applicable for the previous approach but would be applicable for any alternate approach where we want to have more granular control of the configuration.) Data locality is also great in the new model which should positively impact performance.
 - Simplicity. Any alternate approach where we manage sets of nodes which share the same configuration is going to be quite complex.

Reviewed By: fkgozali

Differential Revision: D8475638

fbshipit-source-id: 5d73116718ced8e4b2d31d857bb9aac69eb69f2b
2018-06-22 07:32:49 -07:00
Valentin Shergin a3f9ff4f93 Fabric: `pointScaleFactor` is now part of LayoutContext and LayoutMetrics
Summary:
@public
... and we initalize this in Surface.
We need this for requesting images with proper size/pixel-density, setup proper parameters for rasterizing CALayer's and rounding layout metric values.
Then we have to figure out how to wire this up with YGConfig.

Reviewed By: fkgozali

Differential Revision: D8475639

fbshipit-source-id: cec7af581b94efb4595dcf3f232252ce87a1fde3
2018-06-22 07:32:49 -07:00
Valentin Shergin 62a458bcea Fabric: Using `rootTag` instead of deprecated `rootViewTag` in SurfacePresenter
Summary:
@public
Trivial.

Reviewed By: mdvacca

Differential Revision: D8473512

fbshipit-source-id: 7b6c160a2a1a1abcd571b0522760d49644632922
2018-06-22 07:32:49 -07:00
Valentin Shergin eff76d237b Fabric: Using proper encoding for converting user-facing strings to NSString
Summary:
@public
Trivial.

Reviewed By: fkgozali

Differential Revision: D8473507

fbshipit-source-id: 49c9e66dc6b32b0a5208aeb4c2fb68fbe1f71738
2018-06-22 07:32:49 -07:00
Sam Goldman 6264b6932a Deploy Flow v0.75.0 to fbsource
Summary:
bypass-lint
allow-large-files

Reviewed By: gabelevi

Differential Revision: D8579147

fbshipit-source-id: 12280dd4872551247ff9baafab3d766d3d7a544a
2018-06-21 20:01:40 -07:00
Ziqi Chen 68a245436d Added Ignore color inversion prop to components in marketplace
Summary:
Added Smart Inversion Compatibility to Marketplace on iOS so that photos don't appear inverted
Added Property to View for Ignoring Color Inversion
Applied Property to Images on marketplace.

**Note: Android doesn't support smart inversion

Reviewed By: PeteTheHeat

Differential Revision: D8528543

fbshipit-source-id: 63caf592bc71e6fe9db7e70c72b56d32873be048
2018-06-21 16:47:22 -07:00
Ziqi Chen af226078e7 Added Accessibility Feature for RN to support Smart Inversion for photos
Summary:
@public
Added a property `accessibilityIgnoresInvertColors (boolean)`  to Views which allows the Apple API `accessibilityIgnoresInvertColors` to be used in React Native.
Now, when a user has Display: Smart Invert enabled, you can set the property to be true, and things like photos and views with the property set to true will no longer be inverted when Smart Invert is enabled.

This property can also be applied to the Image Component.

Example Use Case:

```
<Image accessibilityIgnoresInvertColors={true} />
```
```
<View accessibilityIgnoresInvertColors={true} />
```

| Before | After |
| ------ | ----- |
| ![original](https://user-images.githubusercontent.com/165856/41738737-b62c6ebc-7547-11e8-8ea3-f82239998071.jpg) | ![feeditem](https://user-images.githubusercontent.com/165856/41738749-beef6de2-7547-11e8-9771-b44e513de0fd.jpg)

Reviewed By: PeteTheHeat

Differential Revision: D8549084

fbshipit-source-id: 82a3bc73c9e6d75d6b50ba013b88127f07692641
2018-06-21 15:31:55 -07:00
Kevin Gozali 20a8673b48 iOS: create EventTarget when creating EventEmitter and keep it until the emitter is deallocated.
Summary:
@public
There are some race conditions between VM objects getting deallocated and the instanceHandle held by the eventEmitter can point to deallocated memory space, causing undefined behavior like a crash.
For now, keep a strong ref to the eventTarget inside EventEmitter to avoid that scenario. This is a temporary workaround.

Reviewed By: shergin

Differential Revision: D8576785

fbshipit-source-id: 87ef36f716270ceca906b32bb86e0046ceaca19e
2018-06-21 14:35:39 -07:00
Eli White 0cca01b16e Fix broken default for Image.ios.js resizeMode back to cover
Summary:
I broke this on a previous change:

https://pxl.cl/fh2n

This caused server snapshot tests to fail: https://our.intern.facebook.com/intern/testinfra/screenshots_reports?report_id=88925

Reviewed By: mmmulani

Differential Revision: D8576282

fbshipit-source-id: 03217c6b68dca63cba67f9ac04cf39bbc24e91eb
2018-06-21 12:01:29 -07:00
Bowen Li 886d70516e Adding custom view to swipeable component
Summary: as title

Reviewed By: fred2028

Differential Revision: D8550184

fbshipit-source-id: 5ba72538fae11d75a82568774dd937b4493e7292
2018-06-21 10:33:07 -07:00
Eli White 8de402d754 Flow type Image.android.js
Summary: This brings Image a bit more inline with the .ios.js counterpart.

Reviewed By: yungsters

Differential Revision: D8557495

fbshipit-source-id: 263da529d1a2541b0168745c0141c3fc622a1883
2018-06-21 00:01:45 -07:00
Eli White 4c6dece09c Animated Example using Image
Summary: Need to test a potential issue with Animated.Image on Android. Adding a RNTester example to exercise it.

Reviewed By: yungsters

Differential Revision: D8559440

fbshipit-source-id: 4319d958de146c177cb0bd4b84679b773ce50833
2018-06-20 23:48:18 -07:00
Rafael Oleza 04fa721ed5 Bump metro@0.40.0
Summary:
@public

This new version of metro replaces the `getProjectRoots()` config param by `getProjectRoot()` (which is used as the main folder for calculating relative paths of files, etc) and `getWatchFolders()` (which is used to know which files/folder to crawl when starting metro).

More info: 3bdf386d14

[skip-ci]

Reviewed By: yungsters, mmmulani

Differential Revision: D8538986

fbshipit-source-id: 2afc33950334a278364debb39f34ef0fe0535894
2018-06-20 11:02:40 -07:00
Hoa Dinh adb6929b36 Fixed build eats
Reviewed By: skotchvail

Differential Revision: D8529938

fbshipit-source-id: 6a97d2c54757d7e75fe8731efe24704cf7fdf87c
2018-06-20 10:04:22 -07:00
Hoa Dinh 746b503024 Fixed RCTAssert()
Reviewed By: zats

Differential Revision: D8529663

fbshipit-source-id: ddedf1daa153f25bc62db19b8e1ace32b4ab3201
2018-06-20 09:47:41 -07:00
Eli White 5ae531cba7 Export Flow type for Image
Summary: Improving the exported type of Image on android so we can work on migrating the implementation off of createReactClass and propTypes.

Reviewed By: yungsters

Differential Revision: D8530549

fbshipit-source-id: dab0cb5034464b7939a0b04e8912bae916690e8c
2018-06-20 09:47:41 -07:00
Eli White eea4842972 Flow strictify possible files in RN core
Summary:
This was done by running the command on: https://our.intern.facebook.com/intern/wiki/Flow_Strict/

```
ag -L --ignore __snapshots__ 'flow strict$|noflow|generated|partially-generated' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i 's/flow$/flow strict/'
cat ~/temp | xargs ag -L 'flow strict$' | xargs sed -i 's/flow strict-local$/flow strict/'
until flow; do flow --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done
```

Reviewed By: sahrens

Differential Revision: D8530207

fbshipit-source-id: c28c7ac5ed3e9b80f3d126d5f30463be8a8a744d
2018-06-20 00:47:21 -07:00
Eli White 9cfc2c0135 Add @flow-strict support to .flowconfig
Summary:
We enforce this config locally in fbsource, lets ensure our flow strict files are run the same way in the github repo.

@public

Reviewed By: sahrens

Differential Revision: D8530133

fbshipit-source-id: 18528992ad6490826431359d5d8c6acd6710a8ae
2018-06-20 00:01:46 -07:00
Pavlos Vinieratos 12410f3e4a Update Xcode projects (#19574)
Summary:
@public
A few people have been complaining, including me, that when we compile a react native project, there are a lot of warnings from xcode, suggesting to update the project build settings to the new recommendations.

I took the liberty to actually update the xcode projects, so we can finally have these gone, as well as replace some deprecated methods with the new suggested ones.

[IOS] [MINOR] [Xcode] - updated the Xcode projects with the latest suggestions from Xcode 9.3, and replaced a few deprecated methods of iOS with their new replacements.
Closes https://github.com/facebook/react-native/pull/19574

Reviewed By: shergin

Differential Revision: D8530135

Pulled By: hramos

fbshipit-source-id: b9c9ede0e07760cb2207caa6b468bd5c241848dc
2018-06-19 23:48:12 -07:00
Héctor Ramos eccf536ee9 Update PULL_REQUEST_TEMPLATE.md (#19813)
Summary:
Use colon after Test Plan to ensure the plan is copied to Facebook's internal Phabricator instance successfully.
Closes https://github.com/facebook/react-native/pull/19813

Differential Revision: D8530181

Pulled By: hramos

fbshipit-source-id: 83be6ecaca54a3c6fd4e47b08b8632976f5635aa
2018-06-19 23:48:12 -07:00
Eli White 35e233661d Remove unnecessary object check
Reviewed By: sahrens

Differential Revision: D8529727

fbshipit-source-id: 6b3659d3cdea70931a30e22a6acfd140091e8ad7
2018-06-19 23:10:53 -07:00
Eli White 64d9c48733 Image from createReactClass -> ES6 Class
Summary: These are the flow errors that resulted from this diff: P59723027

Reviewed By: sahrens

Differential Revision: D8454977

fbshipit-source-id: e10901d3ecfc541b25f2fefb18702629f0bbab71
2018-06-19 21:32:26 -07:00
Eli White 2455fd662b Tightening the flow types for Image
Reviewed By: sahrens

Differential Revision: D8529116

fbshipit-source-id: 5ce4a7737d8837ca9a9c94054e1d1182fb38c094
2018-06-19 21:32:26 -07:00
Eli White 66aeeff2f9 Include static properties in jest mocks for core components
Summary: This is necessary to provide things like `Image.prefetch` in Jest tests. Previously this only gave access to propTypes.

Reviewed By: sahrens

Differential Revision: D8526494

fbshipit-source-id: 11d49d95d6edf3f75c90438e0b629f5345bc980d
2018-06-19 21:32:26 -07:00
Kevin Gozali e7256a777e fix up double surface registration on JS load
Summary:
@public
When JS first starts up, Fabric surface end up double registering itself, causing events to not work. So let's guard it so that registration happens only on reload case.

Reviewed By: shergin

Differential Revision: D8521002

fbshipit-source-id: 441f121786e860dc10e959e940b411c2afaf96dc
2018-06-19 18:47:41 -07:00
Kevin Gozali 7b9b1559a7 iOS: Avoid double reload event when reloading JS
Summary:
@public
The bridge may send the reload event twice when reloading JS in some rare condition. The 2nd one was actually when the "new" bridge wasn't valid yet, so log an error if that happens. This may happen if the connection to Metro server gets into a weird state. Restarting Metro would solve the problem.

The issue was that `RCTBridgeWillReloadNotification` fired twice for each reload with metro connected.

Reviewed By: mmmulani

Differential Revision: D8509448

fbshipit-source-id: 647fb98c0a97503409a10451b8f152145947ae20
2018-06-19 18:47:41 -07:00
David Vacca 73c4df219a Avoid loading FabricUIManager from UIManagerModule in setJSResponder method
Summary:
In D8515300 we used the uiManagerType to call the setJSResponder method in UIImplementation or FabricUIManager.
There is a small chance that one of the reactTags received by parameter belongs to a View that is not managed by ReactNative, in that case we could be try to use FabricUIManager from UIManagerModule when Fabric is not running yet, causing a RN crash.
The fix consists in keep calling the UIImplementation.setJSResponder() method for any reactTag, and then perform a NOOP if the ReactShadowNode can not be found.

Reviewed By: fkgozali

Differential Revision: D8518192

fbshipit-source-id: 954fdd5dbed758ef73c16dad7da6b59ed83fe46a
2018-06-19 14:47:22 -07:00
Spencer Ahrens 76eebce3c2 Fix more forwardRef displayNames
Summary:
See https://reactjs.org/docs/forwarding-refs.html#displaying-a-custom-name-in-devtools

reapply of D8342904

Reviewed By: yungsters

Differential Revision: D8465006

fbshipit-source-id: f196f39b9b1c9bbe16a845667ebbdb21953a5848
2018-06-19 14:17:19 -07:00
Alexey Kureev c5ce762697 Replace projectRoots with projectRoot + watchRoots
Summary:
We use projectRoots to limit crawling of jest-haste-map in large codebases. Since this implies multiple projects roots, it makes it very hard (or impossible) to reliably cache dependency resolutions.

If we can replace this with a single project root and a set of watch roots, we can have relative path resolutions for all dependencies which van be cached.

Reviewed By: rafeca

Differential Revision: D8450498

fbshipit-source-id: 830c21e847c3236e42d5414a8587508cb73864bd
2018-06-19 13:47:32 -07:00
Jeff Thomas d7e0fe2c2c AssetsLibrary.framework --> Photos.framework; ReactNative stuff
Summary:
AssetsLibrary.framework --> Photos.framework;  ReactNative

Port RN off of AssetsLibrary where trivial, lazy load AssetsLibrary where remaining.

Reviewed By: fkgozali

Differential Revision: D7999924

fbshipit-source-id: 1d48a2d820984564459ed43680cd3f601399d352
2018-06-19 13:32:16 -07:00
David Vacca c6a52b6db6 Fix setJSResponder for Fabric
Summary:
Before this fix, ReactNative screens that uses the Fabric renderer crashes when an event is dispatched. The root cause of the bug is that React JS executes the setJSResponder method in UIManagerModule, but this method is not implemented yet in Fabric.

This fix will have to be picked into current RC to fix events into the City Guides screen running the Fabric experiment

Reviewed By: fkgozali

Differential Revision: D8515300

fbshipit-source-id: 40fe2f77987470abed8164f848680a911efa4bd2
2018-06-19 10:48:18 -07:00
Pavlos Vinieratos 5f9a2117bf Remove some methods that have `NS_UNAVAILABLE` set (#19790)
Summary:
These lines were causing erros with the e2e tests on ios.
There are some methods that are not going to be called, and some definitions that are not correct.

needed for #19574.

we will run the e2e tests.

[INTERNAL] [MINOR] [Tests] - Fix some definitions.
Closes https://github.com/facebook/react-native/pull/19790

Differential Revision: D8509228

Pulled By: hramos

fbshipit-source-id: 78650e347db52305a587e3461ac56877e3c79062
2018-06-19 02:18:01 -07:00