Commit Graph

14162 Commits

Author SHA1 Message Date
Scott Wolchok 6ab52ff90d Remove some unnecessary `const float &` uses
Summary: Holding floats by reference is unnecessary at best and may be detrimental to performance.

Reviewed By: davidaurelio

Differential Revision: D8826496

fbshipit-source-id: 2391f8aa26ebfbb440f6e4b7d57975be688f791c
2018-07-13 12:48:02 -07:00
Scott Wolchok 727ee92de5 Tidy up YGFloatOptional further
Summary: I missed these two things: inline default ctor, getValue() should return a float.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8826640

fbshipit-source-id: e6324dea0268ef276e6fa1722e72dffb5241e676
2018-07-13 12:48:02 -07:00
Scott Wolchok e589595bc9 YGNode::getChildren() should return const ref
Summary:
It's wasteful to do it by value. I'm fairly sure this is
safe, especially because
fbd332dee8 (diff-ade2a4bbd6582e2898cbd9e0fa142ab5R215)
shows that we did access by reference before.

Reviewed By: priteshrnandgaonkar, davidaurelio

Differential Revision: D8822697

fbshipit-source-id: 791bcf0fa37453f67795af727c85c8adce3b0f69
2018-07-13 12:48:02 -07:00
Ziqi Chen e739143809 added in the three roles: search, adjustable, link that require localization
Summary:
Added the android functionality for those three roles: search, adjustable, and link.
Until React Native internal framework ports internationalization and localization of strings, I'll handle localization by allowing an extra prop to be passed in that can override talkback's description in another language if needed.

Reviewed By: blavalla

Differential Revision: D8807692

fbshipit-source-id: b51877d187cb6cb663d65d6b4d072e6dc52a2d03
2018-07-12 23:47:12 -07:00
Ziqi Chen d0b86ecb4f added in the three roles: search, adjustable, link that require localization
Summary:
Added in props for three more roles:
link, search, and adjustable

Reviewed By: blavalla

Differential Revision: D8788186

fbshipit-source-id: acd1d667a43bea753964d128bd4525ece90d06b3
2018-07-12 23:47:12 -07:00
Tim Yung 6ed6bffe4e RN: Ignore Unused Rest Property Siblings
Summary:
Configures ESLint to allow unused variables that are the sibling of a rest property.

For example:

```
// It is okay for `type` to be unused.
const {type, ...coords} = data;
```

Reviewed By: TheSavior

Differential Revision: D8779952

fbshipit-source-id: 1f7b756a75d9363b85e05209ce2a9bb536c5d4da
2018-07-12 16:31:32 -07:00
Michael Ficaro a2675ced4e Adding new styling props to FlatList/VirtualizedList for ListHeaderComponent and ListFooterComponent
Summary:
We ran into a problem trying to style the optional prop `ListHeaderComponent` in the `FlatList` library component. Essentially we wanted to make `ListHeaderComponent` a flex item that filled all of the empty space in the list if there was any. Unfortunately the `ListHeaderComponent` is later wrapped in a `View` that blocked our styling. The `View` component was necessary as it added styling to handle inverting the `FlatList`. Similarly `ListFooterComponent` was handled the same way.

We came up the simple solution of adding two new optional props, `ListHeaderComponentStyle` and `ListFooterComponentStyle`, that are of type `ViewStyleProp` that allow users to pass in styling for `ListHeaderComponent` and `ListFooterComponent`.

With this change we were able to do something like the following to get the header component to fill all empty space in the `FlatList`.

```
<FlatList
    ...
    contentContainerStyle={{flexGrow: 1}}
    ListHeaderComponent={<View style={{flex: 1}} />}
    ListHeaderComponentStyle={{flexGrow: 1}}
    ...
/>
```
This solution will give users a lot more freedom when working with headers and footers.

Reviewed By: sahrens

Differential Revision: D8777038

fbshipit-source-id: f34116ce68548ea70223e639d0f84a099327f6b3
2018-07-12 13:49:08 -07:00
Yuanda Tang 8ee60e9b0d Cleanup clang compiler warnings
Summary:
Cleanup clang compiler warnings.
The last version delete some variables that still used in code.
Fix the problem and try to launch again.

Reviewed By: hershi

Differential Revision: D8704442

fbshipit-source-id: 8bd37fc9f2b27104fe15c4c8b8323e2bfd8c1060
2018-07-12 13:22:22 -07:00
Rubén Norte 724c7498b6 Upgraded Babel to v7.0.0-beta.48
Summary:
This is the same version we're using on www. It has support for new Flow syntax and we need it on fbsource too.

allow_many_files
allow-large-files

Differential Revision: D8819980

fbshipit-source-id: 736d6d93ad879311e638da00873ca2acf42d1422
2018-07-12 12:47:01 -07:00
Ziqi Chen f39d0923c7 removed tabbar for iOS 9 compatibility issues
Summary: Removed Accessibility Trait TabBar for iOS compatibility Issues, since tabbar is only available on iOS 10+

Reviewed By: PeteTheHeat

Differential Revision: D8822469

fbshipit-source-id: 34bf00eb930f631a5a4effa0a4159da07c1573f6
2018-07-12 12:32:03 -07:00
Mehdi Mulani 934c50fbe0 Fix crash in RCTImagePicker on iOS
Summary:
@public
Apparently if you select images really quickly, the app will crash.

Reviewed By: shergin

Differential Revision: D8796730

fbshipit-source-id: 81a652d9c8997ee9e83bbee3378954a6718a9b5d
2018-07-12 10:33:01 -07:00
Scott Wolchok 7eb419d4bf Tidy up YGFloatOptional
Summary: Just some convention/weird style things. `float` should be passed by value, weird use of ?: operator instead of ||.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8804407

fbshipit-source-id: e0d67363ccde36ec5bccec7497ed0ffd364b3fcf
2018-07-12 08:46:36 -07:00
Tim Yung d756d94b3a RN: Workaround for ReactNativeART on Android
Summary:
Brings back the fix for `overflow: hidden` on Android by implementing a workaround for a bug with `ReactNativeART`.

The ReactNativeART bug is that changes in the canvas due to a resize of the `Surface` are not properly reflected on Android. I have verified that the correct props are being computed and passed to the shadow nodes and that the `ARTSurfaceView`'s canvas is indeed updated. But for some reason, the paint is not updated.

This workaround is to simply unmount and remount `Surface` on Android. It sucks and we should eventually fix it.

Reviewed By: achen1

Differential Revision: D8818010

fbshipit-source-id: 71d1927580b6bde7263fd241797d4655140b5f34
2018-07-12 08:02:16 -07:00
David Aurelio b5f027dd77 Add `YogaNodeProperties` interface
Summary:
`YogaNodeProperties` will serve as abstraction over JNI adapters / storage backends in follow-ups.

@public

Reviewed By: IanChilds

Differential Revision: D8818805

fbshipit-source-id: 7998a56daebea60dd13b07228dffdf14be852554
2018-07-12 08:02:15 -07:00
slorber f0d35904c9 Add missing tests for Animated.forkEvent (#20111)
Summary:
`forkEvent` is generally used to intercept an existing listener and add a new js listener to it, considering the original listener can be null/js/Animated.event(). I added tests to ensure the 3 cases of the implementation are all covered.
Pull Request resolved: https://github.com/facebook/react-native/pull/20111

Differential Revision: D8817500

Pulled By: hramos

fbshipit-source-id: 1a20b6f73e2d47bbefccd31378764909a45e89bb
2018-07-11 22:32:02 -07:00
Taras Tsugrii 78137bc31a Update deprecated glob usages.
Summary: https://our.intern.facebook.com/intern/wiki/Buck/python-to-skylark/

Reviewed By: davidaurelio

Differential Revision: D8795050

fbshipit-source-id: 1599a0a9ddd9af54a86884291945a93b91ba31bd
2018-07-11 11:02:41 -07:00
David Aurelio a08e8d07d0 Lint java files
Summary:
@public

Applies lint auto-fixes to java files.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8803814

fbshipit-source-id: 2e4dc285b233091a9fbadf38fc22dd6e36f11f8e
2018-07-11 09:47:26 -07:00
Scott Wolchok 40cdda3166 Inline simple YGNode getters/setters
Summary: Simple getters/setters are usually inlined like this.

Reviewed By: priteshrnandgaonkar, davidaurelio

Differential Revision: D8793588

fbshipit-source-id: 436bd54880e41a5e403e3f4ae0d9dd4a413df79c
2018-07-11 09:02:21 -07:00
Scott Wolchok 4858454718 Remove unused YGNode::*nextChild
Summary: This linked list was never used, and YGNodeDeepClone was doing scary things to maintain it.

Reviewed By: davidaurelio

Differential Revision: D8792864

fbshipit-source-id: c578fabe65c837f0791aa9ac3e18f31d93691abd
2018-07-11 09:02:21 -07:00
Miguel Jimenez Esun 00936a003c Upgrade Jest to v23.4.0
Summary: Upgrade Jest to the latest version.

Differential Revision: D8784710

fbshipit-source-id: 2319bf0d11506c1c0ad0506ba38a76e07f8feb3b
2018-07-11 06:47:34 -07:00
Pritesh Nandgaonkar 90a408ea6f Fix SingleFlex Child condition
Summary:
Fixes the improper `singleFlexChild` optimization. In the case when all the childs have `flex-grow:0 flex-grow:0` except one child with `flex-grow:1 flex-shrink:1`, then one can simply measure all the non-flexing children and then give the flexing child all the remaining space.

Also added a test case which reproduced the bug

Reviewed By: IanChilds

Differential Revision: D8782684

fbshipit-source-id: ffd4d35b6122f82111b987540efb23bd2a8da5a2
2018-07-11 06:02:16 -07:00
Martin Sherburn 578b0b2a51 Fixed issue with reloading bundle from remote debugger
Summary: This is a follow up to D8316215. That diff had a flaw in that once appExecuted was set to true it would never be reset back to false. This fixes that so if another bundle is loaded after the first one it will work.

Reviewed By: rafeca

Differential Revision: D8661523

fbshipit-source-id: 5f6024102248383f64952fd33b37368732d5f900
2018-07-11 04:31:14 -07:00
David Aurelio 1535ecfa54 guards instead of nested if
Summary:
Replaces two nested if-blocks with guards. This is intended to help with restructuring this function in follow-ups.

@public

Reviewed By: priteshrnandgaonkar

Differential Revision: D8785659

fbshipit-source-id: 7b9d63e9814b83b999397c016ad67ad348bb0f72
2018-07-11 04:16:19 -07:00
David Aurelio 7abbd703d4 Lint / reformat `YGJNI.cpp`
Summary:
Run clangformat on `YGJNI.cpp`

@public

Reviewed By: priteshrnandgaonkar

Differential Revision: D8785660

fbshipit-source-id: 9748a5297e7b55e897de0280a79c2ea6ae1c1298
2018-07-11 04:16:19 -07:00
Ziqi Chen c27b495a89 added accessibilityRole Prop, added functionality support for role on android
Summary:
Added a new property to View for Accessibility called `accessibilityRole`. This property merges functionality of existing properties: `accessibilityTraits` (iOS) and `accessibilityComponentType` (android).

Currently, nine values are supported with equivalent behavior as `accessibilityTraits` (iOS) when `accessibilityRole` is set on iOS Voiceover and Android TalkBack

```
  | 'none'
  | 'button'
  | 'link'
  | 'search'
  | 'image'
  | 'keyboardkey'
  | 'text'
  | 'adjustable'
  | 'tabbar'
```
They currently support similar behavior on talkback on Android and voice over on iOS
Does not break functionality of existing properties, but have not tested for behavior of setting both this one and the old one.

* iOS - I added a property accessibilityRoles, and basically remapped it to the same thing as accessibilityTraits. I also added in enum mappings for keyboardkey and tabbar.
* Android - Also added a property accessibilityRoles, from the Android side. For the underlying native functionality, I built a helper class that is based off of AccessibilityRolesUtil.java from the accessibility team. Biggest changes made are that I defined my own enums if needed, and also set some properties to match the functionality of iOS Accessibility Traits. I also handled the logic for switch/case statements of setting roles for the android side on this file. Also, I currently haven't localized strings for setRoleDescription, but plan to.
* Javascript - I added a view property accessibilityRoles in ViewPropTypes.

Reviewed By: blavalla

Differential Revision: D8756225

fbshipit-source-id: e03eec40cce86042551764f433e1defe7ee41b35
2018-07-10 12:18:27 -07:00
Ziqi Chen ef3d8b23c3 Unreverting Marketplace change for Inverted Color Ignorance
Summary:
Un-reverted Diff D8528543

Context:
Diff itself is the exact same as the old one. There's actually nothing wrong with this diff,
it was originally reverted because of iOS compatibility issue on exposing `accessibilityIgnoresInvertcolors` API to javascript, which has now been handled and fixed in this D8599698.
This means I can now set the property `accessibilityIgnoresInvertColors`

--------------------------
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: D8737594

fbshipit-source-id: 86080d45dec773ede4d3828fcda8870f546df691
2018-07-10 11:17:28 -07:00
Rafael Oleza 1ee6396c56 Bump metro@0.42.1
Summary:
@public

[skip-ci]

Reviewed By: mjesun

Differential Revision: D8781445

fbshipit-source-id: 32f2cbfeadbd2fb763078a046b779a16359c8bbd
2018-07-10 09:02:28 -07:00
Noam Schachter 1bb2bead8b Fixing Crush on SDK 15 (ICS) on ReactTextInputLocalData
Summary:
We had a crush reprot from Loadstone (manual tests) for RN standalone app on ICS, see:
https://our.intern.facebook.com/intern/tasks/view_inline_attachment/?attachment_id=2296063267087587&fbid=314266832445741

Seems like we are using TextView.getMinLines and TextView.getMaxLines - both added in SDK 16, witought a propert guard. see:
https://developer.android.com/reference/android/widget/TextView#getMinLines()
https://developer.android.com/reference/android/widget/TextView#getMaxLines()

Reviewed By: shergin

Differential Revision: D8763942

fbshipit-source-id: a56a6fc3e575b8ea97ddab983561df878b2f341c
2018-07-10 08:32:15 -07:00
Rafael Oleza a69c330347 Bump metro@0.42.0
Summary:
@public
[skip-ci]

Differential Revision: D8773719

fbshipit-source-id: d05f7060a45751ed14dc5479ff1135f35a38c432
2018-07-10 04:02:18 -07:00
Rubén Norte 0f2f0cad41 Upgrade ESLint to 5.1.0
Summary:
This release fixes several issues. Most importantly for us:

- https://github.com/eslint/eslint/issues/10560
- https://github.com/eslint/eslint/issues/10512

Differential Revision: D8767118

fbshipit-source-id: 2048829d780b5f0f2f607114f803c8d0c3e02ca7
2018-07-09 12:32:38 -07:00
Ziqi Chen 5aa040dfb7 added property accessibility IgnoresInvertColors to proptypes
Summary: Added property accessibilityIgnoresInvertColors to ViewPropTypes.

Reviewed By: PeteTheHeat

Differential Revision: D8735443

fbshipit-source-id: ac526779b7f92ceab074de75a2bf61752e7e90c6
2018-07-09 11:02:50 -07:00
Rubén Norte abf1188de2 Upgraded babel-eslint to v9.0.0-beta.2 with better support for Flow
Summary: Upgraded the library to fix an error in Babel causing wrong unused variable errors.

Differential Revision: D8765952

fbshipit-source-id: 352d1bb50ada76caed247bf9aa4521eff2d510e9
2018-07-09 09:17:13 -07:00
Gabe Levi eac34e3021 Flow v0.76.0
Summary: No new errors in this version. Just removed a bunch of unused suppressions

Reviewed By: TheSavior

Differential Revision: D8754160

fbshipit-source-id: 2f02240b6d65edecba5d9ed603c7703462547a7f
2018-07-09 08:17:51 -07:00
Yan Soares Couto fc94f95962 Enable RCTDevLoadingView with another flag
Reviewed By: javache

Differential Revision: D8723591

fbshipit-source-id: 196cecd73ba0e1a1d34ec9a775cf03a25f352401
2018-07-09 03:32:48 -07:00
Wenting Hu 781f181610 Back out "[react-native][PR] Remove the deprecated `isIPhoneX_deprecated` constant"
Summary:
Original commit changeset: 0b0b3a2d7b80

This constant is still in use at Facebook. Its removal has been pushed to sometime in the future.

Reviewed By: mdvacca

Differential Revision: D8721213

fbshipit-source-id: d1197c96804e4d2dc96be27421e5248a2394cdac
2018-07-08 13:16:41 -07:00
Wen-Chien Chen b99609e9d2 Fix ScrollView logspew
Summary: There was an inverted expression leading to logspew. Fix this.

Reviewed By: TheSavior

Differential Revision: D8758023

fbshipit-source-id: 7a83c68db6c95f2b5db6dcc7d7780fc66321b49e
2018-07-08 00:32:30 -07:00
Konstantin Raev 604bcfa4a8 Revert D8683555: [react-native][PR] fix: account for `ListHeaderComponent` length when calculating offset…
Differential Revision:
D8683555

Original commit changeset: 05df7b79c16e

fbshipit-source-id: 6deb14b99fe04e67e264455ff92a5d8c1c2dd406
2018-07-06 19:32:21 -07:00
Valentin Shergin e8ec1cb16a Fabric: The diffing algorithm does not use source nodes anymore
Summary:
@public
... and it's as efficient as it was before.

The previous version of the algorithm used `sourceNode` reference to know the previous state of the node to call the algorithm recursively.
That wasn't so good because of several reasons:
 - It was fragile because we had two different sources of the truth of the "previous state of the tree": committed tree and source node pointer;
 - We had to store weak pointers to source nodes inside cloned nodes. That is not free in terms of performance;
 - The old approach introduced a constraint that all previously used and now reinserted nodes must be cloned to update source node (otherwise, the algorithm would regenerate instructions recreating already existing subtrees);
 - That cloning required access to `isSealed` flag which is supposed to be a debug-only thing (that actually affects performance and must be compile-out for release builds).

The new approach compares nodes with same react tag and naturally cloning-artifacts resilient.

Yes, the new approach uses a map of inserted nodes, but the previous one already had it (otherwise there is no way to tell which nodes should be "deleted"). And anyway, this is a very little map that exists for a very little period of time.

Reviewed By: mdvacca

Differential Revision: D8709953

fbshipit-source-id: 027abb326cf45f00f7bb0bbd7c4e612578268c66
2018-07-06 14:49:07 -07:00
Valentin Shergin e0e9c1549e Fabric: Improved prettyprinting of TreeMutationInstruction
Summary:
@public
Quite trivial... and nice.

Reviewed By: mdvacca

Differential Revision: D8709951

fbshipit-source-id: 63e53eb85361fe3a0a0ecd7f21bf4c7db049d5bf
2018-07-06 14:49:06 -07:00
Andrew Chen (Eng) de09fd53bd Remove setJSEntryPoint from ReactRootView
Summary:
Doesn't look like it was ever used according to diffgrep https://our.intern.facebook.com/intern/diffgrep/?author=&expand_all=false&filepath=&matcher=strmatch&query=setJSEntryPoint&repo=fbsource&rev_type=all&result_size=3&search_order=2&source&target=added%20or%20removed

axe is this okay?

Differential Revision: D8730783

fbshipit-source-id: 1e6b9e8fbd50c108a24b592793060a5344f1d0b1
2018-07-06 12:33:00 -07:00
Himabindu Gadupudi 816d302e98 Reverting image source null so the fix can go all once later
Summary: Image source null which is in RC D8628053 has a bug which has a fix but didn't make to RC. Reverting so it can be cleaned up before going in RC.

Reviewed By: achen1

Differential Revision: D8751687

fbshipit-source-id: e08b23a031455be23047880871813bdc840542dd
2018-07-06 12:33:00 -07:00
David Vacca 6292e2707a Revert order of Remove Mount Item operations
Summary: Revert the order of "remove mount items", to ensure views are removed from high index to low index.

Reviewed By: shergin

Differential Revision: D8742796

fbshipit-source-id: 6e04c39386d290bf3958ee83256d4fbe23e2c4ca
2018-07-06 09:17:34 -07:00
Yan Soares Couto ac09261a4c downloadBundleFromURL with an optional starting Request.Builder
Summary: This makes it possible to specify an optional Request.Builder when calling `downloadBundleFromURL` (the old method still works as usual).

Reviewed By: davidaurelio

Differential Revision: D8691303

fbshipit-source-id: 2fb2aecd3506355c6b3a72457a7bb9acfd03b18d
2018-07-06 04:31:53 -07:00
Florian Schoellhammer 0f4926598a Back out "[react-native][PR] Remove the deprecated `isIPhoneX_deprecated` constant"
Summary:
Original commit changeset: 0b0b3a2d7b80

Reverting D8714400 which removed the `isIPhoneX_deprecated` flag, which is still widely used across the RN codebase https://fburl.com/biggrep/16jg5bzn

Reviewed By: hramos

Differential Revision: D8743401

fbshipit-source-id: cfc44bdd8019eda41e67ca573b20be417d121d12
2018-07-05 19:17:22 -07:00
Himabindu Gadupudi 46ffb10627 Fix null source bug in Image view while accessing source's uri
Summary: Fix null source bug in Image view while accessing source's uri

Reviewed By: achen1

Differential Revision: D8739379

fbshipit-source-id: 0338b19135fa8af9ebe599cabbc9e321fb0906a5
2018-07-05 15:18:04 -07:00
Spencer Ahrens 5b6ff01764 Remove ScrollView.propTypes
Summary:
We're unifying on flow types, and propTypes require non-trivial resources to initialize in aggregate.

Some open source code might depend on extracting ScrollView.propTypes which will now fail. To fix, simplly remove these dependencies and use flow or typescript for verifying correct prop usage instead.

Reviewed By: TheSavior

Differential Revision: D8726371

fbshipit-source-id: 19e9540794db97a9e356615b544759a0753fd68c
2018-07-05 15:18:04 -07:00
Spencer Ahrens f40de0e467 Fix some ScrollView lint
Summary: $title

Reviewed By: TheSavior

Differential Revision: D8721334

fbshipit-source-id: 1aad238da9b8efdef6e2f3f1f2effd213fa9c3aa
2018-07-05 15:18:03 -07:00
Spencer Ahrens 2424ef5654 Move ScrollView prop comments from propTypes to flow types
Summary: Next step: make propTypes `__DEV__` only.

Reviewed By: TheSavior

Differential Revision: D8721300

fbshipit-source-id: 066b495836a87ea92d370728911e7b7ba6566c53
2018-07-05 15:18:03 -07:00
Kevin Gozali fff43614aa android: disable `setClipChildren(false)` until RN ART issue is resolved
Summary:
It looks like for some reason when ReactViewGroup uses setClipChildren(false), the ReactNativeARTSurface no longer redraws when its width is expanded.

Disable this new overflow behavior until the underlying issue is fixed.

Reviewed By: achen1

Differential Revision: D8739003

fbshipit-source-id: ffae0e3eb0cd8ce385eae33a87b5ba0325cae3c4
2018-07-05 14:02:45 -07:00
Alexey Kureev 5067540487 Fix react-native CLI (internal and external one)
Summary:
- Fix wrong debugger-ui path
- Override host and port using args

Reviewed By: yungsters

Differential Revision: D8731159

fbshipit-source-id: ca8ad76a02eda9e0b9cdb1a952aa5631d660868f
2018-07-03 23:48:12 -07:00