Commit Graph

616 Commits

Author SHA1 Message Date
Phillip Pan def7dd857d use new instead of alloc init
Summary:
i saw this a lot in the codebase, it's not optimal bc we're using two selectors when we only need one.

  fastmod --extensions m,mm '\[\[(.*) alloc] init]' '[${1} new]' --dir xplat/js/react-native-github/*

i manually updated the callsites that this codemod couldn't handle (e.g., where there were more than one of these instances in a single line)

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D31776561

fbshipit-source-id: 1b16da240e8a79b54da67383d548921b82b05a9f
2021-10-20 22:18:38 -07:00
CodemodService FBSourceClangFormatLinterBot a110de9b0e Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D31785584

fbshipit-source-id: 6e73901bdeaec659fbf46f1a5559f18cd09ae091
2021-10-19 21:16:42 -07:00
Joshua Gross d291a7efdd Allow disabling RTTI/exceptions for android builds; disable by default on Android
Summary:
For fbandroid builds only, disable RTTI and exceptions by default.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D31632757

fbshipit-source-id: cfe0e43486df19fcaacc2b5b818b9d00ec2d427f
2021-10-19 17:17:30 -07:00
Rob Hogan 61755aced1 Merge textDecoration(LineStyle|LinePattern) into textDecorationStyle
Summary:
The [first implementation of `TextAttributes` in Fabric](https://github.com/facebook/react-native/commit/62576bcb7832e08c6fd9f9482285882c37a2ece5) included two separate props instead of `textDecorationStyle`: `textDecorationLineStyle` (single, double, ...) and `textDecorationLinePattern` (dot, dash, dotdash, ...). These two props were implemented in C++ and iOS but never supported in JS.

Pre-Fabric (and CSS) on the other hand use a single prop `textDecorationStyle: 'solid' | 'double' | 'dotted' | 'dashed'`.

This diff implements this same API in Fabric, and removes the unused `textDecorationLineStyle` and `textDecorationLinePattern` props.

Changelog:
[iOS][Fixed] - Implement `textDecorationStyle` on iOS and remove unused `textDecorationLineStyle` and `textDecorationLinePattern` from Fabric.

Reviewed By: dmitryrykun

Differential Revision: D31617598

fbshipit-source-id: f5173e7ecdd31aafa0e5f0e50137eefa0505e007
2021-10-18 02:16:03 -07:00
Joshua Gross 6525f9b082 Stop using RTTI features in Fabric core and components
Summary:
These dynamic_casts aren't really giving us much (they have never fired once in dev! and don't run in prod anyway). They also prevent us from disabling RTTI. So, let's get rid of them.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D31634895

fbshipit-source-id: 4a9b259837127feb324f64fa3e9e23eb1cc481a6
2021-10-14 19:23:09 -07:00
Joshua Gross b60e229d7f Remove compiler_flags from BUCK modules
Summary:
Nearly all of these are identical and these compiler_flags are now centralized in rn_defs.bzl. This should have NO CHANGE on build configuration, the flags have just moved for now.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D31631766

fbshipit-source-id: be40ebeb70ae52b7ded07ca08c4a29f10a0ed925
2021-10-14 15:34:29 -07:00
Neil Dhar aae93553d0 Remove libstdc++ dependency (#32247)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32247

I don't think we need both libc++ and libstdc++.

allow-large-files

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30950943

fbshipit-source-id: d0669815ff59c3e9ac45954a4a11930d1bc3959f
2021-10-08 14:16:54 -07:00
Samuel Susla 27304fcd0b Add error handling to RuntimeScheduler
Summary:
changelog: [internal]

Catch JavaScript errors and forward them to `ErrorUtils` in *RuntimeScheduler*. This makes sure that JS errors are handled by ErrorUtils and do not bubble up to bridge.

Reviewed By: philIip

Differential Revision: D31429001

fbshipit-source-id: 50f865872e4cd3ba180056099ff40f5962ee7a77
2021-10-07 15:23:11 -07:00
Samuel Susla ea53d3a9c2 Pass reference instead of shared_ptr to getInspectorDataForInstance
Summary:
changelog: [internal]

This is a pre-condition to get rid of `shared_ptr` from `EventEmitterWrapper`. Also saves us a few copies of shared_ptr, this is negligible though.

Reviewed By: mdvacca

Differential Revision: D31307048

fbshipit-source-id: b84654bed2359b66faf3995795e135e88fe51cb6
2021-10-01 17:47:20 -07:00
Andrei Shikov bf4c6b3606 Expose RawEvent::Category to Java callsites
Summary:
For iOS, event category deduction is done from the C++ code, but the touch events are handled on Java layer in Android. This change exposes the category parameter through the `EventEmitterWrapper` called from Java, allowing to define category for events in the future.

Changelog:
[Internal] - Expose event category through JNI

Reviewed By: mdvacca

Differential Revision: D31205587

fbshipit-source-id: f2373ce18464b01ac08eb87df8f421b33d100be2
2021-09-29 06:53:49 -07:00
Samuel Susla ea3e244668 Add option to use RuntimeScheduler in TurboModules
Summary: changelog: [internal]

Reviewed By: RSNara

Differential Revision: D31145372

fbshipit-source-id: b1d9473d5006d055d1116f71f65899293fb85c56
2021-09-28 09:23:57 -07:00
Samuel Susla 18697adec4 Add option to use RuntimeScheduler in TurboModules
Summary: changelog: [internal]

Reviewed By: RSNara

Differential Revision: D31108093

fbshipit-source-id: 941abf334cc89391641131475725a3eeb790b822
2021-09-25 15:31:21 -07:00
Joshua Gross 10fe09c456 Back out "Send unix timestamp for touch events instead of systemUptime"
Summary:
Original commit changeset: 2acd52ae5873

This original change was made in D26705430 (https://github.com/facebook/react-native/commit/b08362ade5d68af4b6c66d5cf0dab5f42a2ec894) and D26705429 (https://github.com/facebook/react-native/commit/69feed518d01a7d91f0c71509429c4388912131c). The intention was to change the timestamp definition to make touch telemetry easier, but this is (1) unnecessary and (2) causes other issues.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D31183734

fbshipit-source-id: 6af669bb5696896b43fa4508af1171446d62c6d6
2021-09-24 18:11:33 -07:00
Samuel Susla 382e78e0f0 Cleanup react_fabric_marketplace_home_android_universe.enable_props_forwarding
Summary: changelog: [internal]

Reviewed By: GijsWeterings, ShikaSD

Differential Revision: D30835467

fbshipit-source-id: 6ce2a9dd64eb8a3711370fd07c1b0703b7b3345b
2021-09-24 05:09:58 -07:00
Pieter De Baets 6025611bd0 Use real propsParserContext in LayoutAnimation
Summary: Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D31053819

fbshipit-source-id: 8ec21012500f3bfc7e8aea018b5ca72323da2d9e
2021-09-21 04:24:28 -07:00
Pieter De Baets 9b97c09612 Short-circuit evaluation of formsView
Summary:
Changelog: [Internal]

Small optimization, we can avoid evaluating some properties if `formsStackingContext` is already set, because the end-result is always true.

Reviewed By: sammy-SC

Differential Revision: D30990925

fbshipit-source-id: 08f500aa4b75446a6c644e8821f84dbfccbfebb6
2021-09-17 07:25:54 -07:00
Kevin Gozali b0c8a4eee8 Link RCT-Folly against libc++abi
Summary:
Folly now depends on libc++abi. This solves linker error for RCT-Folly.podspec like this:

```
Undefined symbols for architecture arm64:
  "___cxa_increment_exception_refcount", referenced from:
      folly::exception_ptr_get_type(std::exception_ptr const&) in libRCT-Folly.a(Exception.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

See https://github.com/react-native-community/releases/issues/251

Note: RNTester was not affected by this bug for some reason, so the only way to verify is via the new app generated via `npx react-native init`.

Changelog: [Fixed][iOS] Unbreak Folly linker error

Reviewed By: lunaleaps

Differential Revision: D30950944

fbshipit-source-id: 3eb146e23faa308a02363761d08849d6801e21ca
2021-09-16 22:24:10 -07:00
Samuel Susla 1ecd98adc7 Do not flatten view if prop accessibilityViewIsModal is true
Summary:
changelog: [internal]

As per title, prevent view from flattening if `accessibilityViewIsModal` is true.

Reviewed By: jimmy623

Differential Revision: D30696223

fbshipit-source-id: 0c6bfc116458d1808f152cb13ba6c941c58f052e
2021-09-15 08:31:58 -07:00
CodemodService Bot 18b866da53 xplat/
Reviewed By: scottrice

Differential Revision: D30749716

fbshipit-source-id: d96a943a720fb6a2c8af80deab69e8990f53bb94
2021-09-14 19:13:25 -07:00
Samuel Susla ce6047d816 Pull function calculateAnimationProgress to a separate file
Summary:
changelog: [internal]

Pulling a function from class since it doesn't use any of the ivars.

Reviewed By: RSNara

Differential Revision: D30766917

fbshipit-source-id: 219d9b7d3bc0b110b659d7188f5e3877c7b480ff
2021-09-14 06:21:05 -07:00
Samuel Susla cc3064d394 Use designated initialisers for ShadowViewMutation
Summary:
changelog: [internal]

In this diff, we delete default initialised for ShadowViewMutation to prevent accidentally creating empty ShadowViewMutation.
The other initialiser is made private and all of its uses are migrated to designated initialisers. This makes for safer API.

Reviewed By: RSNara

Differential Revision: D30774900

fbshipit-source-id: d2064bf08409850e75e13ad06558b7980a7f5d8d
2021-09-12 08:56:32 -07:00
Samuel Susla d2cc91bcc3 Add a way to simulate memory access to ImageProps in LayoutAnimations
Summary:
changelog: [internal]

I'm chasing down a crash in LayoutAnimations, it would help me to simulate the memory access which causes the crash to learn where the bad memory is coming from.

Reviewed By: RSNara

Differential Revision: D30776840

fbshipit-source-id: 1e97fac28ba2df37ba3e47ec2c110043c3823e70
2021-09-12 08:56:32 -07:00
Samuel Susla c6e203bdb0 Prevent implicit conversion to boolean
Summary:
changelog: [internal]

This looks like a bug where the author did not intend the conversion to boolean. This means that `onlyMutationIsUpdate` was evaluated to true even if more than 1 animation was in the vector.

Reviewed By: RSNara

Differential Revision: D30767172

fbshipit-source-id: 0ef47b65a5d8ef07d774d9e0b358e5642dc0a9ea
2021-09-12 08:56:32 -07:00
Samuel Susla 1e4f364f87 Remove movesToAnimate var which was never read
Summary:
changelog: [intenal]

The variable is never read, removing it.

Reviewed By: RSNara

Differential Revision: D30767134

fbshipit-source-id: de72740f9dc7ad10d651129404fe4df093e6206d
2021-09-12 08:56:32 -07:00
Samuel Susla 273f631535 Annotate arguments in AnimationKeyFrame ctor
Summary:
changelog: [internal]

Just improvement to readability.

Reviewed By: philIip

Differential Revision: D30767100

fbshipit-source-id: eb5d36712f8096e6becd8db1e9d47128d5754624
2021-09-12 08:56:32 -07:00
Samuel Susla 10ab64888f Annotate arguments when constructing ShadowViewMutation
Summary: changelog: [internal]

Reviewed By: philIip

Differential Revision: D30766786

fbshipit-source-id: f7fac3371d9f018c15c366b0e8a5be1de021a0e7
2021-09-11 01:42:32 -07:00
Samuel Susla 24b961b6f7 Add option to crash the app if component descriptor is missing in LayoutAnimations
Summary:
changelog: [internal]

Add a log behind feature flag to learn more about missing component descriptor.

Component descriptor should never be missing, that's a state of program that is impossible as far as I can tell. This logic was introduced in D22216030 (https://github.com/facebook/react-native/commit/6342e6e3f11219391ac3296d41233735af7e6cad) and I think it is just cover the real cause of crashes in LA on iOS.

Reviewed By: RSNara

Differential Revision: D30765947

fbshipit-source-id: 6843384e02529de2f024c59c61ae21b8682ac371
2021-09-11 00:26:27 -07:00
Samuel Susla 4fe72bdc22 Move comparision functions to separate file
Summary:
changelog: [internal]

Just moving two functions to separate file.

Reviewed By: RSNara

Differential Revision: D30765732

fbshipit-source-id: e85e749c2910f6f38f07e56b23a21fb9f1cbc9b5
2021-09-09 11:57:25 -07:00
Samuel Susla 661b11e815 Use unordered_set instead of vector to keep track of tags
Summary:
changelog: [internal]

Prefer `unordered_set` over `vector`. Makes for nicer APIs and has better performance characteristics.

Reviewed By: RSNara

Differential Revision: D30756215

fbshipit-source-id: d259da07f8f0d5837441dc8ba11c00324aac3fa4
2021-09-09 11:57:25 -07:00
Samuel Susla 84d039aad2 Avoid extra copy and use more expressive APIs
Summary: changelog: [internal]

Reviewed By: RSNara

Differential Revision: D30756211

fbshipit-source-id: 650b3faa55ce1b6f33a452f25b699d854a5cee25
2021-09-09 11:57:25 -07:00
Samuel Susla ba6f21e32d Pull handling of stopped surfaces into separate method
Summary:
changelog: [internal]

Just moves stopped surfaces logic into separate method

Reviewed By: RSNara

Differential Revision: D30756213

fbshipit-source-id: d8eb637e6b9fc77c400dfdefa900ebaa89710825
2021-09-09 11:57:24 -07:00
Samuel Susla 668ce510bd Avoid copy in LayoutAnimationDriver
Summary:
changelog: [internal]

Avoid unnecessary copy of `ShadowViewMutation` and `ShadowView`.

Reviewed By: RSNara

Differential Revision: D30756214

fbshipit-source-id: 39c44dd60582e6c111986df482613212e25739d7
2021-09-09 11:57:24 -07:00
Samuel Susla f91974156b Pass by ShadowView by reference to copy
Summary:
changelog: [internal]

Pass ShadowView by reference to avoid unnecessary copy.

Reviewed By: RSNara

Differential Revision: D30756212

fbshipit-source-id: 1ac1f5b943c8f278db5bcdb55d76e88de514debb
2021-09-09 11:57:24 -07:00
Samuel Susla a3343dfca3 Move conversion functions to separate file
Summary:
changelog: [internal]

Just move conversion functions to separate file

Reviewed By: philIip

Differential Revision: D30732128

fbshipit-source-id: 092523de949ee0088b1317c887aca91913991647
2021-09-09 11:57:24 -07:00
Samuel Susla ae4068d63c Add option to skip invalidated key frames
Summary:
changelog: [internal]

Maybe invalid keyframe animation shouldn't be queued. This adds a fix behind feature flag to verify if it fixes iOS crashes.

Reviewed By: RSNara

Differential Revision: D30730005

fbshipit-source-id: 8a2bb54c449449a95d14d51a1a78bfaccad61877
2021-09-09 11:57:24 -07:00
Samuel Susla 16a093029e Group private public and protected methods in LayoutAnimationKeyFrameManager
Summary:
changelog: [internal]

Group public, protected and private methods in header and implementation file. Nothing else is changed in this diff.

Reviewed By: RSNara

Differential Revision: D30729103

fbshipit-source-id: 047bfb86794caedddcf6569ffeee224fee811794
2021-09-08 11:53:16 -07:00
Samuel Susla f2191ecbc5 Clean up dtors in LayoutAnimations
Summary:
changelog: [internal]

Clean up destructors for classes in LayoutAnimations module.

Reviewed By: RSNara

Differential Revision: D30728212

fbshipit-source-id: 612afb8ebf1407318d22fc461fcc7e03a2b72c47
2021-09-08 11:53:16 -07:00
Samuel Susla 2c09095567 Remove unused header imports
Summary:
changelog: [internal]

Clean up unused header imports in LayoutAnimations.

Reviewed By: RSNara

Differential Revision: D30728213

fbshipit-source-id: 725da1a7057b058c6564a8d89856d599f9a798a7
2021-09-08 11:53:16 -07:00
Samuel Susla 5153b43c6a Move LA helper classes to separate file
Summary:
changelog: [internal]

Just moving helper classes to dedicated file

Reviewed By: philIip

Differential Revision: D30728209

fbshipit-source-id: a86feb7f9352356078f3d238eb8d5f0c0f1e7ff2
2021-09-08 11:53:16 -07:00
Samuel Susla d83c310144 Simplify Layout Animation callback handling
Summary:
changelog: [internal]

There was extra bookkeeping associated with lifetime of `LayoutAnimationCallbackWrapper`. We can just copy it into runtimeExecutor lambda to manage its life cycle and delete `jsi::Function` once it was called.

Reviewed By: RSNara

Differential Revision: D30728210

fbshipit-source-id: 6fc60ee83846cb73648f1c09e5aaf1ed04bd0817
2021-09-08 11:53:16 -07:00
Samuel Susla cb58c84dc0 Use set instead of vector to hold stopped surfaces
Summary:
changelog: [internal]

Use set instead of vector. It makes for nicer API to check if the element exists.

Reviewed By: cortinico

Differential Revision: D30728211

fbshipit-source-id: 7b7cc1e94bb82a44b064e2945a753adbbce5dc2c
2021-09-08 06:46:52 -07:00
Samuel Susla 30887403ec Add LayoutAnimation support to all ViewKind nodes
Summary:
changelog: [internal]

LayoutAnimations only animates changes inside View and Paragraph nodes. This diff extends it to any node that's ViewKind.

Reviewed By: JoshuaGross

Differential Revision: D30603138

fbshipit-source-id: 63ca1e5df420149c4ba66151e97fea419fdfe631
2021-09-08 04:19:09 -07:00
Samuel Susla dbda1917cc Make RuntimeScheduler module compile in C++ 14
Summary:
changelog: [internal]

Don't use C++ 17 features in RuntimeScheduler module as it needs to be imported into C++14 module.

Also removes redundant dependency.

Reviewed By: ShikaSD

Differential Revision: D30485642

fbshipit-source-id: 0a20f85c596eebe193affc815c8ca851fc72e46d
2021-09-01 11:26:27 -07:00
Samuel Susla 3e6eedaedb Use surfaceId type instead of int in PropsParserContext
Summary:
changelog: [internal]

Use surfaceId type instead of raw int type in PropsParserContext

Reviewed By: RSNara

Differential Revision: D30667540

fbshipit-source-id: 2bf890b892851e785318e3566692ac72ec782b91
2021-09-01 10:27:31 -07:00
Samuel Susla 7dc22116b0 Remove RTTI from LayoutAnimations
Summary:
changelog: [internal]

Remote use of dynamic_cast from LayoutAnimations.

Reviewed By: JoshuaGross, cortinico

Differential Revision: D30602864

fbshipit-source-id: ce23f9b4a8b4e28d17d2297d64d8e460a1e03472
2021-08-28 06:59:22 -07:00
Neil Dhar 1bc885b8b8 Make JSI a dynamic library
Summary:
Ship libjsi as a standalone dynamic library. This prevents problems
with exception handling caused by duplicate typeinfo across multiple
shared libs, and reduces bundle size by removing duplicate copies of
JSI.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30599215

fbshipit-source-id: abad1398342a5328daa825f3f684e0067cad7a96
2021-08-27 17:16:49 -07:00
Genki Kondo f3e8ea9c29 Use hyphenationFrequency for text measurement
Summary:
Implements the calculation of measurement and position of Text attachments in Android

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30586616

fbshipit-source-id: e9ecc002f03477e3465d746855e1dff2e5f0b321
2021-08-27 09:04:01 -07:00
Genki Kondo 3b2d541989 Set textBreakStrategy default to be HighQuality
Summary:
Android TextView's default for breakStrategy is BREAK_STRATEGY_HIGH_QUALITY (https://developer.android.com/reference/android/widget/TextView#setBreakStrategy(int))

RN docs also states that highQuality is default.

However, on Fabric, the default is 'simple'. This diff fixes the default to be 'highQuality'

Changelog:
[Android][Fixed] - Set textBreakStrategy default to be 'highQuality'

Reviewed By: JoshuaGross

Differential Revision: D30597085

fbshipit-source-id: 3bd7531afdaf980b342cc461dd449c3d3df12cb0
2021-08-27 00:19:27 -07:00
Phillip Pan fe5a5dc878 virtualize setDisplayMode
Summary:
Changelog:
[internal]

following the recommendation in https://fb.workplace.com/groups/474291069286180/posts/6540719469309946

in order to unit test classes that use SurfaceHandler, we need to be able to mock it somehow - since the class is final we aren't able to do that. in this diff, we convert the function that we need to stub / listen to to a virtual function so we can mock it.

the alternative is to keep this class final, and create another abstract interface that this will extend from. however, this class is quite large and that would have a lot more boilerplate and updation of callsites, so this simpler approach seems better.

Reviewed By: sammy-SC

Differential Revision: D30578928

fbshipit-source-id: 4a63396f049c44753986d15f1ac64332b2a8393a
2021-08-26 22:40:43 -07:00
Genki Kondo ca60be8882 Add android_hyphenationStrategy to ParagraphAttributes
Summary:
Expose android_hyphenationFrequency in Fabric as part of ParagraphAttributes

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30583215

fbshipit-source-id: f4e9e9d6ea8efcfc10db29e1fbd651462f442837
2021-08-26 18:52:18 -07:00