Commit Graph

2140 Commits

Author SHA1 Message Date
Kevin Gozali 42fc87eb8d remove unnecessary ExceptionManager abstraction
Reviewed By: sebmarkbage

Differential Revision: D8002124

fbshipit-source-id: 4e0bce9686549d0dd7b59b1323efd11ea168855b
2018-05-14 20:45:21 -07:00
Sebastian Markbage 4ef099679d Expose new methods to Custom/System JSC
Reviewed By: fkgozali

Differential Revision: D7998298

fbshipit-source-id: f20d5b961db1cc31880d383a67d8bba40dd8008f
2018-05-14 18:58:05 -07:00
Valentin Shergin dd3a6eda70 Fabric: Devirtualizing of props parsing infra
Summary:
This diff contains several tight to each other changes (which can/should not be split into several diffs):
 * The props parsing/conversion process was de-virtualized: we don't use virtual `apply` method to parse props anymore. Instead, we use old-fashioned constructors.
 * All fields of Props classes which represent props values were marked as `const` which make impossible to modify them after the objects were created (even if we have non-const value-of/pointer-to the whole Props object). Those fields are also `public` now.
 * All custom handwritten getters were removed (because we don't need them anymore).

So, now we don't need all those custom getters which makes code much more compact, performant and codegen-friendly.

Reviewed By: fkgozali

Differential Revision: D7901245

fbshipit-source-id: 9f4b1fd2da64bf963b63215ed3bd74b9d3c58dd5
2018-05-14 16:03:49 -07:00
Federico Trimboli 3d3edfc3da Replace magic numbers with `safeAreaInsets` in `RCTDevLoadingView`
Summary:
This PR replaces magic numbers used for offsetting `RCTDevLoadingView` when running on iPhone X, in favour of `safeAreaInsets`.

Tested on iPhone X and iPhone 8. Here is a screenshot showing how it looks on iPhone X.
![nansi](https://user-images.githubusercontent.com/3900360/39599961-b4239d90-4ef3-11e8-97f4-269d571a6c8d.png)
Closes https://github.com/facebook/react-native/pull/19119

Differential Revision: D7984823

Pulled By: hramos

fbshipit-source-id: 0c7c3ba0fa258a64f6c4a1e0620f87bf0620984c
2018-05-12 23:25:09 -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
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 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 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 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
Kevin Gozali 6611fefef7 iOS: Exposes the RCTFont size overrides so unit tests can use the same values
Summary:
`RCTFontTests` test in RNTester is broken if the target deployment is <= OS 8.2. This is because RCTFont.mm overrides the OS-defined values, but the override is only visible to RCTFont.mm internals. As the result, when the Unit test tries to create UIFont of the "same" weight, it got a different font - most likely due to internal floating rounding errors.

To mitigate, code that wants to test out internals of RCTFont should import RCTFontConstantsOverride.h

Reviewed By: mmmulani

Differential Revision: D7900954

fbshipit-source-id: e5814ef059a8afdfb5205ca1af46c41b3cfd4318
2018-05-07 17:31:12 -07:00
Jerry Horton 37c820f16e Fix for issue #19086 RCTHasFontHandlerSet(); This function definition…
Summary:
… is not a protoype #19086

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

<!--
  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 #19086

Related to react-native-navigation issue #3019

<!--
  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!
-->

Created a fresh react native >= 0.55.2 project and only install React Native Navigation. The error "This function declaration is not a prototype" message occurs.

Downgrading to React Native 0.54.4 builds fine.

![screen shot 2018-05-01 at 3 17 51 pm](https://user-images.githubusercontent.com/5680239/39491718-ddfdd6a0-4d52-11e8-937f-7ed9702a2e30.png)

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

No documentation change

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->
[iOS] [BUGFIX] [react-native-navigation] - For compatibility with react-native-navigation >= 2.0.2237 https://github.com/facebook/react-native/issues/19086
<!--
  **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/19089

Differential Revision: D7841198

Pulled By: shergin

fbshipit-source-id: 31638274055c3f143342d2d6dde6d4af7a2ac304
2018-05-01 19:32:07 -07:00
Valentin Shergin 9f46f425f4 Fabric: Managing `LocalData` instances in mounting pipeline
Summary: Managing and transmitting LocalData object to native views.

Reviewed By: mdvacca

Differential Revision: D7738580

fbshipit-source-id: c889da58d3afe7ac14f411576afe659bd079f641
2018-04-26 18:03:07 -07:00
Peter Ammon 9bbe736f23 Teach JS stack-parsing regex about alternative formats
Reviewed By: adamjernst

Differential Revision: D7706535

fbshipit-source-id: 83cc2defbcad3faa6bdbf4a5b2072b9c023e1c04
2018-04-20 09:01:27 -07:00
Jean Lauliac 5fd92f90af cxxreact: executors: insert ID of segment reliably into the bundle path
Reviewed By: fromcelticpark

Differential Revision: D7623232

fbshipit-source-id: df833d18f0445d52e3098b58aac347a2e9aa0040
2018-04-20 07:03:23 -07:00
Tim Yung d69e55060f RN: Support `flexWrap: 'wrap-reverse'`
Reviewed By: fkgozali

Differential Revision: D7684403

fbshipit-source-id: 6c247ba86b8ad1bb4dcc8f44f5609c939afe0f06
2018-04-19 15:50:57 -07:00
Dmitry Zakharov b5f90ed497 Update ModuleRegistry if there're new modules registered
Reviewed By: fkgozali

Differential Revision: D7638394

fbshipit-source-id: c1690da7977f0335bc661df5f19dc9f473150d41
2018-04-17 08:32:15 -07:00
Kevin Gozali f569b45f4c OSS: upgrade Folly 2016.09.26 => 2016.10.31
Summary:
There was a fix around folly::dynamic constructor that will be needed for Fabric work. This was done in 94e964976c (diff-7d1cb97d222ba0c863ea8a8e43b2ee2b) and luckily the release 1 month after the Folly version we used in RN already had the fix, so that we don't need to upgrade to the latest folly yet (minimizing breakages).

Tested by:
* running RNTester xcode project (ios)
* running RNTesterPods workspace via cocoapods
* building android via gradle

Reviewed By: shergin

Differential Revision: D7626037

fbshipit-source-id: cb36ba5b91ba131d4e450300bd620db657cfa1e8
2018-04-13 17:33:23 -07:00
David Aurelio edd22bf49d Log bridge description for e2e reloads
Reviewed By: mhorowitz

Differential Revision: D7577953

fbshipit-source-id: 96871c664cb7ec84570bc76f2edb36ff8c8c6aeb
2018-04-10 19:29:58 -07:00
Valentin Shergin 568529e1ec Fabric: Introducting RCTViewComponentView
Summary:
Implementation of the native view component of <View>.
Root View also must have dedicated class even if its empty now.

Reviewed By: mdvacca

Differential Revision: D7526406

fbshipit-source-id: 9e14c9f679396c2cdb2d64c99086bb19df37c25c
2018-04-10 17:15:08 -07:00
Valentin Shergin cf036ee2fa Fabric: Introducing RCTSurfacePresenter
Summary:
RCTSurfacePresenter coordinates presenting of React Native Surfaces and represents application-facing interface of running React Native core.
SurfacePresenter incapsulates a bridge object inside and discourages direct access to it.

Reviewed By: mdvacca

Differential Revision: D7526413

fbshipit-source-id: 9b6c513ec63a84d8b6c0951458cbd6b47f49669b
2018-04-10 17:15:08 -07:00
Valentin Shergin ab5859b44b Fabric: Introducing RCTSurfaceRegistry
Summary: Simple incapsulation of thread-safe weak set of Surface instances.

Reviewed By: mdvacca

Differential Revision: D7526409

fbshipit-source-id: 8dd789fd6148af3dacf74aac2125b022d11a0fdb
2018-04-10 17:15:08 -07:00
Valentin Shergin 515d49ed1c Fabric: Introducing RCTScheduler
Summary:
RCTScheduler represent facebook::react::Scheduler as a Obejctive-C object.
It supposed to be single, unified, bidirectional interop layer between C++ and Obejctive-C worlds.

Reviewed By: mdvacca

Differential Revision: D7526405

fbshipit-source-id: a206755f64f2904981b356a40e7659922b24d7bb
2018-04-10 17:15:08 -07:00
Valentin Shergin 00f44248b3 Fabric: RCTFabricSurface as separate class
Summary: RCTFabricSurface was reimplemented as separate class which does not rely on (old) RCTUIManager and delegate some functionality (which must be coordinated between Surface instances and Scheduler) to RCTSurfacePresenter.

Reviewed By: mdvacca

Differential Revision: D7526404

fbshipit-source-id: e8c38261bc489fd6066ba29a829cd8f623c26217
2018-04-10 17:15:08 -07:00
Valentin Shergin 3093df6754 Fabric: RCTMountingManager and RCTMountingManagerDelegate
Summary: RCTMountingManager manages mounting process transforming mutation instructions into mount items and executing them.

Reviewed By: mdvacca

Differential Revision: D7507521

fbshipit-source-id: 6e5acdbf0b7f8bedc7e1de141dc9086f35a376c9
2018-04-10 17:15:07 -07:00
Valentin Shergin 6c406ffe38 Fabric: RCTComponentViewRegistry
Summary:
A registry for components. The registry allows to refer to component view instance by react tag.
It also has recycle-pool-like interface (and eventually the pool will be implemented).

Reviewed By: mdvacca

Differential Revision: D7507519

fbshipit-source-id: ed74203fb4d0694490b0dc23aae0aa067b3fc55b
2018-04-10 17:15:07 -07:00
Valentin Shergin 11833714d9 Fabric: RCTMountItemProtocol and five base mount items
Summary:
MountItem is a small granular light-weight instruction describing a change in the component view tree.
All instruction are supposed to be small and standard. All additional logic must be implemented in component view subclasses.
No more opaque and untyped objcblocks.
All that allows mounting manager to control and optimize an execution of those items (eventually).

Besides that five we probably will need `perform imperative instruction` (for execution something like `scrollTo`) and `update local data` (for updating local state of something like text input).

Reviewed By: mdvacca

Differential Revision: D7507518

fbshipit-source-id: 745b93125231a02cbc152cfa6c6baf423d100f81
2018-04-10 17:15:07 -07:00
Valentin Shergin dfb8fd26e6 Fabric: Default implementation of RCTComponentViewProtocol
Summary:
All methods of RCTComponentViewProtocol are non-optional,
but this default implementation removes necessity to implement all of them manually.

Reviewed By: mdvacca

Differential Revision: D7507522

fbshipit-source-id: e4dff97e8bf64e79d2f1ffca94f0549bd4b5e2fa
2018-04-10 17:15:07 -07:00
Valentin Shergin 87539c34db Fabric: RCTComponentViewProtocol
Summary: RCTComponentViewProtocol is a protocol for all UIView instances which are managed by React/MountingManager.

Reviewed By: mdvacca

Differential Revision: D7507520

fbshipit-source-id: dcbed8c5d0cc97f72942508aeccb445833ade271
2018-04-10 17:15:07 -07:00
Valentin Shergin f6f7d0484c Fixed typo in RCTShadowView
Summary: Trivial.

Reviewed By: PeteTheHeat

Differential Revision: D7503382

fbshipit-source-id: 0c553553bcde5c2f32bace0fa047aee6a106619b
2018-04-10 12:59:51 -07:00
Valentin Shergin 534abeca04 Fabric: Introducing UIManagerDelegate
Summary: UIManager uses UIManagerDelegate to communicate about shadow tree changes to another parts of the system.

Reviewed By: fkgozali

Differential Revision: D7503484

fbshipit-source-id: 0afe0f0d6cad31fe2ee9d61235d02b379cfe8217
2018-04-10 12:59:51 -07:00
Gabriele Mondada bfcfe7961d fix use of C++ syntax in an header file
Summary:
All public header files can be included from Obj-C and Swift, except RCTSurfaceSizeMeasureMode.h which contains C++ code.

Change is trivial and can be validated by review.

None.

[IOS][BUGFIX][{RCTSurfaceSizeMeasureMode.h}] - fix use of C++ syntax in an header file that could be included from Obj-C and Swift
Closes https://github.com/facebook/react-native/pull/18730

Differential Revision: D7550290

Pulled By: shergin

fbshipit-source-id: 3835e2c57697a067ff94afdaeaca06bce132ef66
2018-04-08 23:29:38 -07:00
Liamandrew 3372541a2a Add ability for Animated views to be created with scale X or scale Y
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

*Accidentally closed previous PR*

Sometimes it can be useful to have an animated view be created with either scale X or scale Y in cases where scaleXY might not be as visually appealing.

Test Plan
Tested on both ios and android in the sample project:

https://github.com/Liamandrew/ScaleAnimationSample

![scaleanimation](https://user-images.githubusercontent.com/30114733/37023697-d0aa7372-217a-11e8-8d3b-2958c63ad83a.gif)
Closes https://github.com/facebook/react-native/pull/18220

Differential Revision: D7542334

Pulled By: hramos

fbshipit-source-id: 208472e5d8f5a04ca3c3a99adce77b035e331ef1
2018-04-06 17:46:54 -07:00
Kevin Gozali 95f625e151 Fixed RNTester (iOS) xcode project to include new Yoga files
Summary: Recent commit that added YGConfig.h broke this project because the files were not added to it.

Reviewed By: shergin

Differential Revision: D7530369

fbshipit-source-id: 77129288905d25b94ad7aad4be43e0052a784163
2018-04-05 22:07:01 -07:00
Mehdi Mulani 52a3443e98 Weakly capture the bridge in callback methods
Summary: Callback blocks are frequently held onto by modules, e.g. for animation the `RCTFrameAnimation` holds onto its callback method. This causes a bunch of retain cycles since the module will be strongly held onto by the bridge.

Reviewed By: Megra

Differential Revision: D7492136

fbshipit-source-id: 708e61ffe7bf0dcffaebc056ab861b9023ffc1df
2018-04-05 14:56:02 -07:00
Peter Argany f96d7ae648 Bridged FBPullToRefresh to JS
Reviewed By: shergin

Differential Revision: D6875099

fbshipit-source-id: 00bbad7569ff047a77f198ad2bf4d77fccbaa2e9
2018-03-27 18:19:30 -07:00
Valentin Shergin 0376baf4b3 Revert D7343566: [RN] Fixed race condition in RCTUIManager's mounting process
Differential Revision:
D7343566

Original commit changeset: e45a691add5e

fbshipit-source-id: 08ec04538c07dc3cd630240da8bb42a932a23b6f
2018-03-22 18:14:35 -07:00
Shoaib Meenai cf642c9b1d Mark global variable as extern "C"
Reviewed By: mnovakovic

Differential Revision: D7369214

fbshipit-source-id: 710d817b4bf74b5ca0621645dd5c005b778d7171
2018-03-22 16:32:12 -07:00
Valentin Shergin c194c18126 Fixed performance regression in `ShadowView`s layout process
Summary:
This fixes perf regression which was introduced by recent refactoring of the layout process.
That is how it used to be:
114c258045/React/Views/RCTShadowView.m (L160-L166)
Note: We have to resert this flag in indication that we already applied those changes and we don't need to traverse this subtree until it is changed again.

Reviewed By: fkgozali

Differential Revision: D7343564

fbshipit-source-id: ba7e00bc5fe4992d777eed20ba0d959fd8f6c037
2018-03-21 11:04:35 -07:00
Valentin Shergin 909861ff05 Fixed race condition in RCTUIManager's mounting process
Summary:
See the comment in code.
This picture also illustrates the problem: https://cl.ly/250z0D1B0c17.
https://pxl.cl/ckBq

Reviewed By: fkgozali

Differential Revision: D7343566

fbshipit-source-id: e45a691add5e43434dea8708be4b76ff18e52131
2018-03-21 11:04:34 -07:00
Valentin Shergin 0594a109d1 Removed unnecessary `intrinsicContentSize` implementation from `RCTSurfaceHostingProxyRootView`
Summary:
The base class already implements `intrinsicContentSize` (and it's a bit more complicated that that).
(Not sure if this change anything visible.)

Reviewed By: fkgozali

Differential Revision: D7343567

fbshipit-source-id: 86f86715b0dacc3c2230289a13926f0520540089
2018-03-21 11:04:34 -07:00
Kevin Gozali e2462e9016 iOS: set the default measure size correctly for RCTSurfaceHostingView
Summary: The RCTRootView default needs to be translated during init of RCTSurfaceHostingView correctly.

Reviewed By: shergin

Differential Revision: D7327918

fbshipit-source-id: 67a2a42b554782b37a032cc0470d794554cc1e5a
2018-03-19 17:36:03 -07:00
Frederic Barthelemy 75a735976d RCTObjcExecutor: fix initializer-list initialization order build warning.
Summary:
Fixes: #18384

Previously line 42 had a warning of: `Field 'm_jsThread' will be initialized after field 'm_delegate'`

This appears to be because the private member fields are declared in a different order than the initializer-list was told to initialize things.

I chose to re-order the initializer list because that fixes the warning by matching the code structure to what the compiler was telling us it was going to do.

An alternate fix would be to change the order of the member variables declared in the `private:` section to match the coded order in the initializer list. This might be the right move if the initializer list had the correct intent, but this would be a breaking change from a behavior perspective, so I'd need somebody with more knowledge to suggest this is the right move.

A. Examine line to see the warning is gone.
B. Get a C++ guru to figure out the intent of this file and see if this actually exposed a bug that recommends we go with the alternate fix suggested above.

[IOS][MINOR][React/CxxBridge/] - Build warning fix

<!--
Help reviewers and the release process by writing your own release notes

**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 ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - 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/18385

Differential Revision: D7328272

Pulled By: mhorowitz

fbshipit-source-id: 59d7ace6222c4609ac7d023f97e522e85e02a9db
2018-03-19 15:51:59 -07:00
Kevin Gozali 53a0470b83 iOS JSC: Use ICxxExceptionManager to report exception
Reviewed By: shergin

Differential Revision: D7224945

fbshipit-source-id: 8aadbc04c700d6e965be311085d95332571b00b0
2018-03-19 00:06:57 -07:00
Kevin Gozali f42b5892a1 iOS C++: Add ICxxExceptionManager to access RCTExceptionsManager native module
Summary: It is sometimes useful to report soft/fatal errors from C++ (native) to the same RCTExceptionsManager that is already handling JS exceptions. `ICxxExceptionManager` is an approach to provide such access, which impl provided for ObjC++.

Reviewed By: shergin

Differential Revision: D7224944

fbshipit-source-id: 8c607226b67851d46f4c787f5b6e6c8cb6a1afea
2018-03-19 00:06:57 -07:00
Valentin Shergin 4cda0df2e5 Switching to the new FabricUIManager and all new shadow tree infra
Reviewed By: fkgozali

Differential Revision: D7230670

fbshipit-source-id: bca7d2859b87931c0d15406782b7d689de1d8c36
2018-03-18 19:17:39 -07:00
Pritesh Nandgaonkar 9102ff94e7 Moved YGFloatOptional from C struct to C++ struct
Reviewed By: emilsjolander

Differential Revision: D7288555

fbshipit-source-id: f61cc92c8fd0d48d2fc1f4d0e6fcef155f19ff8a
2018-03-15 12:41:16 -07:00
Eric Czarny bec97dc243 Expose native show message method in header
Reviewed By: mmmulani

Differential Revision: D7201691

fbshipit-source-id: b5f74351a9be7e6e9a7fc7145a09ba9854efc002
2018-03-14 11:17:12 -07:00
Sahil Ohri 8466db0fd3 Revert #17927
Summary:
This change is a revert of [#17927](https://github.com/facebook/react-native/pull/17927) pull-request.
The pull-request caused an issue with the keyboard covering the text field at the bottom of the scroll view.

Reviewed By: shergin

Differential Revision: D7246609

fbshipit-source-id: 149f825274c4fa79ab593f1bae3602667d16ddee
2018-03-13 19:27:33 -07:00
Naris Siamwalla 41acb0a75b Fix clang-6 compile error (virtual destructor)
Reviewed By: smeenai

Differential Revision: D7264312

fbshipit-source-id: f0567452127ceba6cfa13d05bb2a00a5af7aac05
2018-03-13 16:41:05 -07:00
Teddy Martin ca898f4367 Add docs for Swift usage to RCTBridgeModule.h
Summary:
Clarifies how to get a reference to RCTBridge from a Swift RCTBridgeModule.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

In writing native modules for Swift, I have run into issues where the documentation applies only to Objective-C and does not supply adequate information for how one might accomplish something in Swift.

This is a good example, where the `synthesize` method simply does not apply to Swift code.

[IOS][ENHANCEMENT][Base/RCTBridgeModule.h] Add documentation for Swift usage.
<!--
Help reviewers and the release process by writing your own release notes

**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 ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - 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/18231

Differential Revision: D7262850

Pulled By: hramos

fbshipit-source-id: c6babb3edd786be8571eb49258d594f2fb99141d
2018-03-13 15:22:01 -07:00
Kevin Gozali 7bf3b20837 iOS: create C++ <-> ObjC++ connector for FabricUIManager to do UI operations
Reviewed By: shergin

Differential Revision: D7162911

fbshipit-source-id: 3e303020dafdccc51f52c3359a7054dc8a787978
2018-03-07 16:54:16 -08:00
Tugrul Ince 23e0f868c9 Mark more ObjC methods called from RN as dynamic
Reviewed By: kostiakoval

Differential Revision: D7174480

fbshipit-source-id: 38af8e6e94cb8cdf6aa551d9df1b3e16543387e5
2018-03-07 16:54:16 -08:00
Kevin Gozali cade297971 iOS Surface: properly reset some internal states when JS reloads
Summary:
There are a few important states that didn't reset correctly when reloading JS:
* the RCTSurfaceStage was stuck at all bits enabled, hence no further stage change happened (even though the state "reset" to `RCTSurfaceStageBridgeDidLoad`)
* the RCTSurfaceView didn't get recreated, because the _view ivar was never cleared
* similarly, the _touchHandler ivar attached to the _view was never re-setup --> all touches after JS reload were dropped before this diff

Reviewed By: mmmulani

Differential Revision: D7178038

fbshipit-source-id: ba49bc205f8bf43842471b7ab748cef8549ea212
2018-03-07 10:45:14 -08:00
Kevin Gozali 2e51fa5f5d iOS: RCTSurface needs to re-register its root view on bridge reload
Summary: When reloading JS during development, surface needs to make sure the root view gets re-registered before attempting to remount it. This fixes redbox on JS reload.

Reviewed By: shergin

Differential Revision: D7170416

fbshipit-source-id: c84b999d2cdc35cb9e26feef2a1e1a7ce35cfa70
2018-03-06 12:48:20 -08:00
David Aurelio 48c339ddc7 Add `RCTJavaScriptWillStartExecutingNotification`
Summary:
`RCTJavaScriptWillStartLoadingNotification` is being posted when starting the bridge, not when starting to execute JS code.

Here, we add `RCTJavaScriptWillStartExecutingNotification`, and in post it before executing JS with `RCTCxxBridge`.

Reviewed By: fromcelticpark

Differential Revision: D7153659

fbshipit-source-id: 902075308d54a47bef43b6f57edf2e624f621ceb
2018-03-06 11:05:25 -08:00
Krzysztof Ciombor b7bb2e5745 Add support for Android TV devices
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

* To be on par with Apple TV support, this makes it possible to run React Native apps on Android TV devices (See also: https://react-native.canny.io/feature-requests/p/android-tv-support)
* These changes also make it possible to navigate through the app using D-PAD buttons that are present on some mobile devices
* Since these changes affect, among others, `ReactRootView.java` and `Touchable.js` code and are closely related to Apple TV implementation, it makes sense for them to be included in the core

 - React native apps can be launched on Android TV devices and properly render their content
 - Navigation is possible using left, right, top, bottom arrows from the remote (or D-PAD)
 - Touchable components can handle D-PAD center button press events and correctly fire their `onPress` handlers
 - Touchable components will receive `onPressIn` and `onPressOut` events and can react to focus/blur changes appropriately (just like on Apple TV)
 - `Platform` constants allow to check if the react-native app is running on TV (`Platform.isTV`)
 - `ScrollView`s behave correctly (same as native implementation) when switching to view outside bounds – that is, the container would scroll such that the newly focused element is fully visible
 - Native "clicking" sounds are played when moving between focusable elements
 - Play/Pause click event is send to `TVEventHandler`
 - Rewind and FastForward events are send to `TVEventHandler`
 - Back button behaves as a normal Android back button
 - Diagonal buttons work correctly on Android TV, e.g. if there is no button directly to the right from the focused one, but there is one to the right but a bit higher/lower it will grab focus
 - Dev menu can be accessed by long pressing fast forward button

A demo showing RNTester app running on Android TV device (Amazon Fire TV Stick) can be found here:
[![RNAndroidTVDemo](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)](http://www.youtube.com/watch?v=EzIQErHhY20)

- `TextInput` will not work on Android TV devices. There's an issue with native `ReactEditText` implementation that prevents it from receiving focus. This makes it impossible to navigate to `TextInput`.
This will be fixed next, but will be included in a separate Pull Request
- ~Overlay permissions cannot be granted on Android TV devices running Android version >= 6.0
This is because the overlay permission can only be granted by firing an Intent to open settings page (`ACTION_MANAGE_OVERLAY_PERMISSION`). Since this page does not exist on TV devices the permission cannot be requested. This will make the app crash when trying to open dev menu (⌘+M) or displaying a redbox error.
Note: This does not affect devices running Android version < 6.0 (for example Amazon Fire TV Stick)~
This is now fixed by: https://github.com/facebook/react-native/pull/16596

* Launch the RNTester app on Android TV device.
  * Ensure it launches without a crash
  * Ensure basic navigation is possible
  * Ensure Touchable components can receive select events
* Ensure the changes do not break current Android and iOS mobile devices functionality.
* Ensure the changes do not break current Apple TV functionality.

[RNAndroidTVDemo video](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)

* Added `ReactAndroidTVViewManager` that handles TV `KeyEvent`s and dispatches events to JS - This is the core that enables basic navigation functionality on Android TV devices
* Following the above change we copy `TVEventHandler.ios.js` into `TVEventHandler.android.js` to enable JS to pick up those native navigation events and dispatch them further to subscribed views. (Note: We do not have a native `TVNavigationEventEmitter` implementation on Android, thus this file is slightly modified, e.g. it does pass `null` to `NativeEventEmitter` constructor)
* Added `uiMode` to `AndroidInfoModule`. (**Note**: This required changing `extends BaseJavaModule` to `extends ReactContextBaseJavaModule` to be able to use `getSystemService` which requires `Context` instance!
* Added `isTV` constants to both `Platform.ios.js` (keeping the deprecated `isTVOS` as well) and `Platform.android.js`
* Changed condition check on `Touchable.js` to use the newly added `isTV` flag to properly handle TV navigation events on Android as well
* Added `LEANBACK_LAUNCHER` to `RNTester` `intent-filter` so that it is possible to launch it on Android TV devices.
* See also a PR to `react-native-website` repo with updated docs for Android TV: https://github.com/facebook/react-native-website/pull/59

 - [ ] Fix `TextInput` components handling by allowing them to be focused and making a proper navigation between them (and/or other components) possible. One thing to note here that the default behavior to immediately open software keyboard when focused on `TextInput` field will need to be adjusted on Android TV as well)
 - [x] Fix overlay permissions issue by changing the way redbox/dev menu are displayed (see: https://github.com/facebook/react-native/pull/16596)
 - [ ] Adjust placement of TV-related files (e.g. the `TVEventHandler.js` file is placed inside `AppleTV` directory which is not accurate, since it does handle Android TV events as well)

Previous discussion: https://github.com/SoftwareMansion/react-native/pull/1
<!--
Help reviewers and the release process by writing your own release notes

**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 ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - 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
-->

[ANDROID] [FEATURE] [TV] - Added support for Android TV devices
Closes https://github.com/facebook/react-native/pull/16500

Differential Revision: D6536847

Pulled By: hramos

fbshipit-source-id: 17bbb11e8583b97f195ced5fd9762f8902fb8a3d
2018-03-06 10:47:02 -08:00
Kevin Gozali b4ce4277af iOS: branch out Fabric handling into a separate RCTSurface-compatible class.
Reviewed By: mmmulani

Differential Revision: D7158824

fbshipit-source-id: 80eb61835181fa3f522b788e2861470cba88890a
2018-03-05 18:57:30 -08:00
Dan Zimmerman 19a4a7d3cb Remove callFunctionSync experimental APIs
Reviewed By: michalgr

Differential Revision: D6124038

fbshipit-source-id: 219afe30783da92cf10f800dc35e64823b61cf4b
2018-03-05 14:32:00 -08:00
Kevin Gozali 34b8876ac6 iOS: Introduced RCTSurfaceHostingProxyRootView for migration to RCTSurfaceHostingView
Summary:
To help with migration from direct usages of RCTRootView to RCTSurfaceHostingView, RCTSurfaceHostingProxyRootView is added, which is simply a custom impl of RCTSurfaceHostingView, but will all RCTRootView APIs preserved. This makes it easy to do a drop-in replacement in native callsites:

```
// before:
RCTRootView *rootView = [[RCTRootView alloc] init...];

// after:
RCTRootView *rootView = (RCTRootView *)[[RCTSurfaceHostingProxyRootView alloc] init...];
```

Reviewed By: shergin

Differential Revision: D7141696

fbshipit-source-id: db8c447749eaa896efaa37774a9babef132128eb
2018-03-02 19:44:18 -08:00
Shoaib Meenai ffcd067977 Wrap global variables in extern C
Reviewed By: compnerd

Differential Revision: D7144899

fbshipit-source-id: d40bda0e9225734398e35adc582b8932c0280b24
2018-03-02 19:44:18 -08:00
Leo Natan 30469ed001 Expose React Native version as a symbol rather than macro
Summary:
Add RCTGetReactNativeVersion() to expose version in native code. Right now, version is exposed internally to RN using a MACRO constant. This exposes a symbol (function) that can be called to retrieve the React Native version in iOS.

Also exposed RCTVersion.h as a public header in the React project so it is available to developers.

The motivation behind this is for https://github.com/wix/detox —we need to know what RN version the user has, if any, so we can properly handle support and abstract differences.

Ran bump-oss-version.js to ensure the template is applied properly. Also compiled the project to make sure nothing is broken.

 [IOS] [ENHANCEMENT] [RCTVersion.h] - Expose version as a compile-time symbol for native queries

<!--
Help reviewers and the release process by writing your own release notes

**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 ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - 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/18136

Differential Revision: D7141076

Pulled By: hramos

fbshipit-source-id: 18a92b8c60d7b43fa0ed22597ea46a35cff73c56
2018-03-02 14:51:39 -08:00
Kevin Gozali 006b77f1ae iOS: pass fabric flag down to RCTRootView/RCTSurface for proper unmounting
Reviewed By: shergin

Differential Revision: D7119220

fbshipit-source-id: 7a822036e29e0d92f53a164acba2ab75e883b5c4
2018-02-28 20:17:37 -08:00
Shoaib Meenai 0d03fddeca Use complete type with unique_ptr
Reviewed By: fromcelticpark

Differential Revision: D7114324

fbshipit-source-id: c9305c478ebe31ea35b590b861919fd42f56662d
2018-02-28 15:03:25 -08:00
Julien K 6c353fd7e9 onPress animation with magnification
Summary:
Related to: #15454

Motivation: Improve tvOS feeling for TouchableHighlight

![changewithaniamtion](https://user-images.githubusercontent.com/7658664/29193477-b99b4a10-7e25-11e7-8b31-e0e4ca9d7720.gif)

- When you select the button he is focus and the underlay is show
- When you press the button, there is an animation, but after the animation, the focus is on the button and the underlay is show

Play with tvParallaxProperties on tvOS, test with and without patch just to see the actual behaviour
```
			<TouchableHighlight
						tvParallaxProperties={{
							enabled: true,
							shiftDistanceX: 0,
							shiftDistanceY: 0,
							tiltAngle: 0,
							magnification: 1.1,
                                                        pressMagnification: 1.0,
							pressDuration: 0.3,
						}}
						underlayColor="black"
						onShowUnderlay={() => (console.log("onShowUnderlay")}
						onHideUnderlay={() =>  (console.log("onHideUnderlay")}
						onPress={() =>  (console.log("onPress")}
					>
						<Image
							style={styles.image}
							source={ uri: 'https://www.facebook.com/images/fb_icon_325x325.png' }
						/>
					</TouchableHighlight>
```
Closes https://github.com/facebook/react-native/pull/15455

Differential Revision: D6887437

Pulled By: hramos

fbshipit-source-id: e18b695068bc99643ba4006fb3f39215b38a74c1
2018-02-27 13:10:02 -08:00
Kevin Gozali 28c694f25a iOS - expose C++ FabricUIManager to the bridge via a wrapper class
Reviewed By: shergin

Differential Revision: D7093253

fbshipit-source-id: 7317144ad2cb5b8903227c779798e1576f8de2c2
2018-02-27 08:42:14 -08:00
Manman Ren ebbd4371c9 Mark ObjC methods that are called from React Native as dynamic.
Reviewed By: mmmulani

Differential Revision: D7087100

fbshipit-source-id: 18e5726e5b48e7b71fcaab19f6fe73be0cad6233
2018-02-26 12:24:17 -08:00
Ken Woo 3eee96ab86 Change React Native application layout check
Reviewed By: shergin

Differential Revision: D7076910

fbshipit-source-id: dc6df2dee886bbdf139d6e50192d621efad6d57e
2018-02-26 11:49:36 -08:00
siddhantsoni 16c9e5b715 Fix: Added scroll Bounds check in scrollToOffset method in RCTScrollView on iOS
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

The scrollToOffset method of RCTScrollView for iOS does not include bound check for the scroll offset provided to the method. This can cause the whole view to scroll out of screen if the offset provided is greater than the bounds of the View.
The same does not happen on Android, where the scroll halts once the last item of the scrollView is in the viewport.
I have added bounds check so the offset resets to the MaxOffset which makes sure the view does not scroll out of the viewport.

The issue can be observed in the following snack:
https://snack.expo.io/H1363Uo8f

![ezgif com-optimize 1](https://user-images.githubusercontent.com/16662518/36068270-2437ae88-0ef7-11e8-96dd-819b4ae0fd67.gif)

To test my changes I ran the code provided in the snack above with the react-native dependency pointing to my branch. As can be see in the video attached below, the scroll halts once it hits the end of the ScrollView even if the scroll offset provided is higher than the bounds of the ScrollView. It also does not scroll up for negative scroll offset.

![ezgif com-optimize](https://user-images.githubusercontent.com/16662518/36068130-9ae4f918-0ef3-11e8-8728-af7b2888bdb8.gif)

[IOS] [BUGFIX] [ScrollView] - Added bounds check to prevent ScrollView from scrolling to an offset which is out of bounds of the ScrollView for iOS.
Closes https://github.com/facebook/react-native/pull/17927

Differential Revision: D7014466

Pulled By: shergin

fbshipit-source-id: a817738d08e1057a4c70f43373132f88fa1461c4
2018-02-25 22:18:31 -08:00
Kevin Gozali 486ac9dc82 update FabricUIManager to call the right JS object
Reviewed By: sebmarkbage

Differential Revision: D7037275

fbshipit-source-id: 6a1d13227910d0cdb99dde4b6c98ed7a20ef9911
2018-02-23 17:04:40 -08:00
Valentin Shergin b7fbeb253a RCTSurface: Support for synchronous waiting for mounting stage
Summary:
So, all initial operations can now be done synchronously (and on the main thread).
To do so, instancitate `RCTSurface` object and call `synchronouslyWaitForStage:timeout:` method like that:

RCTSurface *surface = [[RCTSurface alloc] initWithBridge:... moduleName:... initialProperties:...];
BOOL success = [surface synchronouslyWaitForStage:RCTSurfaceStageSurfaceDidInitialMounting timeout:timeout];

or

RCTSurfaceHostingView *surfaceHostingView = [[RCTSurfaceHostingView alloc] initWithBridge:... moduleName:... initialProperties:...];
BOOL success = [surfaceHostingView.surface synchronouslyWaitForStage:RCTSurfaceStageSurfaceDidInitialMounting timeout:timeout];

Reviewed By: fkgozali

Differential Revision: D7014178

fbshipit-source-id: c3c13904a3587ff2a222fa71623c40c8f30bc8af
2018-02-20 22:19:45 -08:00
Valentin Shergin 402ae2f01f New UIManager API allowing intercept/delay mounting process
Summary: In some embedding/interop cases (RN inside, something else outside), the interop layer has to have the ability to control (intercept, delay, perform synchronously with another stuff) mounting process. This API allows doing that.

Reviewed By: fkgozali

Differential Revision: D7014179

fbshipit-source-id: 04036095f7e60a5ff7e69025ff6066fea92eb361
2018-02-20 22:19:45 -08:00
Valentin Shergin 60c000022e Enforcing sequential ordering of creating view and applying props in UIManager
Summary: See the comment in code.

Reviewed By: fkgozali

Differential Revision: D7014177

fbshipit-source-id: c58db856d7701a285564470eb1f024b5012dd451
2018-02-20 22:19:44 -08:00
Valentin Shergin b90c1cf6c3 RCTSurface: Optional sync ShadowView/View registing
Summary:
See the comment in code.
If we on the main thread on registering time, we can/will break sequentiality of registering and mounting processes doing registration asynchronously.
We need this to make sync mouting eventually possible.

Reviewed By: fkgozali

Differential Revision: D7014176

fbshipit-source-id: 110ad5e5d86e3422eac15c3b1bdb29ae04acd7e6
2018-02-20 22:19:44 -08:00
Pritesh Nandgaonkar c75ce8146f Add constructor in YGLayout
Reviewed By: emilsjolander

Differential Revision: D7019653

fbshipit-source-id: 5a2655626db0915fcebe7d4517e2d0b2e2484460
2018-02-20 05:55:36 -08:00
Pritesh Nandgaonkar b9991d33e3 Move YGStyle to seperate file and add constructors
Reviewed By: emilsjolander

Differential Revision: D7016575

fbshipit-source-id: eb28df0ffb4cc813b23edaff80d7d4ebc56ce6af
2018-02-20 05:55:36 -08:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Douglas 3a3d884df2 tvOS: TV nav event emitter should check for bridge
Summary:
When running with the packager in the tvOS simulator, reloading from the packager hits an assert in `RCTEventEmitter`, causing a crash.  The solution is for `RCTTVNavigationEventEmitter` to check for the existence of the bridge before attempting to send an event.

Manual testing.

[IOS] [BUGFIX] [RCTTVNavigationEventEmitter.m] - Fix crash when reloading in tvOS
Closes https://github.com/facebook/react-native/pull/17797

Differential Revision: D7014975

Pulled By: hramos

fbshipit-source-id: 0bf766e87267ca8592ff0cc0b3cb4621a8e8f9b5
2018-02-16 14:36:56 -08:00
Mehdi Mulani f96dfb9468 Disable font scaling when an explicit font handler is set
Reviewed By: sahrens

Differential Revision: D7003464

fbshipit-source-id: f36ff344c50a9c63af6c852138041c1c918259c8
2018-02-16 12:37:51 -08:00
Kevin Gozali 5f48bd84aa iOS: allow getting an instance of a js-bound module via the bridge
Reviewed By: sebmarkbage

Differential Revision: D6982785

fbshipit-source-id: 7bbcc5416e1d1a3a577328349a7c18af5c0f8577
2018-02-13 22:38:55 -08:00
Kevin Gozali 1aeb9250bd Add JS binding for FabricUIManager - iOS
Reviewed By: sebmarkbage

Differential Revision: D6934518

fbshipit-source-id: 1f626f79a74fb199925644e8b16238aa17d40e1f
2018-02-13 22:38:55 -08:00
Kevin Gozali e165d0dcf0 allow installing extra JS binding via the bridge
Reviewed By: mdvacca

Differential Revision: D6957397

fbshipit-source-id: 172905861fbb1c9ed45149e33b406c28ad616cd7
2018-02-13 22:38:55 -08:00
Paco Estevez Garcia ad2d9e7fab Forward VM version to inspector
Reviewed By: bnham

Differential Revision: D6938018

fbshipit-source-id: c79853ddf835acab86a16ebd539874d29d3aa60a
2018-02-13 08:16:50 -08:00
Valentin Shergin f91f7d91a1 Reimagining of RCTShadowView layout API
Summary:
This is reimagining of interoperability layer between Yoga and ShadowViews (at least in Yoga -> RN part).
Goals:
 * Make it clear and easy.
 * Make clear separation between "what layout what", now parent always layout children, noone layout itself.
 * Make possible to interleave Yoga layout with custom imperative layout (may be used in SafeAreaView, Text, Modal, InputAccessoryView and so on).

Reviewed By: mmmulani

Differential Revision: D6863654

fbshipit-source-id: 5a6a933874f121d46f744aab99a31ae42ddd4a1b
2018-02-12 00:32:43 -08:00
Martin Arista 47b36d3ff0 Update DevLoadingView to Support iPhone X
Summary:
The current implementation of DevLoadingView for iPhone currently gives a static height of `22` and does not take into account iPhoneX screen dimensions.

Devices: All iPhone devices currently available with Xcode v9.2
SDK: 8.1, 9, 10, 11

Validate resize only occurs on iPhone X devices and others remain consistent.

Before:
![feb-10-2018 12-30-20](https://user-images.githubusercontent.com/1743953/36065313-7b41f2ea-0e5e-11e8-87f2-928e26536077.gif)

After:
![feb-10-2018 12-28-15](https://user-images.githubusercontent.com/1743953/36065317-848e4f7e-0e5e-11e8-8aab-70cb5db32f31.gif)

[GENERAL][ENHANCEMENT][{React}] - Improvements to DevLoadingView for iPhone X
Closes https://github.com/facebook/react-native/pull/17936

Differential Revision: D6962962

Pulled By: shergin

fbshipit-source-id: e11d9386544fe19a9195e22a03e12f64e934cad7
2018-02-11 22:49:21 -08:00
Ben Nham fa334ce464 always create debugger websocket connection
Reviewed By: Hypuk, pakoito

Differential Revision: D6918269

fbshipit-source-id: 3175c75d4e8459a61d7907555ab9bd4e95002853
2018-02-08 10:29:40 -08:00
Dmitry Zakharov 0c49c1f332 Native Modules -> Native Extensions
Reviewed By: danzimm

Differential Revision: D6887988

fbshipit-source-id: 475c05f60a2e1ddcfaa9263ab363bff8a528236a
2018-02-07 08:07:13 -08:00
Kevin Gozali b1e5c01483 iOS: Added scaffolding for FabricUIManager native module
Summary: Experimental scaffolding for FabricUIManager.

Reviewed By: mdvacca

Differential Revision: D6908587

fbshipit-source-id: 646fcc72f54dce736378a7777e5753ed56efc2f6
2018-02-06 21:49:37 -08:00
Valentin Shergin 114c258045 Enabling round-to-pixel Yoga feature for RN (iOS)
Summary:
This change enables built-in Yoga mechanism which rounds producing layout metrics to closest "pixel" values.
See previous diff for more context.

Reviewed By: fkgozali

Differential Revision: D6889762

fbshipit-source-id: bc2eea44704db4b377e2e14fab9f67be8c935719
2018-02-05 22:17:22 -08:00
Valentin Shergin ceb1d1ca5b Removing our own implementation of round-to-pixel algorithm
Summary:
> Okay, I don't remember where we first met
> But hey, admitting is the first step

This issue has a looong history.
The original algorithm was introduced by Nick Lockwood (nicklockwood Hey Nick! We miss you!) a while ago and from the very beginning this has one small error that basically makes it useless (try to find it yourself, it's fun!)
The problem was discovered and fixed twice (D4133643, D4983054), but every time we found that our <Text> infra was not ready for this, so we reverted and abandoned the change. As part of the last attempt to finally solve the issue, I ported the algorithm to Yoga where it lives today and works very well for Lytho and CK.
For now, the vision is clear:
 * The basic algorithm should live in Yoga for unification and performance reasons.
 * We still have to have `absolutePostion` as part of this API because it might be useful for some components which implement its own custom/non-Yoga-based layout.
 * We have to enable it in RN eventually.

So, this is the first step: Removing old, broken code which we don't plan to fix and use.

Make React Native crisp again!

Reviewed By: fkgozali

Differential Revision: D6888662

fbshipit-source-id: 2e5098d9935dcbe05d66c777dad3a9ec8ac87ec3
2018-02-05 22:17:22 -08:00
Valentin Shergin c19bc79688 `[RCTShadowView isHidden]` was removed
Summary:
It's unused.
Use `display` prop instead to control visiblity of the view.

Reviewed By: fkgozali

Differential Revision: D6888104

fbshipit-source-id: dd37a365033ec36bdfcfa305ec6a965a10dec2cd
2018-02-05 22:17:22 -08:00
Valentin Shergin 9dfa2e7f3c Removed `[ShadowView collectUpdatedFrames:]`
Summary: Another juicy leftover from old Text implementation.

Reviewed By: fkgozali

Differential Revision: D6887942

fbshipit-source-id: d0363d06d566554c03d0ae3293597daf9c387028
2018-02-05 22:17:22 -08:00
Valentin Shergin 0f9fc4b295 `processUpdatedProperties` & `collectUpdatedProperties` was removed from RCTShadowView
Summary: This is leftovers from last <Text> reimplementation; nobody uses it and it does not hooked up with UIManager.

Reviewed By: fkgozali

Differential Revision: D6887795

fbshipit-source-id: 9e2e29af4ba959270096eeb494666d1cacaeba32
2018-02-05 22:17:22 -08:00
Marc Horowitz 816d417189 Delete RCTBatchedBridge
Summary:
I've talked to several major community users, and they're all ok with deleting this
code.  There's several doc fixes which will make it easier for third
party developers which should land about the same time this will.

Also buried along with it is RCTJSCExecutor.

Reviewed By: javache

Differential Revision: D6880781

fbshipit-source-id: b4cb1143def6fd23a96290e478fa728adbedacd3
2018-02-05 12:02:35 -08:00
Ray Shih 88980f2ef7 Implement bundle sync status
Reviewed By: pakoito

Differential Revision: D6807480

fbshipit-source-id: d71f2cecd882c47e79bb71dfb9d03d3597fa4068
2018-02-01 06:18:13 -08:00
Valentin Shergin d74ff6fadd Fixed typo in RCTSurfaceRootShadowView
Summary:
Trivial.
Special thanks to janicduplessis

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

Reviewed By: fkgozali

Differential Revision: D6863932

fbshipit-source-id: d40a30271adc5c8d47149ab920e2ac11158ab756
2018-01-31 15:16:36 -08:00
Mehdi Mulani a70fdac5bd Measure touch events from nearest "root view"
Summary:
This makes RCTTouchHandler follow the same logic when sending touch event
coordinates as `UIManager.measure`.
This is important as UIManager.measure is used in `Touchable.js` aka the mother
of all touch events in RN.

In particular, this will make touch events correctly handled for places where RN is embedded into other screens.

Reviewed By: shergin

Differential Revision: D6838102

fbshipit-source-id: 70cad52606ea931cb637d8aa2d4845818eea0647
2018-01-31 14:46:39 -08:00
Agastya Darma b1cdb7d553 Implementing space-evenly
Summary:
So in v0.52.0 space-evenly is introduced but not yet implemented (1050e0b by woehrl01). This pull request implements the space-evenly.

Manual Testing.
![notes marker](https://i.imgur.com/IXmezVY.png)

[IOS] [FEATURE] [Yoga] Adding space-evenly on justify-content in iOS
[ANDROID] [FEATURE] [Yoga] - Adding space-evenly on justify-content in Android
Closes https://github.com/facebook/react-native/pull/17805

Differential Revision: D6858294

Pulled By: shergin

fbshipit-source-id: 7a705ca05f58603ef4588e1bfd16c16a78f8a390
2018-01-31 10:17:22 -08:00
Douglas Lowder a63fd378a4 Link both iOS and tvOS libraries with react-native link (fix #13783)
Summary:
Fix issues with the react-native CLI when linking iOS and tvOS libraries to a project created with `react-native init`. (#13783)

Verified the changes against test project at https://github.com/dlowder-salesforce/react-native-link-test.  Both `react-native link react-native-svg` and `react-native unlink react-native-svg` work correctly on this project.  Added new unit test for the new file added to `local-cli/link/ios`.

[CLI] [BUGFIX] `react-native link` has been fixed to correctly link iOS and tvOS targets.
[IOS] [BUGFIX] `react-native link` has been fixed to correctly link iOS and tvOS targets.
Closes https://github.com/facebook/react-native/pull/17231

Differential Revision: D6837567

Pulled By: hramos

fbshipit-source-id: 234d3d3966ae1b89cd16a37c95d303553f7ba5f5
2018-01-30 16:28:59 -08:00
Valentin Shergin 5fba82deff Fixing clowntown in RCTSurfaceRootShadowView
Summary: Obvious.

Reviewed By: mmmulani

Differential Revision: D6829844

fbshipit-source-id: 6c49be990fbcc3be2b5595866c3d1fd42a3eb3e9
2018-01-30 14:31:57 -08:00
Mehdi Mulani a9c684a0ff Allow substituting a default font handler
Reviewed By: nscoding

Differential Revision: D6798995

fbshipit-source-id: 541b4391428d1ee9c0b394033182dc232536c864
2018-01-30 13:51:19 -08:00
Semen Zhydenko 8ffc16c6e7 Typos in code
Summary:
To fix typos

No testing required, changed only internal things names

No

addtionalStyles -> additionalStyles
occured -> occurred
recomendedType -> recommendedType
markDirtyAndPropogate -> markDirtyAndPropagate
targetting -> targeting
RCTApplyTranformationAccordingLayoutDirection -> RCTApplyTransformationAccordingLayoutDirection (tranform -> transform)
Closes https://github.com/facebook/react-native/pull/17587

Differential Revision: D6832696

Pulled By: shergin

fbshipit-source-id: 452287e5ce82df5c6b87126cb21889b7bd9d73c1
2018-01-29 19:17:33 -08:00
Adam Putinski 31288161e1 Add accessibilityElementsHidden prop
Summary:
Allow iOS to have similar accessibility functionality to Android. This PR exposes the `accessibilityElementsHidden` property on iOS which is similar to Android's `importantForAccessibility="no-hide-descendants"`

I didn't see any existing examples for testing native props being passed through, but I did add an example to the RNTester app. I've attached some screenshots using the Accessibility Inspector to verify the property was correctly passed through.

![a](https://user-images.githubusercontent.com/603528/34998153-50e66776-faac-11e7-826d-1445a6813929.png)
![b](https://user-images.githubusercontent.com/603528/34998158-535a7420-faac-11e7-80d4-992fb7cd82dd.png)

I've updated the website with appropriate documentation.

https://github.com/facebook/react-native-website/pull/141

![screen shot 2018-01-16 at 10 23 50](https://user-images.githubusercontent.com/603528/34998202-6f2f39a6-faac-11e7-8651-0cfe8e037a30.png)
![screen shot 2018-01-16 at 10 23 59](https://user-images.githubusercontent.com/603528/34998205-711d6f94-faac-11e7-974d-54340c72fce4.png)

[IOS] [FEATURE] [View] - Added accessibilityElementsHidden property
Closes https://github.com/facebook/react-native/pull/17627

Differential Revision: D6806444

Pulled By: hramos

fbshipit-source-id: 50d31fdb92f4c59ae9355b019c422418b2e6cc24
2018-01-29 14:44:11 -08:00
Dmitry Zakharov 429fcc8cab Migrate DeviceInfoModule from RN Module to Native Function.
Reviewed By: danzimm

Differential Revision: D6750934

fbshipit-source-id: f453801737e41632c6b84ff894e7f0eb66b575dc
2018-01-29 11:18:42 -08:00
Valentin Shergin e3ff3cf6cb Removed outdated assertion in RCTShadowView related to breaking change in Yoga
Summary: It's been more than two years; I think everyone already migrated and learned the new behavior.

Reviewed By: emilsjolander

Differential Revision: D6829885

fbshipit-source-id: a86d56fb7235a137e9ce6e360d7ae2224b047313
2018-01-29 10:47:14 -08:00
Vojtech Novak ed5872e2cc Make sure refreshControl shows up on initial render if specified
Summary:
[this commit](2e1707d0e6) which was just a small refactor broke refreshControl behavior - if we render FlatList with refreshing=true, the refreshControl won't be visible on initial render.

The problem is, the [previous beginRefreshing method](2e1707d0e6 (diff-cfafa8d7e42ab87ab863f917e187a4aeL51)) was renamed to `beginRefreshingProgramatically` and the old call was left in one place [here](2e1707d0e6 (diff-cfafa8d7e42ab87ab863f917e187a4aeR47)).

Now, I am not sure what kind of jumping the mentioned commit was fixing, but since this fix only concerns the initial render, I believe it will not influence the jumping fix.

I have tested this locally in my app, can provide a video if needed.

none

 [IOS] [BUGFIX] [RefreshControl] - Make sure refreshControl shows up on initial render if specified
Closes https://github.com/facebook/react-native/pull/17727

Differential Revision: D6827402

Pulled By: shergin

fbshipit-source-id: 25849244e87af54f25d636b6ade7adcf88958980
2018-01-28 22:29:51 -08:00
Valentin Shergin 2716f53220 The New <Text> on iOS
Summary:
This is a complete rewrite of RCTText, the part of React Native which manages Text and TextInput components.

Key points:

* It's understandable now. It follows a simple architectural pattern, and it's easy to debug and iterate. Text flow layout is a first-class citizen in React Native layout system now, not just a wired special case. It also brings entirely new possibilities such as nested interleaving <Text> and <View> components.
* All <Text>-specific APIs were removed from UIManager and co (it's about ~16 public methods which were used exclusively only by <Text>).
* It relies on new Yoga measurement/cloning API and on-dirty handler. So, it removes built-in dirty propagation subsystem from RN completely.
* It caches string fragments properly and granularly on a per-node basis which makes updating text-containing components more performant.
* It does not instantiate UIView for virtual components which reduces memory utilization.
* It drastically improves <TextInput> capabilities (e.g. rich text inside single line <TextInput> is now supported).

Screenshots:
https://cl.ly/2j3r1V0L0324
https://cl.ly/3N2V3C3d3q3R

Reviewed By: mmmulani

Differential Revision: D6617326

fbshipit-source-id: 35d4d81b35c9870e9557d0211c0e934e6072a41e
2018-01-24 00:03:01 -08:00
Alex Dvornikov 70d23e82ad Check for nullptr when accessing isInspectable method
Reviewed By: javache

Differential Revision: D6785733

fbshipit-source-id: 1bbb884746e671124b7d2d950a3419ea33d70522
2018-01-23 10:13:36 -08:00
Alex Dvornikov 493f3e8da5 Handle invalidation error in RCTObjcExecutor
Differential Revision: D6748200

fbshipit-source-id: eb98782c2ba080273c1f027846984f5f4caddf26
2018-01-18 15:23:03 -08:00
Spencer Ahrens 65184ec6b0 rename and extend new maintain visible content position feature
Summary:
Builds off of cae7179c94

- Make the prop a dictionary for more configuration options
- Rename `maintainPositionAtOrBeyondIndex` -> `maintainVisibleContentPosition` + `minIndexForVisible`
- Add autoscroll threshold feature

Given the async native of RN JS and background layout, there is no way to trigger the scrollTo from JS without risking a delay, so we add the feature in native code.

== Test Plan ==
ScrollViewExample:
https://youtu.be/pmY8pxC9PRs

Reviewed By: shergin

Differential Revision: D6729160

fbshipit-source-id: 70f9bae460ce84567857a4f696da78ce9b3b834c
2018-01-18 14:01:50 -08:00
Valentin Shergin 6882132421 Introduced -[RCTShadowView contentFrame]
Summary:
Another trivial sugar/helper to access computed by Yoga layout metrics.
We will use it soon in the new Text render/layout engine.

Reviewed By: mmmulani

Differential Revision: D6671979

fbshipit-source-id: d36933415c2fa50bae5cc171434d8f0b281955b7
2018-01-16 12:57:46 -08:00
Valentin Shergin 193a2bd4cd Tweaking -[RCTSurface synchronouslyWaitForStage:]
Summary: Waiting for layout is now available on main thread.

Reviewed By: mmmulani

Differential Revision: D6719836

fbshipit-source-id: ef655095e999df5f77e69c5931459cce1aaeb1f0
2018-01-16 12:32:13 -08:00
Semen Zhydenko d2c569795c Typos in comments and log messages
Summary:
No code changes, no testing required.

alligned -> aligned
allignment -> alignment
completly -> completely
conseptually -> conceptually
decendents -> descendants
indefinetly -> indefinitely
dimention -> dimension
doesnt -> doesn't
safegaurd -> safeguard
intialization -> initialization
hierachy -> hierarchy
happend -> happened
gaurd -> guard
programatically -> programmatically
initalized -> initialized
immidiately -> immediately
occured -> occurred
unkown -> unknown
neccessary -> necessary
neccesarily -> necessarily
occuring -> occurring
comoponent -> component
propogate -> propagate
recieved -> received
referece -> reference
perfomance -> performance
recieving -> receiving
subsquently -> subsequently
scoll -> scroll
suprisingly -> surprisingly
targetting -> targeting
tranform -> transform
symetrical -> symmetrical
wtih -> with
Closes https://github.com/facebook/react-native/pull/17578

Differential Revision: D6718791

Pulled By: shergin

fbshipit-source-id: 4ab79c1131ec5971d35a0c7199eba7ec0a0918ad
2018-01-12 22:18:45 -08:00
Spencer Ahrens cae7179c94 new feature to support smooth bi-directional content loading
Summary:
== Problem / Background ==

Most lists paginate in a single direction (standard infinite list), but some paginate in both directions. Most common example is a chat thread where new messages show up on the bottom, and old content can be loaded by scrolling up. Comment threads are another example.

Right now, adding content to the bottom of a scroll view is smooth - the content doesn't jump. But when adding to the top of the scrollview, the content gets pushed down, which is jarring (note this may appear reversed because of inverting the list which is common for chat applications).

== Approach ==

The basic idea is simple - we set a flag in JS, then for every uimanager transaction, we record which is the first eligible and visible view in the ScrollView, and compare it's new origin to the old one. If it has changed, we update the contentOffset of the ScrollView to compensate.

This is done by observing `willPerformMounting` directly (only from scrollviews that have this new property set), and then observing the prev state with prependUIBlock and making the update synchronously in addUIBlock to avoid any flicker.

There is also a way to skip views that we don't care about, like a spinner at the top of the view that we don't want to stay in place - we actually want it to get pushed up by the new content, replaced visually in the viewport.

== Notes ==

Most chat applications will probably want to do a scrollToTop when new content comes in and the user is already scrolled at or near the bottom.

This is glitchy if visible children are re-ordered, which could be fixed with additional logic, but it doesn't come up in the type of applications we're targetting here so punting on that.

== Test Plan ==

https://youtu.be/4GcqDGz9eOE

Reviewed By: shergin

Differential Revision: D6696921

fbshipit-source-id: 822e7dfcb207006cd1ba098356324ea81f619428
2018-01-12 19:16:00 -08:00
Valentin Shergin 06ebaf2205 Missing moving pieces of RCTSurfaceHostingView
Summary: Now it actually works.

Reviewed By: mmmulani

Differential Revision: D6701105

fbshipit-source-id: 16f3f4e319f874f9a08867b784d13aad4fa22aeb
2018-01-11 18:57:31 -08:00
Valentin Shergin 7d9e902d72 Proper check for RCTRootShadowView in RCTUIManager
Summary: Because setting `intrinsicContentSize` for `RCTSurfaceRootView` doesn't have much sense.

Reviewed By: mmmulani

Differential Revision: D6701107

fbshipit-source-id: 259cdd27339bba3e8c9f98b6ca34affeb87f298c
2018-01-11 18:57:31 -08:00
Stepan Hruda 2c74f93a62 Change setProjectRoot argument to NuclideUri
Reviewed By: matthewwithanm

Differential Revision: D6624825

fbshipit-source-id: 06df9af5c7be321b19f13efa8125fb10d8e00422
2018-01-10 12:32:55 -08:00
Pritesh Nandgaonkar b41d41fd40 Move utility functions to utils file
Reviewed By: emilsjolander

Differential Revision: D6682933

fbshipit-source-id: 0fd90fdaf5ca4f9b7a11cbd15d8c54c7d0ce8a03
2018-01-10 05:02:24 -08:00
Valentin Shergin b9b7fabf98 Revert D6641403: [RN] Refined -[RCTUIManager createView:]
Differential Revision: D6641403

fbshipit-source-id: f478810413aa49b44c060db898e7e8698bddb8e1
2018-01-09 22:36:31 -08:00
Douglas 3bd89867d6 Import RCTTVRemoteHandler only on tvOS
Summary:
Fix issue #17027 (`RCTModalHostView` has a tvOS dependency that was not wrapped in `TARGET_OS_TV`)

Existing test automation should pass.

[GENERAL] [BUGFIX] [tvOS] Fix cocoapods compile issue in RCTModalHostView
Closes https://github.com/facebook/react-native/pull/17502

Differential Revision: D6688166

Pulled By: hramos

fbshipit-source-id: 38297f439f75a8303f59f83b92e004c6c73d9bf6
2018-01-09 15:46:47 -08:00
Valentin Shergin c3139d798a Fixed crash happenned on deallocating RCTSurface
Summary:
Essentially, we had `dispatch_async` inside `delloc` method which tried to retain `self`, which is disallowed operation in ObjC runtime.
However, we don't need to notify anything `surface`-related in `_stop` because it always is called from `dealloc`.

Reviewed By: mmmulani

Differential Revision: D6665631

fbshipit-source-id: ed0d192946f3323f4f54ecb99b30e56e0942f174
2018-01-07 22:22:45 -08:00
Valentin Shergin e46ea8c737 Refined -[RCTUIManager createView:]
Summary: Now we do not add newly created view to the registry at the preluminary step.

Reviewed By: mmmulani

Differential Revision: D6641403

fbshipit-source-id: c69077aaba871f3cdb3500c75e1efe07546e1b7f
2018-01-07 21:31:06 -08:00
Valentin Shergin 176a578238 '-[RCTSurfaceRootShadowView sizeThatFitsMinimumSize:]' was removed
Summary: Because we already support this for all kinds of shadow views!

Reviewed By: mmmulani

Differential Revision: D6665636

fbshipit-source-id: ceee7e4952ede4bbe54aedde5545587a1d13ea5a
2018-01-07 18:31:20 -08:00
Valentin Shergin b2a251948f Proper usage CGFLOAT_MAX vs INFINITY inside RCTSurface
Summary: See `RCTShadowView+Layout.m` for more info about differences between CGFLOAT_MAX and INFINITY in Yoga and UIKit.

Reviewed By: mmmulani

Differential Revision: D6665635

fbshipit-source-id: 270ba5366c3dfe78e38474de5380d7d5d251e628
2018-01-07 18:31:20 -08:00
Valentin Shergin f96f9c5fd6 Sideeffectless measuring of shadow views
Summary:
That's now possible thanks to new Yoga's clonning API.
That will speed up RCTSurface measuring (see the next diff in stack) and should illuminate a class of problems in CK interop layer.
We also will use it in the new text layout engine (in React Native).

Reviewed By: gkassabli

Differential Revision: D6665632

fbshipit-source-id: e94909f0af89e9c7fc5e46b95090ecb3c52546a2
2018-01-07 18:31:20 -08:00
Valentin Shergin d9e5b313bb Helpers for proper conversion float values between CG and YG representations
Summary:
Yoga and CoreGraphics have different opinions about how "infinity" value
should be represented.
Yoga uses `NAN` which requires additional effort to compare all those values,
whereas GoreGraphics uses `GFLOAT_MAX` which can be easyly compared with
standard `==` operator.

Messing with this can cause super weired bugs like 100% CPU load for couple of seconds somewhere in CoreGraphics.

Reviewed By: mmmulani

Differential Revision: D6665633

fbshipit-source-id: b6236c6fa50d1f8fb0c9576203922f7b24b7301e
2018-01-07 18:31:20 -08:00
Valentin Shergin af226ef949 Designated methods to control dirty propagation
Summary:
Those are supposed to replace all `dirtyText`, `dirtyPropagation`, `isPropagationDirty`, `setTextComputed`, `isTextDirty` and so on.
We will use it widely soon (and remove all old ones).

Reviewed By: mmmulani

Differential Revision: D6665634

fbshipit-source-id: 3c1db7154e90b71446756f2495627b163c779996
2018-01-07 18:31:20 -08:00
Valentin Shergin 46be5bf71c Forgotten setNeedsLayout in -[UIManager intrinsicContentSize:]
Summary: That fixes a regression introduced in D5990342.

Differential Revision: D6669153

fbshipit-source-id: e7d7342d58878703e188ef27d82af8196a8d950a
2018-01-05 15:47:01 -08:00
Michael S. Kazmier 33d710e8c5 adds --port option to `react-native run-ios` as well as patches port …
Summary:
The pull request adds the `--port` option to `run-ios` allowing a developer to build and launch a react-native app using a single command line like this:
```
react-native run-ios --port 8088
```

It defaults to the current port 8081.

This pull request fixes issue #9145 and issue #14113.

This patch also extends `run-android` to properly test and launch the packager with the specified port, extending the work done in PR:  ##15316

1. Create a new react-native app, or simply clone this branch and then update your version of react-native using `yarn add file:./path/to/this/fork/of/react-native`
2. run `react-native run-ios --port 8088`
3. watch the packager start on the desired port (8088 in this case) and watch your app in your simulator connect to the packager and launch the app.
Closes https://github.com/facebook/react-native/pull/16172

Differential Revision: D6612534

Pulled By: shergin

fbshipit-source-id: 50af449f5e4c32fb76ba95f4cb7bf179e35526d5
2018-01-04 20:11:10 -08:00
Michael Schneider d3b41e0da3 Set minHeight instead of minWidth for calculating the layout in RCTSurfaceRootShadowView
Summary:
Fix calculating layout in `RCTSurfaceRootShadowView` as the `minWidth` is set doubled in `calculateLayoutWithMinimumSize:maximumSize:`.

cc shergin
Closes https://github.com/facebook/react-native/pull/17203

Differential Revision: D6642437

Pulled By: shergin

fbshipit-source-id: 3483c952c9ecf0132182a156b7b916eb1e975424
2017-12-28 10:40:28 -08:00
Valentin Shergin 0ec1017660 Fixed double initial prop applying for newly created views
Summary: This is a leftover from recent changes in D6595780 where a prop application step was moved out to separare mount block.

Differential Revision: D6640736

fbshipit-source-id: 70de0f55f992a7912e222ec4bf9ade1c9bad99f2
2017-12-27 18:02:05 -08:00
Alex Dvornikov 56a42e57d0 remove "prepareReact" call from the iOS bridge
Reviewed By: alexeylang

Differential Revision: D6581907

fbshipit-source-id: ca4bd4beef6d75305133a2b2c7de62e65e5aa3da
2017-12-26 14:47:29 -08:00
Valentin Shergin fc5e340e89 Revert D6596375: [RN] Removed unnecessary code path in `[RCTUIManager updateView:]`
Differential Revision: D6596375

fbshipit-source-id: f8b0ea2dafbf997a18e9c86fb279682d31b06d0e
2017-12-20 17:46:19 -08:00
Pieter De Baets a0ff8c7706 Fix ReactLegacy and delete RCTViewControllerProtocol
Summary:
It's always bothered that we have this protocol and I figured it could just be merged with RCTWrapperViewController.
Closes https://github.com/facebook/react-native/pull/17290

Reviewed By: mmmulani

Differential Revision: D6611544

Pulled By: javache

fbshipit-source-id: a50b9d5adbeb2c48dbadbbfc1c77ccf6d1aae144
2017-12-20 15:20:00 -08:00
Valentin Shergin 0ae4c47daa `-[UIView _DEBUG_reactShadowView]` was removed
Summary:
Nobody uses it.
If the reference to the bridge is available (which is should be case for testing purposes at least), it is easy to get same information.

Reviewed By: mmmulani

Differential Revision: D6596376

fbshipit-source-id: 066eeb1e9465b4e0cc9d9b5b6bf41722450870e4
2017-12-19 23:46:09 -08:00
Valentin Shergin c79246dbc6 Removed unnecessary code path in `[RCTUIManager updateView:]`
Summary: The `-[RCTShadowView viewName]` prop must exist, we don't need special handling for this case.

Reviewed By: mmmulani

Differential Revision: D6596375

fbshipit-source-id: 3e99a62bd6296e0285156f03dc2ac93db7f630e5
2017-12-19 23:46:09 -08:00
Valentin Shergin 7d1dedadd7 New implementation of handling `didUpdateReactSubviews` and `didUpdateReactSubviews` events
Summary:
Motivation:
* Current implementation of `didUpdateReactSubviews` relies on `processUpdatedProperties:parentProperties:` method of RCTShadowView, which we plan to remove.
* The existing implementation does not call handlers on unmounted nodes (because they are not part of traversing tree), which is not correct.
* The current implementation is tight with RCTComponentData, which is conceptually wrong, it should be a UIManager thing.
* The new implementation must be much more performant because of simplicity. (We can measure it only after removing `processUpdatedProperties`.)

Reviewed By: mmmulani

Differential Revision: D6595780

fbshipit-source-id: a517207c17b5d5db839c9ce99a37136292acf78c
2017-12-19 23:46:09 -08:00
Valentin Shergin 19a9c5e41d The Great File Renaming in RCTText
Summary:
The previous file/class name convention seemed cool... but now it drives me BANANAS! It makes all this code really hard to maintain.
So, evething were renamed following common modern RN convention.

Reviewed By: mmmulani

Differential Revision: D6605090

fbshipit-source-id: 88ca13d793a5d2adaac2b7922ec6bd4654aacec5
2017-12-19 20:14:00 -08:00
Pritesh Nandgaonkar f1055bcac8 Make YGNode as c++ struct with properties exposed through accessors
Reviewed By: emilsjolander

Differential Revision: D6592257

fbshipit-source-id: 641e8b9462ad00731a094511f9f5608b23a6bb21
2017-12-19 11:32:49 -08:00
Ben Nham 30da2622e2 avoid redbox in handleWrappedEvent
Reviewed By: Hypuk

Differential Revision: D6602420

fbshipit-source-id: 14cf396014d896878032ee4ab67a45700eb6c257
2017-12-19 10:30:52 -08:00
Valentin Shergin 2679f3efb6 Demolishing of background color propagation infra
Summary: As it was mentioned in previous diffs, we are removing this because it overcomplicates rendering layer and provides (almost) no benefits (and cannot be implemented 100% accurate way).

Reviewed By: mmmulani

Differential Revision: D6582560

fbshipit-source-id: 0778db96a45dd8e2520268d5d00792677cb01a20
2017-12-19 09:11:49 -08:00
Ben Nham 0673ac25f1 improve detection of inspectable JS contexts
Reviewed By: Hypuk

Differential Revision: D6578735

fbshipit-source-id: ac6a3a8bae9aef7fd3b4a036c3f154b3f6b7d80c
2017-12-18 13:32:36 -08:00
Ben Nham 15cd98b782 add isInspectable property
Reviewed By: Hypuk

Differential Revision: D6578736

fbshipit-source-id: a4229c3766125ff55cff50a49893b2385f9c8a6a
2017-12-18 13:32:36 -08:00
Valentin Shergin d2dc451407 reactBridgeDidFinishTransaction was finally removed
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

Reviewed By: mmmulani

Differential Revision: D6549729

fbshipit-source-id: 58094aab982c67cec3d7fa3b616c637cb84d697f
2017-12-18 11:47:26 -08:00
Valentin Shergin b263560c73 reactBridgeDidFinishTransaction was removed from RCTTabBar
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

This diff replaces usage of `reactBridgeDidFinishTransaction` with `uiManagerDidPerformMounting` which has very similar semantic except that fact that `uiManagerDidPerformMounting` is called asynchronously on the next run loop tick. And this should be okay because new React partial rendering does not guarantee synchronous execution anyways.

Reviewed By: mmmulani

Differential Revision: D6549586

fbshipit-source-id: 589b814f83b91ed8fabf7e638e7554ab3c9d286e
2017-12-18 11:47:26 -08:00
Valentin Shergin 099b28006b `reactBridgeDidFinishTransaction` was removed from RCTNavigator
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

This diff replaces usage of `reactBridgeDidFinishTransaction` with `uiManagerDidPerformMounting` which has very similar semantic except that fact that `uiManagerDidPerformMounting` is called asynchronously on the next run loop tick. And this should be okay because new React partial rendering does not guarantee synchronous execution anyways.

Reviewed By: mmmulani

Differential Revision: D6549217

fbshipit-source-id: 2649e943e82e6fbe02c7678583a97db3f5800201
2017-12-18 11:47:26 -08:00
Valentin Shergin b8e60a3ca3 reactSetInheritedBackgroundColor was removed from RCTView
Summary:
Now setting explicit backgroundColor style is required for Views with background shadow,
otherwise the shadow will be generated based on content of the view (which is expected behaviour).

Reviewed By: mmmulani

Differential Revision: D6582587

fbshipit-source-id: 0514cb3c57bad17d2af40810b0e0f7ddc96a2c31
2017-12-18 11:47:26 -08:00
Valentin Shergin 2789ba016b zIndex prop was removed from RCTShadowView
Summary:
This was leftovers from old implementation of zIndex feature.
Janic janicduplessis refactored this and moved all logic to UIView layer, so we don't need this prop anymore in shadow realm.
More info: https://github.com/facebook/react-native/pull/14011

Reviewed By: mmmulani

Differential Revision: D6574414

fbshipit-source-id: 2cae19350765689784d7884ed875878d39b4e3f1
2017-12-18 11:47:26 -08:00