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

39 Коммитов

Автор SHA1 Сообщение Дата
Eric Lewis 19866aee3d Fix 50 xcode warnings (#23553)
Summary:
This PR reduces the number of warnings in React from 68 to 18. Mostly by marking unused variables. RNTester's warnings are more than halved.

[iOS] [Fixed] - Xcode warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/23553

Differential Revision: D14151339

Pulled By: hramos

fbshipit-source-id: 8255330bf910a69a4c03051d91d7b0de3fadf2d1
2019-02-20 10:17:26 -08:00
Francisco Javier Trujillo Mata a93db4915b Removing warning for Pointer is missing a nullability type specifier … (#17872)
Summary:
Xcode 9 has compiler settings that are more strict. This can occur if someone updates there project to use the default settings.

This patch declares the default type instead of allowing the compiler to determine it. Instead of () we now say (void) in a block call.

Motivation
It was just trying to get my project totally empty of warnings, and it has no side effects. If there are side effects, then we should fix the type and not go with empty to represent void.

Test Plan
Update project settings in Xcode. This code doesn't have any known side effects since the compiler assumes the type is void when not declared.

Release Notes
[DOCS] - Fixed potential compiler build issue on Xcode 9 after updating settings in project.
Pull Request resolved: https://github.com/facebook/react-native/pull/17872

Differential Revision: D6981435

Pulled By: hramos

fbshipit-source-id: 508ecea0f8874dc16a25f1dee6255481b309f8c2
2019-01-16 09:50:48 -08:00
Spencer Ahrens a3b348eacb clean up surface register / start
Summary:
`RCTSurfaceHostingProxyRootView` surfaces are still automatically started right after the initialization to match `RCTRootView` interface, but `RCTSurfaceHostingView` must be started explicitly now. Also fixed some internal stuff so start and register are clear and distinct.

Background / initial motivation:

One tricky bit - we render the template as part of init`ing the rootView, so we don't know what the surfaceId will be before hand to register the UITemplate. Two possible solutions:

1) Require start be called explicitly after initializing the rootView, and setup the context in between.
2) Do something like "setUITemplateConfigForNextSurface" before creating the rootView, and have some hook when the surfaceId is assigned that associates the surfaceId with that "next" UITemplate stuff before.

(1) seems a lot cleaner, but it requires ever user of rootView to explicitly call start on it - how do you feel about that? Seems like we could also use that start call to decide if the initial render should be synchronous or not? start vs. startSync?

Reviewed By: mdvacca

Differential Revision: D13372914

fbshipit-source-id: 6db297870610e6c231f8a78c0dd74d584cb64910
2018-12-21 18:00:35 -08:00
Valentin Shergin 1bd66d9aa9 RCTSurface: Calling `start` is now required to start the Surface
Summary:
So, it does not start itself automatically right after instantiation.
(Classic RCTSurface still kinda start itself automatically but only because start/stop concept is not implemented for this yet.)

Reviewed By: sahrens

Differential Revision: D13461294

fbshipit-source-id: 05430688f69a0d9bf75d03e6d25f02ccd5d3176a
2018-12-18 12:57:38 -08:00
Kevin Gozali 54a6e1ad38 Surface: fixed up surface stage value check
Summary: Some logic to check for surface stage should've done bitwise `&` operation instead of equality check, because we do bitwise `|` whenever we "set stage".

Reviewed By: shergin

Differential Revision: D13459156

fbshipit-source-id: 94e2f5279fb1a31060beb7d6195953b25ce603c9
2018-12-13 16:52:30 -08:00
Valentin Shergin 7420048b63 Fabric: RCTSurface's start and stop methods
Summary:
The original design of RCTSurface implied that the Surface starts on initialization and stops on deallocation. Recently I realized that this not sufficient API in some cases when the application uses ARC with autorelease pools (that can postpone object deallocations, which is highly undesirable).
And that's simply handy to have those methods sometimes.

Reviewed By: mdvacca

Differential Revision: D9982356

fbshipit-source-id: baa3bd24804d3708606ebd00b8795f2d5c9d4de9
2018-09-26 10:18:38 -07:00
Valentin Shergin b7584122a1 -[RCTSurfaceHostingView createSurfaceWithBridge:...] promoted to class method
Summary: We call this method in a constructor before the actual object is beeing constructed, so it's incorrect; it should be class method.

Reviewed By: mdvacca

Differential Revision: D9931315

fbshipit-source-id: 304ba8e2354f3f408cfa2bf1729266525a08f951
2018-09-26 10:18:38 -07:00
Valentin Shergin 24ffd8f6fb Fabric: Polishing RCTFabricSurface
Summary: All integration with Bridge was removed from RCTFabricSurface, now it's Surface's responsibility to start and stop JS app and register the ShadowTree in the Scheduler.

Reviewed By: mdvacca

Differential Revision: D9931317

fbshipit-source-id: 55a682f0afb1c542a904e1a8570029e4690967cc
2018-09-26 10:18:38 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Valentin Shergin 9042438975 Fabric: `bridge` prop was removed from RCTSurface interface
Summary:
@public
We are moving away from using `RCTBridge` instance in public APIs to enable us using more performance solutions in the future.
This change also fixes "SwipeBack issue" caused by RCTSurfaceHostingProxyRootView returning nil bridge.

Reviewed By: mdvacca

Differential Revision: D9094625

fbshipit-source-id: 6bde3c54773e75ca4c0b6fd908da9d7235b5c3be
2018-08-01 15:32:01 -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
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
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
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
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
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
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 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
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
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
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
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
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
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
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 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 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
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
Michael Schneider d021dd25da Fix typo in RCTSurfaceHostingView
Summary:
Fix typo in RCTSurfaceHostingView (minumumSize -> minimumSize)
Closes https://github.com/facebook/react-native/pull/17235

Differential Revision: D6585719

Pulled By: hramos

fbshipit-source-id: bfb18015f48bc8ab161945d09125c27d29738ede
2017-12-15 17:32:24 -08:00
Valentin Shergin 4d37cf0fbc RCTSurface: RCTSurfaceHostingView, interop layer beteween UIKit and RCTSurface
Summary: UIView subclass which providers interoperability between UIKit and Surface regarding layout and life-cycle.

Reviewed By: rsnara

Differential Revision: D6465922

fbshipit-source-id: 2a7cfb70119d460bc22968d1aa780833bf47d7f6
2017-12-04 13:48:27 -08:00
Valentin Shergin ba6075120a RCTSurface: Stopping the app on surface object deallocation
Reviewed By: rsnara

Differential Revision: D6431628

fbshipit-source-id: 2b3fd39d77a1108516f00727dd21f648c2bf41b1
2017-12-03 20:16:36 -08:00
Valentin Shergin 43b2509320 RCTSurface: activityIndicatorViewFactory was removed from RCTSurfaceView
Summary: Apparently we don't need this at this level. This will be implemented as part of RCTSufraceHostingView.

Reviewed By: rsnara

Differential Revision: D6367071

fbshipit-source-id: 71a2361b8a0c6594c63602165ce5e054de62630d
2017-12-03 20:16:36 -08:00
Valentin Shergin e9e0cd7ab8 RCTSurface: Couple helper functions for Stage
Summary: We need this trivial funcs to unify spinner appearance logic.

Reviewed By: rsnara

Differential Revision: D6367072

fbshipit-source-id: 70e288bc1fed5911828a5f6deaa829597bf8ebff
2017-12-03 20:16:35 -08:00
Valentin Shergin da17b237e1 RCTSurface: Use async dispatch to register root shadow view
Summary: We don't really need sync dispatch here. We only need sequential execution of our UIManager blocks.

Reviewed By: rsnara

Differential Revision: D6367069

fbshipit-source-id: cc675aafd6c762506048bcf65c24e54080b013a5
2017-12-03 20:16:35 -08:00
Valentin Shergin 081f7d14ad RCTSurface: Fixed problem in stage propagation
Summary: We previously incorrectly communicated to the delegate changed fragment instead of compound value.

Reviewed By: rsnara

Differential Revision: D6367070

fbshipit-source-id: 373a7c14a79a4727a7e8f61178dea3ca16ea1f40
2017-12-03 20:16:35 -08:00
Valentin Shergin 7df58e23a3 Introducing RCTSurface, new experimental thread-safe interop layer
Summary:
RCTSurface instance represents React Native-powered piece of a user interface
which can be a full-screen app, separate modal view controller,
or even small widget. It is called "Surface".

The RCTSurface instance is completely thread-safe by design;
it can be created on any thread, and any its method can be called from
any thread (if the opposite is not mentioned explicitly).
The primary goals of the RCTSurface are:
 - ability to measure and layout the surface in a thread-safe and synchronous manner;
 - ability to create a UIView instance on demand (later);
 - ability to communicate the current stage of the surface granularly.

Differential Revision: D6202576

fbshipit-source-id: 8e644c87fcaad2b6a9c9304b58384d7192747556
2017-11-07 16:16:56 -08:00