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

13483 Коммитов

Автор SHA1 Сообщение Дата
Eli White 1e2de71290 Allow trailing commas
Summary: This was previously set to disallow trailing commas on function arguments which prettier would add. Since we are dropping support for node < 8, we can now change this setting to require trailing commas everywhere and be consistent with the prettier config at Facebook.

Reviewed By: hramos

Differential Revision: D7961098

fbshipit-source-id: fbe49513183a8c8e027bb05467a767235dbfb15b
2018-05-10 19:10:38 -07:00
Eli White cd7c91f35d Convert react-native-github/Libraries to let/const
Reviewed By: sahrens

Differential Revision: D7961763

fbshipit-source-id: ff7dd1d2c7101c8019e0b4f844d8c377b4d13a13
2018-05-10 19:10:38 -07:00
Eli White dca21c8f23 Prettier IntegrationTests
Reviewed By: sahrens

Differential Revision: D7958195

fbshipit-source-id: 253c0eec593228e7b6bc66606584877161c6bfc2
2018-05-10 16:16:35 -07:00
Eli White 86b6f5d39e Add Prettier to some files
Reviewed By: sahrens

Differential Revision: D7958196

fbshipit-source-id: 05a04380a4a1f3abd4cc3a9034fc70deaa4a444b
2018-05-10 16:16:35 -07:00
Eli White 8f5ebe5952 Convert react-native-github/Libraries to let/const
Reviewed By: sahrens

Differential Revision: D7956042

fbshipit-source-id: 221851aa311f3cdd6326497352b366048db0a1bb
2018-05-10 16:16:35 -07:00
Kevin Gozali 266016c521 iOS: Mark Scheduler class as final
Summary:
This fixes some build flavor:

```
error: destructor called on non-final 'facebook::react::Scheduler' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
```

Reviewed By: shergin

Differential Revision: D7958022

fbshipit-source-id: 6ff64bdaa221b5c6430a98244d40d6d3789ba937
2018-05-10 15:17:53 -07:00
Riley Dulin d4d515cdc3 MessageQueue not initializing inCall
Reviewed By: yungsters

Differential Revision: D7898700

fbshipit-source-id: c2b4d6e75e7f5871cd40b00bd173e6f1a929b26a
2018-05-10 11:02:45 -07:00
Andrey Mishanin c2c352024f Back out "[react-native][PR] Prevent console logging on iOS 11.3+ within WebSocket"
Differential Revision:
D7947829
Ninja: master broken

fbshipit-source-id: 282c574897684ce48e9e7461067805a3ec5c1de1
2018-05-10 02:08:35 -07:00
Héctor Ramos 3bc2696d65 Update Android docker images
Summary:
Quick update to switch to a new React Native CI org on Docker Hub. Note that the images are not yet automatically generated on CI. We could do this on Circle CI in certain scenarios:

- Base image needs to be updated whenever the Android development environment has changed (e.g. switch to a new SDK version, build tools, etc)
- Tests image should ideally be updated on each commit

This PR should be safe to land as Circle CI is not yet using these images.
Closes https://github.com/facebook/react-native/pull/19192

Differential Revision: D7939209

Pulled By: hramos

fbshipit-source-id: 0f845a8fffbf8f5b9cecef4fa0ba802bc755f7aa
2018-05-09 23:32:14 -07:00
Marc Horowitz 9d0b7d8f31 Fix BUCK bugs which were breaking tests after refactoring
Reviewed By: johnislarry

Differential Revision: D7874275

fbshipit-source-id: 7f9c8648571bc7f41649ec4ef547e7c34b479221
2018-05-09 22:12:03 -07:00
Marc Horowitz a810e6875f move nativeLoggingHook into AndroidJSCFactory
Reviewed By: fromcelticpark

Differential Revision: D7803905

fbshipit-source-id: 797f5250a4a129a8dff3fb447c01837d68bea452
2018-05-09 22:12:03 -07:00
Marc Horowitz a363a7b501 Refactor ReactMarker out of Platform
Reviewed By: fromcelticpark

Differential Revision: D7803908

fbshipit-source-id: 957e80519c209732b163ece2bccb7c8c36ff8107
2018-05-09 22:12:03 -07:00
Marc Horowitz 042449f24a simplify handleMemoryPressure conditionalization, delete some dead code
Reviewed By: javache

Differential Revision: D7803912

fbshipit-source-id: 0bab4be07fc006a208caa75f94b5716c99b5d265
2018-05-09 22:12:03 -07:00
Marc Horowitz 09f3d7ab49 reformat JSCExecutor.cpp
Reviewed By: fromcelticpark

Differential Revision: D7803913

fbshipit-source-id: fc4637d0f9ab8c01f2f257e34e435c9573ecf948
2018-05-09 22:12:03 -07:00
Marc Horowitz d1d09c208a Remove unused JS Sampling Profiler code
Reviewed By: cwdick

Differential Revision: D7803915

fbshipit-source-id: 3edb42d449ff7b272f7d25ac8f16a646839f8c20
2018-05-09 22:12:02 -07:00
Marc Horowitz ef258b0106 Remove unnecessary #includes to reduce dependencies
Reviewed By: davidaurelio

Differential Revision: D7803909

fbshipit-source-id: 2ccafdbfcb786c4c5f703714fb0c92cda1026cef
2018-05-09 22:12:02 -07:00
Michael Schneider d11fdcfb93 Prevent console logging on iOS 11.3+ within WebSocket
Summary:
Fixes Xcode console output for web socket connections. Apple uses OSLog for logging within libnetworking starting 11.3+. The old way we hook into logging to prevent it will not work anymore.

Let's hook into `__nwlog_pack` that is exclusively used by libnetworking and prevent the logging in there.
Closes https://github.com/facebook/react-native/pull/18948

Reviewed By: fkgozali

Differential Revision: D7940969

Pulled By: mmmulani

fbshipit-source-id: a61beea34377044bfad7e3c446b2ec1138d6d1f5
2018-05-09 20:22:17 -07:00
Kevin Gozali 522640cf3a OSS exclude Xcode artifacts in ReactCommon subdir
Summary: ReactCommon subdir is supposed to be focused on C++, so Xcode projects shouldn't creep in.

Reviewed By: PeteTheHeat

Differential Revision: D7939858

fbshipit-source-id: 2e90491bdaec92829485aded071f74d004b24b21
2018-05-09 16:03:45 -07:00
Tim Yung 11cc7be821 RN: Switch `ProgressBarAndroid` to `React.forwardRef`
Reviewed By: sahrens

Differential Revision: D7904339

fbshipit-source-id: a4fe54acee7af12f1bc9b7c0d5e02a690f57ca0d
2018-05-09 15:42:54 -07:00
Spencer Ahrens 8799047dd0 Fix Modal + FlatList scrolling
Summary:
`FlatList` (actually `VirtualizedList`) allows recursive nesting of itself for easy and complex composition of lists such that it can support seemless virtualization and VPV events. It does this by only rendering a `ScrollView` for the outermost `VirtualizedList` and simply stacking `View`s for all the internal ones.

However, if a `Modal` is in a `FlatList` and also hosts a `FlatList`, e.g.:
```
<FlatList ListFooterComponent={<Modal><Foo /></Modal>} />
```
Then React context will propogate through to the inner `FlatList` and cause it to render as a plain `View`. Because the `Modal` actually portals the views into a different native hierarchy, one without a `ScrollView`, the `FlatList` won't scroll as expected.

The fix is to wipe out the context - not sure if there is a better way, but this doesn't seem terrible.

Differential Revision: D7863625

fbshipit-source-id: 38f41d72ed32b9f0eb1c9c82893f21d83a83f9ad
2018-05-09 13:29:41 -07:00
Andrew Jack 16b955bd1f Fix Android modal crash: android.view.WindowManager$BadTokenException
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes a crash with the Android Dialog. This occurs when the Activity is finishing or has been removed and React Native requests the modal to be shown.

Stacktrace here:
```
Caused by android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@f125ea3 is not valid; is your activity running?
       at android.view.ViewRootImpl.setView(ViewRootImpl.java:683)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:319)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
       at android.app.Dialog.show(Dialog.java:326)
       at com.facebook.react.views.modal.ReactModalHostView.showOrUpdate(ReactModalHostView.java:256)
       at com.facebook.react.views.modal.ReactModalHostManager.onAfterUpdateTransaction(ReactModalHostManager.java:107)
       at com.facebook.react.views.modal.ReactModalHostManager.onAfterUpdateTransaction(ReactModalHostManager.java:28)
       at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:35)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:233)
       at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:153)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:816)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:929)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2100(UIViewOperationQueue.java:47)
       at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:887)
       at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:21)
       at android.os.Handler.handleCallback(Handler.java:815)
       at android.os.Handler.dispatchMessage(Handler.java:104)
       at android.os.Looper.loop(Looper.java:207)
       at android.app.ActivityThread.main(ActivityThread.java:5728)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
```

Related issues: #18570 & #18634

mdvacca added to this file in e5c2a66897
Doesn't look like the issue was introduced in the above change, but it masks the issue. The wrapping if block should not allow a null activity to display a dialog.

<!--
  Required: Write your test plan here. If you changed any code, please provide us with
  clear instructions on how you verified your changes work. Bonus points for screenshots and videos!
-->

Run sample app on Android and display dialog when app is about to close.

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [BUGFIX] [Modal] - Fix Android BadTokenException crash

<!--
  **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

    CATEGORY
  [----------]      TYPE
  [ CLI      ] [-------------]    LOCATION
  [ DOCS     ] [ BREAKING    ] [-------------]
  [ GENERAL  ] [ BUGFIX      ] [ {Component} ]
  [ INTERNAL ] [ ENHANCEMENT ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {Message} |
  [----------] [-------------] [-------------]   |-----------|

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Closes https://github.com/facebook/react-native/pull/18996

Differential Revision: D7938147

Pulled By: hramos

fbshipit-source-id: f4ffd1746304d6184d727339072a7e926ffdaf39
2018-05-09 13:29:39 -07:00
Payton Yao c18cf5bd4a Prevent unintended VirtualizedList high priority rendering
Summary:
VirtualizedList sets high priority rendering when scrolled to the top of a list even if the bottom of the rendered list is still far away and there's nothing further to render above. This causes severe non-responsiveness while dozens of items are waiting to be rendered and user inputs can't get through.

The fix is simply to not consider it high priority to render more items when we reach the top and the first item has already been rendered, or when we reach the bottom and the last item has been rendered.

The code change just splits the two cases (hitting the top and bottom) instead of combining them into one.

I wrote a small application that switches between two FlatLists.

Demo of the original VirtualizedList
<img src="https://user-images.githubusercontent.com/3090032/39456709-2c87069e-4d1b-11e8-8535-5bda6d59400c.gif" width="270" height="480">

I'm clicking pretty often on the button, but you can see that it only switches lists a split second after the rendering is all done because the javascript thread was being blocked.

Demo of the fixed VirtualizedList
<img src="https://user-images.githubusercontent.com/3090032/39456844-00312448-4d1c-11e8-805f-cbe17aa3f95e.gif" width="270" height="480">
You can see this one is significantly more responsive than the previous one.

The source code for the demo application is available [here](https://gist.github.com/jabbawookiees/ba93a4e7b4f9b8f3acbc157e4fd04877)

[ GENERAL ] [ ENHANCEMENT ] [ Libraries/Lists/VirtualizedList.js  ] - Prevent high priority rendering at the top or bottom of a list.
Closes https://github.com/facebook/react-native/pull/19081

Differential Revision: D7933994

Pulled By: sahrens

fbshipit-source-id: 13c9f73baeb3487620b720854a753287ac0aa1fa
2018-05-09 11:03:22 -07:00
Tim Yung e708010d18 RN: Switch `Text` to `React.forwardRef`
Reviewed By: sahrens

Differential Revision: D7902262

fbshipit-source-id: 218f95cde6d77f21d9362a2f2bd47c5f83d5ee15
2018-05-09 01:16:12 -07:00
Tim Yung 06c05e744d RN: Cleanup `Text` Implementation
Reviewed By: sahrens, TheSavior

Differential Revision: D7901531

fbshipit-source-id: dfaba402c1c26e34e9d2df01f2bbb8c26dfcd17e
2018-05-09 01:16:12 -07:00
Tim Yung a1f2076aae RN: Delete `mergeFast` from `Text`
Reviewed By: sahrens, TheSavior

Differential Revision: D7899406

fbshipit-source-id: 35fb14c5af3d01404896342a47af9fa280226c7f
2018-05-09 01:16:11 -07:00
Tim Yung 6a1b41643a RN: Consistently Throw for <Text><View /></Text>
Reviewed By: sahrens

Differential Revision: D7898238

fbshipit-source-id: a2b74e691a116b1beae3c6bb266252a722aacbb1
2018-05-09 01:16:11 -07:00
Tim Yung 3e534b9aab RN: Switch `View` to `React.forwardRef`
Reviewed By: bvaughn, sophiebits

Differential Revision: D7896711

fbshipit-source-id: c10c8a14a00ac2d67605e6e4fe1a341b4688fdd8
2018-05-09 01:16:11 -07:00
Tim Yung e1339bc183 RN: Replace `context.isInAParentText` w/ React.createContext
Reviewed By: sahrens

Differential Revision: D7895382

fbshipit-source-id: 4affcecd147b8e8c506e0d94f223bac3e6dfdf66
2018-05-09 01:16:11 -07:00
Tim Yung 5d4c542c58 RN: Refactor `MockNativeMethods` in Jest
Reviewed By: sahrens

Differential Revision: D7917498

fbshipit-source-id: 97636080588bf2641a56256688cb0f2ec81ae463
2018-05-09 01:16:11 -07:00
Valentin Shergin 67dbcbd57e Fabric: Wiring layout pipeline between Surface and ShadowTree
Summary:
The layout pipeline is quite long:
UIKit <-> Surface <-> SurfacePresenter <-> [RCTScheduler <|-|> Scheduler] <-> ShadowTree <-> RootShadowNode <-> YogaNode.

Reviewed By: mdvacca

Differential Revision: D7857048

fbshipit-source-id: 06c92ef1639465d17e2489667f99d0114b80dcff
2018-05-08 23:03:36 -07:00
Valentin Shergin 20e88e9ac4 Fabric: Deprecating `-[RCTSurface rootViewTag]`
Summary:
This diff deprecates `-[RCTSurface rootViewTag]` in favour of `-[RCTSurface rootTag]` which returns
same value but represented as `ReactTag` (`long`) instead of `NSNumber *`.

Reviewed By: mdvacca

Differential Revision: D7857044

fbshipit-source-id: f5427c30d3de2d3563e830f2caac70b7dc9631f9
2018-05-08 23:03:36 -07:00
Valentin Shergin 25664cc48c Fabric: RCTConversions unified way to covert primitives between Fabric and UIKit
Summary: Quite obvious.

Reviewed By: mdvacca

Differential Revision: D7857051

fbshipit-source-id: 85aa6a9c064e5aebe65486acd011d445efaf0ce8
2018-05-08 23:03:36 -07:00
Valentin Shergin e052685ffc Fabric: Resonable default values for LayoutConstraints members
Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D7857046

fbshipit-source-id: 88400f1831bf66ccd3d880ddf1de3df27287b5be
2018-05-08 23:03:36 -07:00
Valentin Shergin a879842033 Fabric: Introducing `ShadowTree`
Summary: ShadowTree is an abstraction around (commited) root shadow node and managing its lifecycle.

Reviewed By: mdvacca

Differential Revision: D7857049

fbshipit-source-id: 8d530e0366fc703e4aef4ec88dd8ea990dafaaf1
2018-05-08 23:03:36 -07:00
Valentin Shergin 2bb41031ba Fabric: Introducing `RootShadowNode`
Summary: `RootShadowNode` is a dedicated class for managing the root node.

Reviewed By: mdvacca

Differential Revision: D7857050

fbshipit-source-id: f15f4b177f03cea4c0fd5a60d761ee2745319d77
2018-05-08 23:03:36 -07:00
Valentin Shergin cb48fa4d49 Fabric: `LayoutContext::affectedShadowNodes` was removed
Summary:
Apparently, we don't need this functionality in Fabric because we compute mutation instactions during diffing anyways.
But we still need (will need) `LayoutContext` for sure.

Reviewed By: mdvacca

Differential Revision: D7857045

fbshipit-source-id: 4be2744d9abea473ead847f35f698104f94af33d
2018-05-08 23:03:35 -07:00
Valentin Shergin e028631513 Fabric: Implementation of `yogaStyleValueFromFloat`
Summary: Quite obvious.

Reviewed By: mdvacca

Differential Revision: D7857047

fbshipit-source-id: 876664b3ab5c19b7c66a38579664f18a38a1a371
2018-05-08 23:03:35 -07:00
Valentin Shergin 7cf7028092 Fabric: Support for view recycling in RCTComponentViewRegistry
Summary: Quite trivial but still very cool recycling of native view instances is finnally here, in React Native. �

Reviewed By: mdvacca

Differential Revision: D7804085

fbshipit-source-id: 644804da3185f9ed3fdea42d4d76c93e86934448
2018-05-08 23:03:35 -07:00
Valentin Shergin 6e537b000b Fabric: New nice way to deal with DebugStringConvertible items
Summary:
No macros in product code.
(Not all callsites are converted yet.)

Reviewed By: mdvacca

Differential Revision: D7797561

fbshipit-source-id: da899421bf99669a0e0a2b83df6004daf14355c2
2018-05-08 23:03:35 -07:00
Valentin Shergin d9ff1769aa Fabric/Text: <Paragraph> is now supporting text attributes
Summary:
I was shamed by Sebastian's sebmarkbage concerns (totally unrelated to this topic) about introducing another level of indirection into the system and decided to change my original plan not to support text attributes for the <Paragraph> component.

So, now <Paragraph> shares <View>, <Text> and <Paragraph> itself capabilities. That reduces the minimum amount of required components for trivial text fragment from three (Paragraph, Text, RawText) to two (Paragraph and RawText).

Special thanks for C++ for supporting multiple inheritance.

Reviewed By: mdvacca

Differential Revision: D7785889

fbshipit-source-id: dd9f2e2650bfbfd76d7d4b538adaf409f9429df3
2018-05-08 19:24:10 -07:00
Valentin Shergin 9ea7957958 Fabric: Do not crash in attempt to mount layout-only components
Summary: We do not have a clear strategy how to deal with layout-only (view-less) components. Even if this particular solution is not so fancy, it prevents crashing during text rendering.

Reviewed By: mdvacca

Differential Revision: D7785885

fbshipit-source-id: f3ed8988aa2b41349fd1693c2a7f8c9368daee43
2018-05-08 19:24:10 -07:00
Valentin Shergin f3893aab3b Fabric/Text: Connecting the dots
Summary: This change registers the Text module.

Reviewed By: mdvacca

Differential Revision: D7784509

fbshipit-source-id: 0de3e432b8f975927547ba990586f99655e8322d
2018-05-08 19:24:10 -07:00
Valentin Shergin 81bdd36204 Fabric/Text: RCTParagraphComponentView
Summary: RCTParagraphComponentView is a UIView which can render text using TextLayoutManager.

Reviewed By: mdvacca

Differential Revision: D7751853

fbshipit-source-id: e6ee9a0f989cdf6e878390d37dbcf8a11ef90bf4
2018-05-08 19:24:10 -07:00
Valentin Shergin 9646c5cb3c Fabric: RCTViewComponentView, storing just applied `layoutMetrics`
Summary:
This will be useful for this class and for subclasses soon.
For instance, when we draw something in `drawRect:`, we need to know exact content frame for rendering.

Reviewed By: mdvacca

Differential Revision: D7751855

fbshipit-source-id: 5d688368edd7b4f3c8c19d54ca701a9cc361270b
2018-05-08 19:24:10 -07:00
Riley Dulin 7e97ed00bc Fix prepack warning in RN bridge code
Reviewed By: yungsters

Differential Revision: D7903364

fbshipit-source-id: 4ef888f4e7f773f9fbc5183db2470b0f7b368d8a
2018-05-08 18:17:30 -07:00
Valentin Shergin b5a780608e Fabric/Text: text module, paragraph part
Summary: <Paragraph> component represents <View>-like component containing and displaying text.

Reviewed By: mdvacca

Differential Revision: D7751854

fbshipit-source-id: 1acdfebf6f96a5da068ce985e15288e958266855
2018-05-07 22:08:54 -07:00
Valentin Shergin dc7a87e737 Fabric/Text: text module, text part
Summary: <Text> component is used to describe text attributes in React.

Reviewed By: mdvacca

Differential Revision: D7751851

fbshipit-source-id: f90a4367cad64283ee64828b0d5e24470ee3d9f7
2018-05-07 22:08:53 -07:00
Valentin Shergin 02c3cd4c4e Fabric/Text: text module, rawtext part
Summary: <RawText> component represents a purely regular string object in React.

Reviewed By: mdvacca

Differential Revision: D7751850

fbshipit-source-id: 54afe43e0c1ac063862f109ea07f0e7de3593573
2018-05-07 22:08:53 -07:00
Valentin Shergin 05890a5942 Fabric/Text: textlayoutmanager
Summary:
TextLayoutManager measures and renders text using iOS specific APIs (CoreText & TextKit).
By desing, only this module should contain platfrom-specific text functionality.

Reviewed By: mdvacca

Differential Revision: D7751852

fbshipit-source-id: fd6e1907df617fe5a4479ea08f207946765b3a45
2018-05-07 19:05:53 -07:00
Valentin Shergin 62576bcb78 Fabric/Text: attributedstring module, the second part
Reviewed By: mdvacca

Differential Revision: D7748711

fbshipit-source-id: 57b37cb2eaa20b85c6f6719b38eac2a2c0479485
2018-05-07 18:09:06 -07:00