Commit Graph

15 Commits

Author SHA1 Message Date
bang9 048194849b feat(iOS): added lineBreakStrategy attribute to Text/TextInput (#31272)
Summary:
iOS did not support the implementation of Korean word-wrap(line-break) before iOS14.
If the attribute applied, the word-wrap of Korean will works.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Added] -  Line break strategy for Text and TextInput components

Pull Request resolved: https://github.com/facebook/react-native/pull/31272

Test Plan:
1. Test build and run on above iOS 14.
2. Test it does not affect existing text components when set default(none) strategy.
3. Test whether word-wrap works with Korean when set hangul-word strategy.

<img src="https://user-images.githubusercontent.com/26326015/112963967-d7f70c00-9182-11eb-9a34-8c758b80c219.png" width="300" height="" style="max-width:100%;">

Reviewed By: javache

Differential Revision: D39824809

Pulled By: lunaleaps

fbshipit-source-id: 42cb0385221a38c84e80d3494d1bfc1934ecf32b
2022-10-17 13:14:17 -07:00
Samuel Susla 51af7cdcde Use nested namespace name
Summary:
changelog: [internal]

Enable two new clang tidy checks:
- modernize-concat-nested-namespaces
- google-build-using-namespace

jest_e2e[run_all_tests]

Reviewed By: rshest

Differential Revision: D40020646

fbshipit-source-id: f3be80b5f829dd0ba376bdd70ed13332e114d48a
2022-10-13 05:07:59 -07:00
Ruslan Shestopalyuk aa5d43fe54 Merge enablePropIteratorSetter flags into a single one in CoreFeatures (#34869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34869

Changelog: [Internal]

This merges all instances of `enablePropIteratorSetter` into a single one.

Both `AccesibilityProps` and `BaseTextProps` had their own instances if it, which is now redundant.

Reviewed By: cipolleschi

Differential Revision: D40062555

fbshipit-source-id: b6ccf5a9538612dd731a6f9c4eaceeebcb6d95be
2022-10-05 05:09:37 -07:00
Ruslan Shestopalyuk 7de2b6b415 Support iterator-style PropParsing for AndroidTextInput
Summary:
Support iterator-style PropParsing for AndroidTextInput

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D38833510

fbshipit-source-id: 4f424579a41e70fbe8c0eba430bd435dc60bfc04
2022-10-02 03:38:07 -07:00
Samuel Susla ce50c43986 Add more clang tidy rules
Summary:
changelog: [internal]

Add more clang tidy rules to prevent common class of bugs.

Reviewed By: javache

Differential Revision: D39245194

fbshipit-source-id: 5521c5c4653d7005b96ebba494e810ba5075afbc
2022-09-06 07:01:17 -07:00
Ruslan Shestopalyuk a142a78473 Fix regression when setting shadow node properties in D38272966 (github PR merge)
Summary:
Changelog:

[Android][Fixed] - Fix regression when setting shadow node properties.

Also simplified the corresponding macros to avoid using lambdas altogether, as they are not required.

Note that this **does not** modify any constexpr-related semantics of the existing code, as the main constexpr macro, `CONSTEXPR_RAW_PROPS_KEY_HASH` evaluation result is still contstexpr value, and the other ones already involved non-const parts (see my comments).

Reviewed By: NickGerleman

Differential Revision: D38356411

fbshipit-source-id: 22c330d3425c8aed36693f4652f1b257d2dc96be
2022-08-02 15:14:16 -07:00
Chiara Mooney fc26dbfce0 Fix Macro Errors for Windows (#34299)
Summary:
Fix macro errors for Windows. Current syntax breaks the build of the React Common project on Windows because the ({...}) syntax is not supported; must be replaced with lambda expressions.

Resolves https://github.com/facebook/react-native/issues/34090

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Fixed] - Fix macro errors for Windows.

lyahdav JoshuaGross

Pull Request resolved: https://github.com/facebook/react-native/pull/34299

Test Plan: Build on react-native-windows repo. Tested in RNW app.

Reviewed By: javache

Differential Revision: D38272966

Pulled By: NickGerleman

fbshipit-source-id: e76eac11cde173ef49465d01d793c593017f2ab7
2022-08-01 20:54:59 -07:00
Joshua Gross af1eae9ea3 New Props parsing infrastructure for perf improvements: visitor pattern vs random-map-access pattern (BaseTextProps and derived props)
Summary:
See commentary at top of stack.

Changelog: [Added][Fabric] New API for efficient props construction

Reviewed By: javache

Differential Revision: D37051020

fbshipit-source-id: 643e433c0d0590cfcd17bc7a43d105bed6ff12ef
2022-06-15 23:37:34 -07:00
Joshua Gross 00751f64c7 Fix out-of-order prop parsing deoptimization in TextView/Paragraph
Summary:
See also D36889794. This is a very similar idea, except the core problem is that BaseTextProps is accessing the same props as ViewProps; and for ParagraphProps parsing, it first defers to ViewProps' parser and then BaseTextProps. RawPropsParser is optimized to access the same props in the same order, *exactly once*, so if we access a prop out-of-order, or for a second time, that access and the next access are deoptimized. Paragraph/Text, in particular, were quite bad because we did this several times, and each out-of-order access requires scanning /all/ props.

This fixes the issue, at least partially, by (1) pulling all the duplicate accesses to the beginning of BaseTextProps, and (2) accessing them all in the same order as ViewProps, relatively (some props are skipped, but that matters less).

Practically what this means is that now, all of Props' accesses have a cost of O(1) for lookup, or a total of O(n) for all of them; each access is at the n+1 position in the internal RawPropsParser array, so each access is cheap. BaseTextProps' duplicate accesses, even though there are only 4 of them: (1) the first one scans the entire array until we reach the prop in question; (2) the next accesses require scans, but not whole-array scans, since they're in order. (3) The BaseTextProps accesses /after/ the duplicate accesses are all O(1).

tl;dr is that before we had something like O(n*6) cost for BaseTextProps parsing and now it is O(n*2).

Similar to my summary in the last diff: we may want to revisit the RawPropsParser API... but I want to tread gently there, and this gets us a large improvement without major, risky changes.

Empirically, based on a couple of systraces, average time for a single UIManager::createNode called from JS thread, before this stack: 17us. After: 667ns (3% as long). On average, for every 60 createNode calls, we will save 1ms on the UI thread. The savings will be greater for certain screens that use many Views or Text nodes, and lesser for screens that use fewer of these components.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D36890072

fbshipit-source-id: 5d24b986c391d7bb158ed2f43d130a71960837d1
2022-06-02 23:36:54 -07:00
Samuel Susla 681ed402de Turning on clang tidy performance-*
Summary:
changelog: [internal]

Enable performance related clang tidy rules.

Reviewed By: javache

Differential Revision: D33350556

fbshipit-source-id: 486446ed0a1ac88af21b691ac6905b4f2359dafc
2022-01-05 05:53:13 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08: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 5d33e65694 Pass context through to all prop parser (props structs changes)
Summary:
See previous diffs for context. This updates all of the relevant props structs.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29855426

fbshipit-source-id: 30177c3380ef82ecf8f2a4321f128cfbe8a576e0
2021-07-28 20:18:20 -07:00
Cody Unger e1d17c785b Implement textTransform prop
Summary:
Added to C++ props, but realized this is already implemented using C++ state in Android, so added to C++ state to keep this diff simpler. Keeping the C++ props change for future use.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D29805267

fbshipit-source-id: c1fe2dc34af8bc69352ee48a5d60ba998194e3f7
2021-07-21 16:27:55 -07:00
David Vacca 2d8fe89784 Move Text C++ out of inner folders
Summary:
This diff flattens the hierarchy of Text C++ files.
This is required to integrate Text into RN OSS

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D23173556

fbshipit-source-id: ce90000cae147460aa4ddad55b7c90369fa734a2
2020-08-18 19:55:50 -07:00