Commit Graph
1948 Commits
Author SHA1 Message Date
Samuel SuslaandFacebook Github Bot 0c64733c6b Fabric: migrate Slider from LocalData to State
Summary:
Changelog: [Internal]
We are moving away from LocalData in favour of State.

Reviewed By: shergin

Differential Revision: D19250592

fbshipit-source-id: 6d2eef9a0c0e53e0146da609ba0c24fa09766433
2020-01-06 05:25:23 -08:00
Samuel SuslaandFacebook Github Bot 3d6f5f50a7 Fabric: Migrate Image to State from LocalData
Summary:
Changelog: [Internal]

We are moving away from LocalData in favour of State.

Reviewed By: shergin

Differential Revision: D19247031

fbshipit-source-id: 8884133b13dd111e8d9e2cd4936bf90bfc5b4932
2020-01-06 05:25:23 -08:00
Kevin GozaliandFacebook Github Bot 674b591809 iOS: Deprecate iOS 9 / tvOS 9 SDK support
Summary:
It is time to target SDK version 10.0+.

Changelog: [iOS] [Deprecated] - Deprecating support for iOS/tvOS SDK 9.x, 10.0+ is now required

Reviewed By: mdvacca

Differential Revision: D19265731

fbshipit-source-id: 93b6f9e8f61c5b36ff69e80d3f18256aa96cc2c0
2020-01-02 12:52:12 -08:00
Valentin SherginandFacebook Github Bot 26650c766d Fabric: Disabling RN_SHADOW_TREE_INTROSPECTION
Summary:
We see some asserts firing inside the Shadow Tree introspection.
While we are investigating what exactly went wrong it's better to disable that to stop bleading.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D19256449

fbshipit-source-id: 9920392996a00879043d9516e5bc189a1c806ead
2019-12-31 08:47:59 -08:00
David VaccaandFacebook Github Bot cf10cf56ea Remove method findShadowNodeByTag_DEPRECATED from UIManagerBinding class
Summary:
This diff removes the findShadowNodeByTag_DEPRECATED method from class UIManagerBinding. This method was created on D17175953 to implement findNodeHandle in Fabric. Recently we decided that we don't need to expose findNodeHandle anymore. This diff cleans up thi code.

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19216996

fbshipit-source-id: 07c16aeed28851afc09b0f5d6be338bb4440f813
2019-12-23 17:09:44 -08:00
David VaccaandFacebook Github Bot 878f4211c1 Expose findNodeAtPoint API to JS
Summary:
This diff implements the findNodeAtPoint API into UIManagerBinding to allow JS to call this method

changeLog: [Internal]

Reviewed By: shergin

Differential Revision: D19190284

fbshipit-source-id: 3a65a2238f964ce031b12c8cf264cdacb6cc8f2e
2019-12-23 17:09:44 -08:00
David VaccaandFacebook Github Bot 5e7a03f7b6 Implement findNodeAtPoint method
Summary:
This diff implements the findNodeAtPoint method to return the ShadowNode that is positioned into a Point of the screen.

What's not supported:
- Scroll position
- Transform
- return layoutable nodes that are contained inside a non-layoutable node

Changelog: [internal]

Reviewed By: shergin

Differential Revision: D19190285

fbshipit-source-id: fdc0358dc21312e9950a4eb16c36020e9e43e33f
2019-12-23 17:09:44 -08:00
David VaccaandFacebook Github Bot ac83f75b8c Extend Geometry class
Summary:
This diff extends Geometry class with methods to substract points and to determine if a Rect contains a Point or not

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D19190283

fbshipit-source-id: 7c7dd73be2cd644081ed9af8eeef7e137c618ae4
2019-12-23 17:09:43 -08:00
David VaccaandFacebook Github Bot 7932e1a658 Expose eventTarget as part of EventEmitter API
Summary:
This diff exposes eventTarget on the EventEmitter API

Changelog: [internal]

Reviewed By: shergin

Differential Revision: D19190281

fbshipit-source-id: 00dc8cf64f42b1fe176ecb7beefad59e61bd53ca
2019-12-23 17:09:43 -08:00
Valentin SherginandFacebook Github Bot a09ab53692 Fabric: Use ComponentDescriptorParameters as an actual parameter of ComponentDescriptor constructor
Summary:
This diff changes the signature of ComponentDescriptor constructor to make it simpler and easier to support: now all arguments are passed via struct that contains all these arguments as fields.

Now the ComponentDescriptor constructor accepts three arguments one of which is optional. This causes some confusion and the possibility of bugs in all subclasses that needs to implement a custom constructor. Mostly because in every case we need to ensure that the constructor:
 * Accepts and pass down all parameters/arguments;
 * Accepts the right types of those parameters (shared vs weak pointers, references vs values).
 * Accepts all thee arguments and pass them (including flavor!). We failed this point several times.

Overal that makes the code simpler and allows changing the set of parameters relatively easy. (There is no plan for it!)
Look at the LOC balance: less code!

Changelog: [INTERNAL]

Reviewed By: sammy-SC

Differential Revision: D18548173

fbshipit-source-id: 5d038b135e004f6c054026b3235ed57db99c086d
2019-12-22 22:22:00 -08:00
Will HolenandFacebook Github Bot 58f3673099 yarn upgrade msggen
Summary:
This upgrades the yarn.lock for msggen

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D19199162

fbshipit-source-id: 8064a14032948fa81e3c7e637cfca1e02f5bfcd6
2019-12-20 11:40:40 -08:00
Samuel SuslaandFacebook Github Bot f871bbada2 Cosmetic adjustments to ShadowNode::getAncestors
Summary:
Changelog: [internal]

Just cosmetic changes to code, shouldn't affect behaviour at all.

Reviewed By: shergin

Differential Revision: D19177494

fbshipit-source-id: b2e4d3d2cf0d30f40f2e2d950dd7a10dc7a5b5ea
2019-12-20 01:01:55 -08:00
Marc HorowitzandFacebook Github Bot a195447539 Handle errors building JSErrors better
Summary:
If building a JSError causes a JSError, this would lead to infinite recursion.  This changes the error handling path so the problem is visible to JS.  There's also a few related cleanups included, and a new test case.

Changelog: [General] [Fixed] - If Error global is not callable when building an error, jsi will throw a JS exception back to JS code. #158

Reviewed By: tmikov, dulinriley

Differential Revision: D18796269

fbshipit-source-id: 57a45d144fa2ea5e78d18c27d3130611737dda96
2019-12-19 21:33:18 -08:00
Will HolenandFacebook Github Bot 35dd2e0c37 Upgrade more msggen dependencies
Summary:
GitHub still marks some dependencies as vulnerable. Updating them.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D19183702

fbshipit-source-id: 9c9c815816c4fc591c77d811058234a63aeda727
2019-12-19 14:02:57 -08:00
Samuel SuslaandFacebook Github Bot 61f7639d38 Fabric: Remove eventEmitter from ShadowNodeFragment
Summary:
As part of the plan is splitting ShadowNodeFragment into two parts. ShadowNodeFamilyFragment is already in place. This diff removes use of `ShadowNodeFragment::eventEmitter` and goes over all call sites to change it to `ShadowNodeFamilyFragment::surfaceId`.
Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19146697

fbshipit-source-id: 22cae5404b0f3098feb86c0437a4aa256d5b773e
2019-12-19 13:48:22 -08:00
Samuel SuslaandFacebook Github Bot 97f1c053b3 Fabric: Remove surfaceId from ShadowNodeFragment
Summary:
As part of the plan is splitting `ShadowNodeFragment` into two parts. `ShadowNodeFamilyFragment` is already in place. This diff removes use of `ShadowNodeFragment::surfaceId` and goes over all call sites to change it to `ShadowNodeFamilyFragment::surfaceId`.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19115785

fbshipit-source-id: 5972332c3360b88ca935581ed36070f26e678b22
2019-12-19 13:48:22 -08:00
Samuel SuslaandFacebook Github Bot f9c5bf8bee Fabric: Remove tag from ShadowNodeFragment
Summary:
As part of the plan is splitting `ShadowNodeFragment` into two parts. `ShadowNodeFamilyFragment` is already in place. This diff removes use of `ShadowNodeFragment::tag` and goes over all call sites to change it to `ShadowNodeFamilyFragment::tag`.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19115781

fbshipit-source-id: 6ab3464a063c220d0924bf5a69b75449ca178650
2019-12-19 13:48:22 -08:00
Samuel SuslaandFacebook Github Bot 90874d974f Fabric: ShadowNode now takes family as its constructor parameter
Summary: Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19115780

fbshipit-source-id: 7a693b5eea7599dca3e4b737126fcbb26078894d
2019-12-19 13:48:21 -08:00
Samuel SuslaandFacebook Github Bot bc9d50991a ShadowNodeFamily now accepts fragment in constructor
Summary:
`ShadowNodeFamily` now accepts ShadowNodeFamilyfragment as its constructor parameter.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19115794

fbshipit-source-id: 95605398a8f6b54b5c6f196a22b8b6cadb18baad
2019-12-19 13:48:21 -08:00
Samuel SuslaandFacebook Github Bot bd359ce257 Introduce new class ShadowNodeFamilyFragment
Summary: Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19115782

fbshipit-source-id: 9c3b069dbbf2c3d7321dfc9fbd0e54ae4e485a32
2019-12-19 13:48:21 -08:00
Will HolenandFacebook Github Bot 389a91c9d9 Update msggen dependencies
Summary:
`msggen` has dependencies on some npm packages with vulnerabilities.
This diff updates the dependency list.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D19107926

fbshipit-source-id: 0526f6fe430c162322ec9ecb84f3d78604cd76bc
2019-12-18 15:06:53 -08:00
Joshua GrossandFacebook Github Bot bb5622dd89 Prop parsing: always require explicit default argument to convertRawProp
Summary:
Having automatic defaults/an optional arg for `convertRawProp` has caused way more problems than it is worth. Remove the default argument.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19151594

fbshipit-source-id: 839ec8d138b2c3c083f221a2871582454004648c
2019-12-18 15:02:09 -08:00
Valentin SherginandFacebook Github Bot b2f267ac3b Fabric: Propagation of ScrollView's contentOffset value down to ShadowNode layer on Android
Summary:
This implements propagation of ScrollView's contentOffset value on Android. That allows `LayoutableShadowNode::getRelativeLayoutMetrics` (and some measure functions) return values that take that info into  account.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D19027433

fbshipit-source-id: 023ff9642d023971b3d24d5cc5f7c2f4b443031e
2019-12-18 10:48:41 -08:00
Valentin SherginandFacebook Github Bot c89ead313c Fabric: Proper implementation of ScrollView::contentOffset-aware measure functions (iOS only for now)
Summary:
This diff re-enables propagation of ScrollView's content-offset value down to the ShadowTree layer and enables measure fucntions opt-in incorporating this info to result.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: zackargyle

Differential Revision: D18981891

fbshipit-source-id: a6c0f4e690703b0ee07d45efab161750cfcc4b60
2019-12-18 10:48:40 -08:00
Samuel SuslaandFacebook Github Bot 38af48d5fd Fix argument passed to method in TemplateViewComponentDescriptor
Summary:
Incorrect argument was being passed to `createShadowTreeFromTemplateProps`

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19114167

fbshipit-source-id: c0d7d96e5cbf43cbdcf653ff19b4565fd44e9994
2019-12-18 07:49:20 -08:00
Valentin SherginandFacebook Github Bot 2c30b5dde9 Fabic: Fixed typo in LegacyViewManagerInterop
Summary:
Just typo.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D19137124

fbshipit-source-id: f1d751a4ddf785453575a9beeb7e0152d33f9071
2019-12-17 18:26:49 -08:00
Valentin SherginandFacebook Github Bot 44ff3f46a5 Fabric: Re-enabling RN_SHADOW_TREE_INTROSPECTION in DEBUG mode
Summary:
This diff reverts D15908765 where we disabled the introspection feature because we were afraid that it leaks into prod because of some sort of misconfiguration. Seems that wasn't the case.
We need to re-enable this to get some signals if it's broken.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D19104526

fbshipit-source-id: 696c0e68bb858da270dbbb5da11032e664d75659
2019-12-17 18:26:49 -08:00
Valentin SherginandFacebook Github Bot 9e2e754555 Fabric: Removing a workaround from ComponentDescriptorRegistry
Summary:
We used that on iOS only before we had `ComponentDescriptorProviderRequest`. Now iOS does not use `_fallbackComponentDescriptor`.
On Android we still use `_fallbackComponentDescriptor` but set that explicitly via `ComponentDescriptorRegistry::setFallbackComponentDescriptor`.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D19103296

fbshipit-source-id: fb2a2142afb183145fd3c8e48f620cb3f316c0bb
2019-12-17 18:26:49 -08:00
Samuel SuslaandFacebook Github Bot b02d516d7c Fabric: fix order of arguments for ShadowNodeFragment
Summary: Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19109689

fbshipit-source-id: 6c7b477324376e95dac1c381e339a23f261a0d60
2019-12-17 03:43:35 -08:00
Kevin GozaliandFacebook Github Bot eb95b2f855 iOS Fabric: added support for image instrumentation [2]
Summary:
Passing thru image instrumentation activities to the image loader class, which now supports Fabric instrumentation.

Changelog: [Internal]

Reviewed By: mdvacca, voznesenskym

Differential Revision: D19047898

fbshipit-source-id: d12cb5a06a83e85347629a25e593d30cb9020fe6
2019-12-16 22:50:45 -08:00
Kevin GozaliandFacebook Github Bot 55142efd3a iOS Fabric: added support for image instrumentation [1]
Summary:
Added basic hook to enable image instrumentation. The hook passes information to the existing image loader, where instrumentation is done, specific for each app, if any.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19047899

fbshipit-source-id: 6c013806cce98bcf1ea240d696a7ede9697e5cd9
2019-12-16 22:50:44 -08:00
Kevin GozaliandFacebook Github Bot 743074d09c iOS image: introduced RCTImageURLLoaderRequest for instrumentation/tracking purpose
Summary:
The `RCTImageURLLoaderWithAttribution` protocol historically only returns a cancellation block to cancel the url request. But for more complex instrumentation, we may need to associate a requestId for the specific URL request. To do this, the protocol now returns an object that has both the unique ID and the cancellation block, so that instrumentation logic can refer to the ID in the future.

Note that the `RCTImageURLLoader` protocol is unchanged, because the request ID is only relevant for instrumentation purpose.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19047900

fbshipit-source-id: cd029f2470c32fc7bffd674b09a5353fe1dbc80b
2019-12-16 22:50:44 -08:00
Joshua GrossandFacebook Github Bot 5bc7f0441d Ensure that TextAttribute prop parsing in BaseTextProps uses proper defaults
Summary:
Motivation: in Marketplace, there's a TextInput in JS that sends { lineHeight: null } to C++. In Paper this was correctly handled as a default value, which just causes that property to not be set. In C++ in Fabric, it was being parsed incorrectly as 0 (because of incorrect defaults being passed into `convertRawProp`), causing the text to not be visible at all. The solution is to make sure that its default value is NaN, which is handled correctly, and causes the Text to render again.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19128049

fbshipit-source-id: fe985428f3ed8b90d56cfa387fbc2d1476d19d36
2019-12-16 18:14:14 -08:00
Valentin SherginandFacebook Github Bot 5e50d3141d Fabric: Fixed View::transform::scaleX/Y/Z property
Summary:
The coefficients in the code were incorrect: the default value of the scale should be 1, not 0.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sahrens

Differential Revision: D19101221

fbshipit-source-id: 3b4c3afc692ddb6bf32bf2344a77ec5ca34a06e4
2019-12-16 14:35:24 -08:00
Valentin SherginandFacebook Github Bot ebdce9b3b0 Fabric: SafeAreaView does always not dirty Yoga node during cloning anymore
Summary:
Setting `padding` for Yoga node dirties it.
In the previous implementation, we did it for all newly cloned nodes. Now we do it only if State actually changes.

This is important because usually, SafeAreaView is a container node; that means that if some descendant of SafeAreaView changes its state,  the recloning of all nodes down to root node will cause dirtying  SafeAreaView and cause relayout if the whole subtree.

E.g., if we put ScrollView inside SafeAreaView without the fix, onScroll events will cause Yoga relayout (because ScrollView updates own state on debounced onScroll event).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D18987158

fbshipit-source-id: a3130c607c37e54ce813113222cd4a3872c58b6a
2019-12-15 18:51:22 -08:00
Igor SugakandFacebook Github Bot 399cabd1bb move chrome-devtools-protocol from xplat/third-party to third-party
Reviewed By: pixelb

Differential Revision: D16871230

fbshipit-source-id: e97710cf33a4ecee045595f1eb70021f275339e1
2019-12-13 17:30:18 -08:00
Valentin SherginandFacebook Github Bot 294cf84469 Fabric: Debouncing insets value in SafeAreaView
Summary:
iOS/UIKit prop `safeAreaInsets` sometimes produces values (and calls `safeAreaInsetsDidChange`) that practically the same but differ just enough to make operator `==` return `false`. That causes an indefinite state update loop and dizzying of the interface.

We do the same in Paper component as well.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D18964089

fbshipit-source-id: 4c714d2554fdee0f6e999921f69b95676080b8fa
2019-12-12 12:53:13 -08:00
Valentin SherginandFacebook Github Bot 5755129c19 Fabric: Conversion function between NSAttributedString and AttributedStringBox
Summary:
It's nice to have those conversions between NSAttributedString and AttributedTextBox in some utils module because:
An empty string must be stored as an empty C++ string, not like an empty NSAttributedString. That allows deferring this property from the object without accessing Objective-C runtime;
It's nice to hide some tedious Objective-C object wrapping/unwrapping boilerplate.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18950430

fbshipit-source-id: 842c202f243da17c47bc5cca9df6722cdcec07c5
2019-12-12 12:53:12 -08:00
Valentin SherginandFacebook Github Bot 909b0fe0e7 Fabric: operator== and std::hash for AttributedStringBox
Summary:
That will allow building a custom caching table for boxed stings to cache text measurements for them in TextLayoutManager.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18950428

fbshipit-source-id: 8ceef29543dc6ed540043e32d65f3295030ae90f
2019-12-12 12:53:12 -08:00
Valentin SherginandFacebook Github Bot 3b92d3187c Fabric: Exposing RCTNSTextAttributesFromTextAttributes as public function
Summary:
We need to use that outside of this file, in Fabric's TextInputComponentView to build `defaultTextAttributes` from C++ text attributes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18950433

fbshipit-source-id: c48155f4340b7e9780c35f86ba5155e54f160be1
2019-12-12 12:53:12 -08:00
Valentin SherginandFacebook Github Bot eb10d3e1d6 Fabric: Removing REACT_FABRIC_SYNC_EVENT_DISPATCHING_DISABLED macro
Summary:
When we designed the Fabric's event priorities we followed the model "let's assign all priorities to all events as they should theoretically be and create a flag that disables sync execution (because we were unsure that it's stable enough". After some experiments, it's clear that this model is not feasible. We realized that we were often not sure about the exact event priority that should be assigned to a particular event. We also realized that the priorities in web work differently compare to RN. And we are not sure how we should ensure ordering among events in different queues with different priorities.

At the same time, we want to use (or experiment with) sync events for in some cases when we sure about desired behavior and/or where async events make no sense.

This diff deletes the macro that disables sync priorities and explicitly assigns async priorities to events that previously had sync ones.

The actual behavior should not change.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18950431

fbshipit-source-id: 4033ef63d4e736075b525a693cd514d7b92d5bb0
2019-12-12 12:53:11 -08:00
Valentin SherginandFacebook Github Bot 7cf43afa8d Fabric: Fixing an incorrect empty image placeholder for NSAttributedString attachment
Summary:
Same as D18048277 but for Fabric text infra.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: PeteTheHeat

Differential Revision: D18950415

fbshipit-source-id: 09701e261ecb871b3624260a36dd607fdb70e717
2019-12-12 12:00:47 -08:00
Eli WhiteandFacebook Github Bot 39234e862e Fix order of arguments in Fabric measure
Summary:
These arguments were in the wrong order. It should be x,y,width,height,pageX,pageY. It was x,y,pageX,pageY,width,height.

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D18940318

fbshipit-source-id: ebd757648169b1ffbf33b35dded1d505a1c80974
2019-12-11 14:56:28 -08:00
Valentin SherginandFacebook Github Bot 0cdc3b7016 Fabric: Making DebugStringConvertibleOptions a required parameter for all methods of static debug-printing infra
Summary:
Having those arguments optional does not really make anything easier to use; on another side that makes it hard finding problems caused by missing that parameter.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18797337

fbshipit-source-id: c119b8f6a03994072edb45e39337e33b0f8b602f
2019-12-09 15:37:59 -08:00
Joshua GrossandFacebook Github Bot 254ebab1d2 AndroidTextInput: don't set TextInput value to placeholder; use eventCounter prop to send tree updates via state
Summary:
Fix (1) placeholder (2) modifying TextInput in Fabric on Android.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D18894538

fbshipit-source-id: 21103f56e6f6e108fcf6359a23c9dd9a0323250e
2019-12-09 14:44:36 -08:00
Samuel SuslaandFacebook Github Bot 5ee8202b26 Add missing accessibilityTraits in Fabric
Summary:
`accessibilityTraits` was missing, this diff adds it.

Also there is a name mis match, in javascript it is called `accessibilityRole`.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18857668

fbshipit-source-id: 10656e8fb4e8c1d771a72c7f354b845e41cfc313
2019-12-09 06:41:27 -08:00
Valentin SherginandFacebook Github Bot b1f2c1e2c5 Fabric: Disabling an assert in ComponentDescriptorProviderRegistry
Summary:
This temporarily disables an `assert` in `ComponentDescriptorProviderRegistry`. The `assert` only suggests that the call to the class is redundant, so it's safe to just remove it for now.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D18878273

fbshipit-source-id: 007a2c6f62f858126912b7e54a1098e6f4c25a16
2019-12-08 09:54:37 -08:00
Valentin SherginandFacebook Github Bot 36d895ce21 Fabric: Enabling new TextMeasureCache thing for Android
Summary:
Read more about this in D18848583 (where it's implemented for iOS). This diff enables that for Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18869823

fbshipit-source-id: ebdc863ec07268119d1cbbb911760532bb28ee04
2019-12-07 22:47:49 -08:00
Valentin SherginandFacebook Github Bot 3aba90b58a Fabric: Workaround for mysterious crash in synchronouslyUpdateViewOnUIThread:props:.
Summary:
We are seeing some non-trivial amount of crashes happened because `[RCTSurfacePresenter synchronouslyUpdateViewOnUIThread:props:]` requests a Component Descriptor which does not register in the registry.
And the problem here is that ComponentDescriptors are not being designed to be used outside of C++ UIManager, and we only use that in RCTSurfacePresenter only because it's an old workaround that makes Native Animation Driver works with Fabric.

Messing with ComponentDescriptors are in general dangerous. Accessing them outside of UIManager means that they might be deallocated at any time, extending their lifetime will cause other crashes on the other side. So, that's why this is "BROKEN".

This diff does not make the code worse, it just designates the problem that was there for a long time, so it kinda makes it better.

We don't know for sure why some ComponentDescriptors are not registered but this diff at least makes it not crash in such case.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D18869651

fbshipit-source-id: 9d945ac7a2bd24a69a9bbb83b4fdd3cd19808f87
2019-12-06 17:58:35 -08:00
Valentin SherginandFacebook Github Bot e08412d9a1 Fabric: Text Measuring: TextMeasureCache the new, improved text measure cache
Summary:
Special thanks for Joshua Gross for flagging this problem!

This diff implements a custom evicting hash map designed specially to hold text measurement information. The key feature of this is custom equality checks and hashing functions.

They are designed around the following principals:
* Decorative text attributes (such as color, shadows, etc) has no effect on layout, therefore they should not be taking into account;
* `minimum height`, `minimum width`, and `maximum height` don't affect the measurement;
* the value of `layout metrics` are important only for `attachment` fragments.

After I redo all tests, I will enable this for Android-specific TextLayoutManager in separate diff.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18848583

fbshipit-source-id: 46c2fc445fbd1823afc5e7498e37de75381258b1
2019-12-06 10:54:13 -08:00