Commit Graph

13861 Commits

Author SHA1 Message Date
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
Hoa Dinh e11cdc917c Fixed RCTAssert nullability
Summary:
```
Apps/Instagram/AppLibraries/IGReactKit/IGReactKit/IGReactRouteHelpers.m:54:5: error: implicit conversion from nullable pointer 'NSString * _Nullable' to non-nullable pointer type 'NSString * _Nonnull' [-Werror,-Wnullable-to-nonnull-conversion]
    RCTAssert(!(title != nil && logoAsTitle), @"Screen navigationOptions cannot have both title and logoAsTitle.");
    ^
Apps/Instagram/AppLibraries/IGReactKit/IGReactKit/IGReactRouteHelpers.m:54:5: error: implicit conversion from nullable pointer 'NSString * _Nullable' to non-nullable pointer type 'NSString * _Nonnull' [-Werror,-Wnullable-to-nonnull-conversion]
/data/sandcastle/boxes/trunk-hg-fbobjc-fbsource/xplat/js/react-native-github/React/Base/RCTAssert.h:28:14: note: expanded from macro 'RCTAssert'
        file:@(__FILE__) lineNumber:__LINE__ description:__VA_ARGS__]; \

```

Reviewed By: zats

Differential Revision: D8509133

fbshipit-source-id: ae7027efc18716193c86fbeeec74d41d1879797f
2018-06-18 23:46:15 -07:00
Valentin Shergin 9a59428468 Fabric: Fixed `Identity Transform` matrix literal
Summary:
@public
As Janic janicduplessis mentioned on GH the literal should be slightly different.
8df7d51600 (r29390543)

And here is prooflink: https://developer.apple.com/documentation/quartzcore/calayer/identity_transform?language=objc

Thanks Janic!

Created from Diffusion's 'Open in Editor' feature.

Reviewed By: fkgozali

Differential Revision: D8508559

fbshipit-source-id: 7427be36e041bf500bee1e06d2293f7b5ea8cf21
2018-06-18 23:02:41 -07:00
Eli White 843a433e87 Update react-native init's flowconfig
Summary:
Fixes https://github.com/facebook/react-native/issues/19766

On a clean project flow was complaining about `Cannot resolve module X` because of the removal of `providesModule`. This resolves the errors.

Reviewed By: rubennorte

Differential Revision: D8500303

fbshipit-source-id: 4e129ee4382f8ff36ab126e9f6c6530254cd382e
2018-06-18 16:02:34 -07:00
Héctor Ramos aaddbee29e Revert D8489006: [react-native][PR] Update Xcode projects
Differential Revision:
D8489006

Original commit changeset: 2922b2e76aca

fbshipit-source-id: 84ba633b7e9a33b32e0a1347ebe6ca8bb1b02441
2018-06-18 12:18:02 -07:00
Pavlos Vinieratos 59b5743187 Update Xcode projects (#19574)
Summary:
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.

I made two react native projects, one with the regular react native and the other one using this branch.
Left is before, right is after:
![screen shot 2018-06-05 at 15 44 34](https://user-images.githubusercontent.com/100233/40979899-6aba12da-68d7-11e8-8630-6c3009b6dc24.png)

[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

Differential Revision: D8489006

Pulled By: hramos

fbshipit-source-id: 2922b2e76aca6883c4f5d04e9c511b9fc1029583
2018-06-18 11:17:18 -07:00
Dmitry Zakharov 2f53573d4f Fix Modules concurrent access
Reviewed By: fkgozali

Differential Revision: D8379392

fbshipit-source-id: 72495950ea5fcf37f5b1cc3413666879dfc81e5c
2018-06-18 07:47:26 -07:00
Michał Mokijewski a130239257 Make run-ios command play nicely with multiple Xcode versions (#19781)
Summary:
I started using Xcode 10 beta and spotted that even though react-native cli is using cli tools from Xcode 10 for building it tries to open simulator from Xcode 9.4. Turned out that path to simulator app is hardcoded and doesn’t care about active developer directory.

1. You have to have more than one Xcode version (ie. 9.4 and 10 beta).
2. Change active developer directory to Xcode beta (`xcode-select -s /Applications/Xcode-beta.app/Contents/Developer`).
3. Without fix `react-native run-ios` will open simulator from Xcode 9.4, with fix it'll open simulator from active developer directory.

[CLI][IOS] [BUGFIX] [./local-cli] - use simulator from active developer directory
Closes https://github.com/facebook/react-native/pull/19781

Differential Revision: D8475915

Pulled By: TheSavior

fbshipit-source-id: d607f1f9eb9e565d4a017c21de50b5e569d171f9
2018-06-17 23:01:49 -07:00
Valentin Shergin 310a2850c5 Fabric: Universal `fromDynamic` for `std::vector<...>`
Summary:
Now, if `fromDynamic` is defined for some type, `fromDynamic` for `std::vector` of this type is also will be defined.
We need this for parsing `ImageSources` (a vector of `ImageSource`) type.

Reviewed By: fkgozali

Differential Revision: D8473508

fbshipit-source-id: d8dc8e3a3273f35b76c7132c553130762f768394
2018-06-17 21:46:22 -07:00
Valentin Shergin d92601be05 Fabric: Improved parsing EdgeInsets and CornerInsets styles
Summary: In case if it's just a number, it is treated as unified insets now.

Reviewed By: mdvacca

Differential Revision: D8473510

fbshipit-source-id: 1034377bc3e4abe55778c2f182360345419f00d5
2018-06-17 21:46:22 -07:00
Valentin Shergin c1e0ea9d38 Fabric: Fixed erratum in "borderRadius" prop name
Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D8473506

fbshipit-source-id: ce2888edc1052f39a042904c02b3ac347feedbba
2018-06-17 21:46:22 -07:00
Valentin Shergin dca2067b71 Fabric: Fixed error in parsing translateX/translateY prop
Summary: Quite trivial.

Reviewed By: mdvacca

Differential Revision: D8473513

fbshipit-source-id: 5d20244cbaae5ea69c79379e9894adb05cef2eb5
2018-06-17 21:46:22 -07:00
Valentin Shergin 3b20a16703 Fabric: Fixed error in parsing `position` style
Summary: This style/prop is called `position` (not `positionType`) in RN/JS API.

Reviewed By: mdvacca

Differential Revision: D8473509

fbshipit-source-id: f381189e05e6b618f3c74f1bc4610e737981b388
2018-06-17 21:46:22 -07:00
Valentin Shergin e23a91e67b `Invalid JS responder` error was promoted to warning
Summary:
Given async nature of RN, it is quite possible situation, hence it should not be a redbox.
And in Fabric it happends all the time which makes debugging painful.

Reviewed By: mdvacca

Differential Revision: D8473511

fbshipit-source-id: cfe7a1d3d105fde3b23db4c4c07b99864215c94c
2018-06-17 21:46:22 -07:00
David Vacca e15a761084 Add noop support for setJSResponder / clearJSReponder API methods
Reviewed By: fkgozali

Differential Revision: D8458980

fbshipit-source-id: 2411fb8106288f65cabdef12917d0f5086d1723a
2018-06-17 11:53:34 -07:00
David Vacca 936de607b1 Add support to receive null payload in events
Reviewed By: shergin

Differential Revision: D8439118

fbshipit-source-id: a45da18765d58f6e32d34e2e57f3a6a64daccf71
2018-06-17 11:53:34 -07:00
David Vacca a7e8e72c51 Moving more logs from Log -> Flog
Reviewed By: fkgozali

Differential Revision: D8433247

fbshipit-source-id: e666fbf2abb81697ba6fb508c149af8a1a2035f1
2018-06-17 11:53:33 -07:00
Héctor Ramos 15f84420f0 Enable CocoaPods tests, add parallelism (#19764)
Summary:
Enable CocoaPods test, iOS e2e.
Use parallelism to run several tests simultaneously within the same machine.

Circle CI
Closes https://github.com/facebook/react-native/pull/19764

Differential Revision: D8471955

Pulled By: hramos

fbshipit-source-id: c484fd6c66fb2d0d2305ced29e34cb305f73fb55
2018-06-16 15:55:49 -07:00
Dulmandakh 9e4a4323b1 limit ndk jobs for RNTester on CI (#19755)
Summary:
Limit number of NDK jobs of ReactAndroid on CI using $BUILD_THREADS environment variable. Otherwise, it was spawning 32 jobs while building RNTester, which caused in OOM or unexpected failure.

CI: https://circleci.com/gh/dulmandakh/react-native/387

Android CI is green again 😍
Closes https://github.com/facebook/react-native/pull/19755

Differential Revision: D8466069

Pulled By: hramos

fbshipit-source-id: fd507d12c8e93f718e047719daa68aa25c37bfb2
2018-06-16 01:31:32 -07:00