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

1794 Коммитов

Автор SHA1 Сообщение Дата
Valentin Shergin b30bf2f94e Fabric: Introducing `ContextContainer::update()`
Summary:
The new method allows updating a ContextContainer using another one.
We will need that in the coming diffs.

Changelog: [Internal] Introducing `ContextContainer::update`

Reviewed By: sammy-SC

Differential Revision: D17960238

fbshipit-source-id: 187dcecbeee8c3de082575e53d5430d91b5338c5
2019-10-24 17:45:39 -07:00
Joe Loser ba18ee9b87 Replace folly::make_unique with std::make_unique (#26730)
Summary:
There is a mixed usage of `folly::make_unique` and `std::make_unique`. Soon, `folly::make_unique` may be removed (see [this PR](https://github.com/facebook/folly/pull/1150)). Since `react-native` only supports C++14-compilers and later, switch to always using `std::make_unique`.

## Changelog

[Internal] [Removed] - Replace folly::make_unique with std::make_unique
Pull Request resolved: https://github.com/facebook/react-native/pull/26730

Test Plan:
Running the existing test suite. No change in behavior is expected.

Joshua Gross: buck install -r fb4a, make sure MP Home and forced teardown works okay on android

Reviewed By: shergin

Differential Revision: D18062400

Pulled By: JoshuaGross

fbshipit-source-id: 978ca794c7e972db872a8dcc57c31bdec7451481
2019-10-22 12:21:41 -07:00
Samuel Susla 7796b7e9af Avoid use of shared_from_this in StateTarget
Summary:
`StateTarget` no longer uses `shared_from_this`, this allows us to remove need for `enable_shared_from_this`

I decided to put `state->commit` call inside `ShadowTree.cpp` because I needed to have access to `shared_ptr` of shadow node from outside of the class itself.
`state->commit` was originally designed to be only called by `ShadowNode` but this does not seem to be the case anymore since it is called from `UIManager` as well.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D18032532

fbshipit-source-id: 75c874fd04f86adc07bfddbef3a0384e17c2067b
2019-10-21 17:18:36 -07:00
Ramanpreet Nara d8fda74c24 Move RCTImage NativeModules back to RCTImage
Summary:
In D16805827, I moved `RCTImageLoader`, `RCTImageStoreManager`, and `RCTImageEditingManager` to `CoreModules`. This was necessary to turn `RCTImageLoader` into a TurboModule. However, after D17671288 landed, it's no longer necessary to have OSS NativeModules in `CoreModules`. Therefore, I'm moving these NativeModules back to `RCTImage`.

Changelog: [iOS][Fixed] Move RCTImage NativeModules back to RCTImage

Reviewed By: shergin

Differential Revision: D17921612

fbshipit-source-id: 8ae36d2dc8deaf704313cbe2479bfa011ebcbfbc
2019-10-21 17:15:32 -07:00
Andres Suarez d8560a838b Tidy up license headers [3/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Differential Revision: D18033336

fbshipit-source-id: 0334bfa2d61314de6ee9e7302205c08574abc0d9
2019-10-21 10:43:00 -07:00
Valentin Shergin 50c59aa7f8 Fabric: Changing signature of ShadowNode::replaceChild to avoid shared_from_this()
Summary:
This change in the method signature allows removing usage of `shared_from_this()`.
After this change we will have only one usage of `shared_from_this()`.

Changelog: [Internal] Small Fabric-specific optimization.

Reviewed By: sammy-SC

Differential Revision: D17973956

fbshipit-source-id: 19818b0855565d872005062ba2992718ca89b372
2019-10-21 09:44:25 -07:00
Valentin Shergin 7186a65b13 Fabric: Changes in `BaseTextShadowNode` to remove usage of `shared_from_this()`
Summary:
This is another step on the journey of removing `enable_shared_from_this`.

It's unclear why we used that before but it's clear now that using shared_ptr here is not necessary because all computation around happens inside the single callstack, so by definition we don't have object life-time concerns here.

Changelog: [Internal] Small Fabric-specific optimization.

Reviewed By: sammy-SC

Differential Revision: D17973957

fbshipit-source-id: 09a65c78e22083ed21b041240307f4858379cc60
2019-10-21 09:44:25 -07:00
Valentin Shergin c5f704b8e3 Changing signature of `RootShadowNode::clone()` to remove a `shared_from_this()` call
Summary:
This is the first diff in the journey of removing `enable_shared_from_this` from `ShadowNode` class.

In general, using `enable_shared_from_this` is fine, it's a normal standard feature and there is nothing wrong with that... besides the fact that using this thing is usually an indication of overall poor design.
In Fabric, we don't really have a good reason for that, I think in all cases it can be avoided, so I think we should remove that.
Removing that is also code-size and perf win.

This particular diff changes the signature of `RootShadowNode::clone()` which allows removing the necessity  of usage `.shared_from_this()` from callsites.
The rest changes are purely cosmetical.

Changelog: [Internal] Small Fabric-specific optimization.

Reviewed By: sammy-SC

Differential Revision: D17973958

fbshipit-source-id: 5539ceff9d11b4281a6ebe8d80e90d6bd90e44d8
2019-10-21 09:44:25 -07:00
Samuel Susla 75b9f9d5dd Fabric: Add proper type to TargetState
Summary:
There isn't a need for using `std::shared_ptr<const void>` as the type is known.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D18032518

fbshipit-source-id: 7860f9be8ba1a05a725e8bf7260a496d51194f2f
2019-10-21 06:27:26 -07:00
Samuel Susla 7e49cf1930 Fabric: Remove redundant class forward declaration
Summary:
Remove redundant forward declaration and make default constructor explicit.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D18032511

fbshipit-source-id: 18d3f9c869a69949e6965cd7e32e0f284723f2e3
2019-10-21 06:24:18 -07:00
Valentin Shergin fd07fc9454 Fabric: Removing deprecated API from ComponentDescriptorRegistry
Summary:
We don't use it anymore.

Changelog: [Internal] Removing internal deprecated API (Fabric)

Reviewed By: mdvacca

Differential Revision: D18010490

fbshipit-source-id: c6da7fae071356e06bb0920f5a26d6c9b239c052
2019-10-20 20:53:21 -07:00
Valentin Shergin c8176881ce Fabric: Using ComponentDescriptorProviderRegistry in UITemplateProcessorTest
Summary:
ComponentDescriptorProviderRegistry is a new API for component registration.

Changelog: [Internal] Fabric-specific change in UIManager test.

Reviewed By: mdvacca

Differential Revision: D18010489

fbshipit-source-id: d615bfb5c9437da7358c0bd8465ab4b6525089e6
2019-10-20 20:53:20 -07:00
Valentin Shergin 8a8ff63b7d Fabric: Unification of constructor signature of ComponentDescriptors
Summary:
This is the first step to migrate the registration of Android-specific `ComponentDescriptors` to `ComponentDescriptorProviderRegistry`.
`ComponentDescriptorProviderRegistry` is a never API for component registration that supports reactive registration and simplified signatures for `registry` (`add`) method.

It's tedious to keep those signatures in sync with the base class (`ComponentDescriptor`), we have an idea how to make it better by using a single struct with all params but a migration to that will be a separate effort.

The changes are pure syntactical.

Changelog: [Internal] Internal changes in Fabric.

Reviewed By: mdvacca

Differential Revision: D18010488

fbshipit-source-id: 4cbfdbcae235b32a94b38df2095c956299764e59
2019-10-20 20:53:20 -07:00
Valentin Shergin dbc7e4e527 Fabric: More type asserts in ConcreteComponentDescriptor
Summary:
`ConcreteComponentDescriptor` is a major place where dynamic dispatch calls end up. We see some amount of crashes that can be caused by an invalid pointer to a ComponentDescriptor, those checks can help verify this theory. Anyway, it's a good practice to fail earlier.

Changelog: [Internal] - Stability improvements (Fabric)

Reviewed By: sammy-SC

Differential Revision: D17991515

fbshipit-source-id: 1cac372a12b49430a3d1db66c8fc673e6adc32e9
2019-10-18 09:27:48 -07:00
David Vacca 8425292eb4 Report Redbox error when a component is not implemented
Summary:
This diff ensures that a redbox is reported when a component is not registered in Fabric.

Changelog:
Ensure a redbox is reported when components are not registered in Fabric.

Reviewed By: shergin

Differential Revision: D17970793

fbshipit-source-id: 7afd7e6b0b9c0ff6d2bd475dbf6979d83fec093c
2019-10-18 09:09:30 -07:00
Valentin Shergin 05862faab4 Farbic: Making `ShadowNode::revision_` debug only
Summary:
We use this piece of data only for debug purposes, so there is no need to pay for that in prod.

Changelog: [Internal] - Small optimization in `ShadowNode` (Fabric)

Reviewed By: JoshuaGross

Differential Revision: D17961209

fbshipit-source-id: 2a0d609ac4d3c4815b26789551a4c51bcf91dea4
2019-10-16 17:53:15 -07:00
Andres Suarez aee88b6843 Tidy up license headers [3/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952693

fbshipit-source-id: 8fcb8e58a2e04e7a3169f4d525bffc00835768e6
2019-10-16 10:06:34 -07:00
Andres Suarez 3b31e69e28 Tidy up license headers [2/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952694

fbshipit-source-id: 17c87de7ebb271fa2ac8d00af72a4d1addef8bd0
2019-10-16 10:06:34 -07:00
Andres Suarez 722feeb02b Tidy up license headers [1/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952695

fbshipit-source-id: 81aa607612ba1357ef7814ef20371335151afe7e
2019-10-16 10:06:33 -07:00
Andres Suarez e1cfeaddd4 Move non-license comments out of license header
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: cpojer

Differential Revision: D17749100

fbshipit-source-id: edca9c73a065e9fc311109cd6efeb1f75451a55a
2019-10-15 20:12:12 -07:00
Joshua Gross 87b94e60a6 Explicitly associate State with its owning ShadowNode immediately upon ShadowNode creation
Summary:
See comments for additional commentary. On Android we pass State to all views upon creation; currently we do Preallocation of views, which means that Views are created on the mounting layer before they're technically committed. Previously we were only assocation State -> ShadowNode upon tree commit.

This meant that during Preallocation, State was accessible but the `updateState` mechanism did not work because that requires a pointer from the State back to its owning ShadowNode.

We explicitly make that connection now when creating the ShadowNode and State. This should fix or prevent many subtle bugs with State, on Android but potentially other platforms as well, since now we guarantee that State is always updateable.

Changelog:
[[Internal]]

Reviewed By: shergin, mdvacca

Differential Revision: D17937687

fbshipit-source-id: a0cfdddbf1d97f1a64624bca6aa9536620f21ad4
2019-10-15 19:35:55 -07:00
Janette Cheng 10cc834567 Use fbandroid_labels and fbobjc_labels in xplat targets
Summary:
`xplat` targets add different deps based on what platform the target is being built for.

for anything using `fb_xplat`, we can put all ios supermodules in `fbobjc_labels` and all android sms in `fbandroid_labels`

There's some weirdness with python targets like `thrift_gen` in  `/xplat/mobileconfig/tools/generator/gen-py/BUCK` that don't have platform-specific labels because the except_for list for `fbandroid` doesn't need the `fbsource//` prefix (see changes in `/ios/isolation/infra.mobileconfig.sm`)

Changelog: [Internal]

Reviewed By: shergin, joshleibsly

Differential Revision: D17884952

fbshipit-source-id: e245364cf515b75682990094d24f789d53b1f3f5
2019-10-15 19:32:27 -07:00
Peter Argany 474f12e6fc Fix NSDictionary crash in bridgeless RN
Summary: Changelog: [iOS] [Fixed] Fixed crash in TurboModules when bridge isn't set

Reviewed By: RSNara

Differential Revision: D17939896

fbshipit-source-id: 4c59de00da30fa8ceb32e590d65663ac37ff3ca2
2019-10-15 16:18:21 -07:00
Valentin Shergin 14df0b2a78 Fabric: Using `wrapManagedObject` in `RCTImageManager` instead of manual casting
Summary: Hiding casting madness and complexity behind a helper function to avoid bugs and improve maintainability.

Reviewed By: sammy-SC

Differential Revision: D17923549

fbshipit-source-id: 105891d85b0412fa4a17d7ae8a9e156fc1b151fb
2019-10-15 16:15:10 -07:00
Andres Suarez b7c14f29cf Tidy up license headers
Summary: Changelog: Tidy up license headers

Reviewed By: SidharthGuglani

Differential Revision: D17919414

fbshipit-source-id: 0501b495dc0a42256ca6ba3284a873da1ab175c0
2019-10-15 10:32:14 -07:00
Valentin Shergin 8bce9c59bb Fabric: Assert on destruction non-empty of ShadowTreeRegistry
Summary:
Destruction of Scheduler (and ShadowTreeRegistry as part of it) which has some running Surfaces is not a good thing and practically a bug on the application layer.
With this assert we throw early to flag the issue.

Changelog: [Internal] - Dev only assert indicating a broken invariant in ShadowTreeRegistry

Reviewed By: sammy-SC

Differential Revision: D17924491

fbshipit-source-id: 6b7433fe47630e993e7d5b969f3113f96124b6c9
2019-10-15 07:55:00 -07:00
zhongwuzw 4203d24b83 Fixes Fabric related podspec (#26805)
Summary:
1. Add missing podspec like `safeareaview` and `legacyviewmanagerinterop`.
2. Expose `YGNode,YGStyle.h` to public, fabric uses it, ex. `YogaStylableProps.h`.
3. Make `React-Core`'s Cxx header public, because `RCTLegacyViewManagerInteropCoordinator.m` uses it.

## Changelog

[iOS] [Fixed] - Fixes Fabric related podspec
Pull Request resolved: https://github.com/facebook/react-native/pull/26805

Test Plan: Fabric RNTester can run.

Reviewed By: shergin

Differential Revision: D17872379

Pulled By: mdvacca

fbshipit-source-id: 4b18a931a2e403237a96d5cc3505b99c7253c710
2019-10-14 22:34:40 -07:00
James Ide df653a9dc2 More robust hermes-engine lookup logic in makefiles (#26820)
Summary:
The Android makefiles had hard-coded paths to hermes-engine, sometimes looking in `node_modules` and other times looking in `..`. This commit implements the Node module resolution algorithm (see common.mk), which handles both of these cases and also looks further up the root if necessary, handling the case when the `hermes-engine` npm package is hoisted.

This commit does three things:

- Defines `find-node-module` and uses it in the makefiles to find `hermes-engine`
- Removes the unused `/path/to/hermes-engine/include` paths since this directory does not exist and should be `/path/to/hermes-engine/android/include` (`android`)
- Moves the definition of `REACT_NATIVE` in the makefiles to the top. It was defined after every `$(CLEAR_VARS)` invocation but was not actually cleared anyway. `$(CLEAR_VARS)` resets only `LOCAL_*` variables in this list: https://android.googlesource.com/platform/build/+/7dc45a8/core/clear_vars.mk

## Changelog

[Internal] [Changed] - Android Makefiles look for hermes-engine using Node's module resolution algorithm
Pull Request resolved: https://github.com/facebook/react-native/pull/26820

Test Plan: Run `./gradlew :ReactAndroid:installArchives`, which requires the hermes-engine paths to be correct in order to find the headers.

Differential Revision: D17923671

Pulled By: cpojer

fbshipit-source-id: 9238b8718a94080db1abbba6375a6a1d484c871d
2019-10-14 19:21:43 -07:00
Ramanpreet Nara 63e58a375e Improve method argument RCTConvert logic
Summary:
**Context**
For method calls from JS to Objective C, we have to convert JS values to ObjC objects/primitives. Before we can call our ObjC methods, we need to run both the ObjC primitives and objects through `RCTConvert`. This is necessary, because we sometimes convert `NSDictionary`s to special Objective C objects. Apparently, in `RCTTiming`, we also do the same with `double` (i.e: we convert a `double` arg to another `double` type with different meaning).

**Problem**
`RCTTiming` used `RCTConvert` to convert `double`s into `NSTimeInterval` (also a double). The conversion is defined like this:

```
// i.e: division by 1000
RCT_CUSTOM_CONVERTER(NSTimeInterval, NSTimeInterval, [self double:json] / 1000.0)
```

This diff implements the support necessary to make this work. For completeness, I also implemented the same functionality for `BOOL`s.

Changelog: [iOS][Fixed] Improve method argument RCTConvert logic

Reviewed By: mdvacca

Differential Revision: D17887915

fbshipit-source-id: 3246fdbf4db7e96911f16460d92448b1f1e99444
2019-10-14 15:39:34 -07:00
Ramanpreet Nara bec5b8711f Improve TM main queue initialization
Summary:
In the legacy system, when NativeModules are supposed to be initialized on the main queue, we do the following synchronously on the main thread:
1. Done: Attach bridge on main queue
2. Register the NativeModule for frame updates on main queue
3. Post Notification that NativeModule was created on main queue
4. Attach methodQueue on main queue
5. Call new on main queue

`[RCTModuleData instance]` is the entrypoint for all of this logic.

We probably shouldn't synchronously execute all this initialization on the main queue, because it can lead to deadlocks down the road. Therefore, this diff makes it so that we still call `new` on the same thread. However, we do all other initialization in the main thread, if that's required.

Changelog: [iOS][Fixed] TurboModule initialization on the main queue

Reviewed By: PeteTheHeat

Differential Revision: D17867583

fbshipit-source-id: a88412ee1e3d93a4f9b5ab0b4dd8fc5213fa91f8
2019-10-14 14:19:23 -07:00
empyrical 80857f295c JSBigString: Fix building on Windows (#26826)
Summary:
This pull request replaces the last remaining Unix headers in `JSBigString` with their equivalent Folly Portability headers, and replaces the calls to `getpagesize()` with `sysconf(_SC_PAGESIZE)` since Folly Portability is missing that function.

The work to get this building on windows was mostly done by acoates-ms, this pull request just adds the finishing touches.

## Changelog:

[General] [Fixed] - Fixed `JSBigString` not compiling on Windows due to Unix-specific headers
Pull Request resolved: https://github.com/facebook/react-native/pull/26826

Test Plan: Compiled with Clang and with MSVC (2017)

Differential Revision: D17903214

Pulled By: cpojer

fbshipit-source-id: 230f8fb410fa81d8f13d8b6ccf1147cfc70358bf
2019-10-14 00:22:22 -07:00
Joshua Gross 26cf89f3f4 Usage of a C++ raw pointer necessitates 30 lines of comments
Summary:
In a previous diff I converted this line from a shared_ptr to a raw pointer. I'm documenting the reason why in code here to proactively document assumptions.

Changelog:
[[Internal]]

Reviewed By: shergin

Differential Revision: D17884942

fbshipit-source-id: 25e29a5e3ff0695d081c8d46c1ceaa6458248e26
2019-10-11 14:19:14 -07:00
Joshua Gross 0a6f4dd8aa UIManagerBinding JSI function lambdas should not retain UIManager
Summary:
Ensure that on Android, only Scheduler and UIManagerBinder directly retain UIManager. These existing JSI function-retained lambdas will not have owning share_ptr refs to UIManager, just raw pointers.

By the time the VM deallocates all JSI objects and UIManagerBinding goes away, it should be able to deallocate UIManager synchronously when UIManagerBinding is deallocated. The VM should not be executing any of these JSI functions at that time, so this should ensure that the raw pointer access is safe.

This should also provide some extremely small perf wins, and make our memory model easier to reason about, since we're using shared_ptr less often and now `UIManager` is only owned in two places: Scheduler and UIManagerBinding.

So, there are now only two places where UIManager can be deallocated:
1) Hermes is deallocated first, and UIManagerBinding is deallocated before Scheduler. Scheduler holds onto UIManager. Scheduler later is deallocated and frees UIManager; this would cause a crash if it's not completed before Hermes is torn down, but we currently ensure that Scheduler is torn down before Hermes. This is fine but we should document this contract, or make Scheduler not own UIManager.
2) Scheduler is deallocated first, decrementing the shared_ptr to UIManager. Later Hermes is torn down, which deallocates UIManagerBinding via the JSI pointer table, which synchronously deallocates UIManager before Hermes has shut down. This is the desired outcome.

Changelog:
[[Internal]]

Reviewed By: shergin

Differential Revision: D17872586

fbshipit-source-id: cbb25b5cd025f5f8597dc7a66073fe64edc57aa8
2019-10-11 07:15:24 -07:00
Ashok Menon df96de78bb Back out D17720575 -- D17724498
Summary: This stack caused FB4A builds to start failing, complaining about `RCTImageApple`.

Reviewed By: RSNara

Differential Revision: D17855088

fbshipit-source-id: 21ecedc3725dde65fab20f414d07b32c3548447c
2019-10-10 09:41:33 -07:00
zhongwuzw a5ad0bf124 Change Fabric podspec dependency yoga to Yoga (#26800)
Summary:
We change yoga pod name to Yoga in 82a8080f07, so let's change it in Fabric pod.

## Changelog

[iOS] [Fixed] - Change Fabric podspec dependency yoga to Yoga
Pull Request resolved: https://github.com/facebook/react-native/pull/26800

Test Plan: Null.

Reviewed By: sammy-SC

Differential Revision: D17853707

Pulled By: mdvacca

fbshipit-source-id: 84a537f3ede7f2a86a08d532ffbbe4bf23cbf846
2019-10-10 07:34:38 -07:00
Valentin Shergin 38e36b7049 Storing RCTBridge weakly inside ContextContainer
Summary: Storing a Bridge introducing an retain cycle, so we need to store that weakly.

Reviewed By: sammy-SC

Differential Revision: D17773698

fbshipit-source-id: 824a83a6086f9ae6efb7c458d833931954c55643
2019-10-09 13:17:42 -07:00
Valentin Shergin 18ec9328b4 Fabric: Weak semantic to ManagedObjectWrapper
Summary: We need to have a weak semantic for the ManagedObjectWrapper, this diff implements that.

Reviewed By: sammy-SC

Differential Revision: D17773699

fbshipit-source-id: 978fa62191361c3b2c0e46c423240831ed1dd233
2019-10-09 13:17:42 -07:00
Ramanpreet Nara 3aa8a40659 Move RCTImage NativeModules back to RCTImage
Summary: In D16805827, I moved `RCTImageLoader`, `RCTImageStoreManager`, and `RCTImageEditingManager` to `CoreModules`. This was necessary to turn `RCTImageLoader` into a TurboModule. However, after D17671288 landed, it's no longer necessary to have OSS NativeModules in `CoreModules`. Therefore, I'm moving these NativeModules back to `RCTImage`.

Reviewed By: PeteTheHeat

Differential Revision: D17720575

fbshipit-source-id: 44b07cfa07cbb2b87254132810f86974edc7edab
2019-10-09 12:33:59 -07:00
Valentin Shergin 8cf9505bd2 Fabric: MountingCoordinator::waitForTransaction(...)
Summary:
`MountingCoordinator::waitForTransaction()` allows waiting for a new coming transaction synchronously, as efficient as waiting for a mutex.
This feature can be used to implement more high-level synchronous rendering APIs.

Reviewed By: mdvacca

Differential Revision: D17629425

fbshipit-source-id: acd91b941e4d6d43bc4518f332a1604e14506be9
2019-10-08 21:49:55 -07:00
Samuel Susla 1bf2f72abe Add support for commands
Summary: We need commands to work with `LegacyViewManagerInterop`. We will need to rethink this once Fabric has command-execution pipeline in place.

Reviewed By: shergin

Differential Revision: D17787294

fbshipit-source-id: a6b3dbfae41f04e7e7f5bafb1f7b4ad0de0eedc3
2019-10-08 09:05:16 -07:00
Samuel Susla 5dbd62c7ff Add support for events
Summary:
LegacyViewManagerInterop layer can now handle events as well.

We expose `eventInterceptor` from `NSComponentData`, that way we can hook into event dispatching that happens within `NSComponentData`.

Coordinator has a map of `UIView -> reactTag` which it uses to figure out to which component view to forward the event.

New `LegacyViewManagerInteropViewEventEmitter` exposes APIs to send `folly::dynamic` to javascript.

Reviewed By: shergin

Differential Revision: D17765834

fbshipit-source-id: 25e75e445b32c69ec9ab0189c4ab7fba5f8c7b5d
2019-10-08 09:05:15 -07:00
Samuel Susla 07fd3125c8 Migrate MVP SafeAreaView to Fabric
Reviewed By: shergin

Differential Revision: D17736209

fbshipit-source-id: e70c309f2599cdcb8f234d96915546032b71d223
2019-10-04 07:07:36 -07:00
masaaki1915 ae3f7a7616 fix typo in code (#26655)
Summary:
This PR only fixes a typo in `ShadowNode.cpp`

## Changelog

[Internal] [Fixed] - Fix typo in `ShadowNode.cpp`
Pull Request resolved: https://github.com/facebook/react-native/pull/26655

Differential Revision: D17743059

Pulled By: TheSavior

fbshipit-source-id: 6bbaf54b712c0a80da8dfafea2634309279a8f21
2019-10-03 23:12:37 -07:00
Adam Ernst a45e6a8b5f React Native supermodule
Summary: #nocancel

Reviewed By: fkgozali

Differential Revision: D17747685

fbshipit-source-id: 9bad072d3549959528612c2f0329799853d4b675
2019-10-03 15:43:38 -07:00
Samuel Susla e62a4c7988 Apply props to Paper component
Reviewed By: shergin

Differential Revision: D17710855

fbshipit-source-id: ab6864a22fd8df019b2619c2976876e176e07689
2019-10-03 08:37:29 -07:00
Samuel Susla 3f8221ddd9 Add coordinator class
Summary:
ComponentDescriptor owns a coordinator which is initialised with ViewManager that it represents.

Coordinator is passed to ComponentView through state and ComponentView asks the coordinator for view.

Later, ComponentView will ask coordinator to configure view with specified props.

Reviewed By: shergin

Differential Revision: D17670444

fbshipit-source-id: e920c5c4f033884c4b539ce711286f71c887d896
2019-10-03 08:37:29 -07:00
Samuel Susla 74608ee4ab Stage 1: printing props to screen
Summary:
# LegacyViewManagerInterop is born

LegacyViewManagerInterop is a component that should make it possible for legacy components to work in Fabric, new renderer.
This is just a first stage that prints keys of props to screen together with component name.

Reviewed By: shergin

Differential Revision: D17552827

fbshipit-source-id: c3e062f413727729e6a9b683c60f59f0292cc63b
2019-10-03 08:37:28 -07:00
Oleksandr Melnykov 299c984964 Pass surface ID to measure function in Java to retrieve themed Context
Summary:
We use `ViewManager.onMeasure` to perform measurements of Android views and pass the measured size back to Yoga. For Android in order to the report correct dimensions of a View, this View must be created using a Context that has a theme associated with it. Before, `onMeasure` only had ReactApplicationContext passed as the first parameter and ReactSwitch, for example, could not be measured correctly (because it uses the size of the thumb drawable, which is extracted from the current theme). This diff adds surfaceId as the first parameter of `FabricUIManager.measure`, so that we can retrieve ThemedReactContext and pass it to `ViewManager.onMeasure`.

The size of the Switch component is still incorrect, but at least the size reported back to Yoga is the same as in Paper. So there is more investigation necessary why this happens in Fabric. I will investigate and publish another diff with the fix.

Reviewed By: JoshuaGross, shergin

Differential Revision: D17625959

fbshipit-source-id: 48197a61240fb13042bef3e9f5d681acacc702fb
2019-10-03 03:15:20 -07:00
Oleksandr Melnykov d0dd1aed29 Integrate AndroidSwitch into Fabric on Android
Summary:
In this diff we integrate the Switch component on Android in Fabric. Since the component has a custom measure function, we need to write some C++ to call the measure method in Java.

The component isn't fully functional yet (setNativeProps isn't supported in Fabric) and has some problems with measuring itself. I will fix the component in the next diffs in this stack.

Reviewed By: JoshuaGross

Differential Revision: D17571258

fbshipit-source-id: be4e201495b9b197ddec44ee3484357bfb6225a8
2019-10-03 03:15:20 -07:00
Emily Janzer 7a6478465d Throw pending JNI errors after Java method discovery in TM
Summary: I was trying to debug an issue with a method signature mismatch last week, but was having trouble figuring out the problem because the error I was getting was unrelated - apparently JNI will sometimes swallow the error and just fail mysteriously later on. Ramanpreet showed me this macro that will throw any pending exceptions, so let's do that after we try to lookup the Java method in case it fails.

Reviewed By: RSNara

Differential Revision: D17680121

fbshipit-source-id: 1f23e49014f7cc1616e111386d440637e6a74677
2019-10-02 12:03:13 -07:00