Files
react-native/ReactCommon/react/renderer/core/CoreFeatures.h
T
Samuel Susla d41e95fb1a Cache NSTextStorage
Summary:
changelog: [internal]

This diff introduces a mechanism to cache NSTextStorage on Paragraph's state. The old renderer already has caching for NSTextStorage: https://github.com/facebook/react-native/blob/main/Libraries/Text/Text/RCTTextShadowView.m#L21

Fabric will store `NSTextStorage` inside `ParagraphLayoutManager` which is owned by state.

There is one notable change which is not gated: Paragraph's state strongly owns `TextLayoutManager`, not `ParagraphShadowNode` like previously. This shouldn't change anything

Reviewed By: mdvacca

Differential Revision: D43692171

fbshipit-source-id: efe6077222a30ab6d89abd9916534b9a96e745d4
2023-03-08 08:36:08 -08:00

46 lines
1.4 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace facebook {
namespace react {
/*
* Contains the set of feature flags for the renderer core.
* Some of them are temporary and may be eventualy phased out
* as soon as the feature is fully implemented.
*/
class CoreFeatures {
public:
// Specifies whether the iterator-style prop parsing is enabled.
static bool enablePropIteratorSetter;
// This is used as a feature flag for *all* PropsX structs.
// For MapBuffer to be used for a particular component instance,
// its ShadowNode traits must set the MapBuffer trait; and this
// must be set to "true" globally.
static bool enableMapBuffer;
// When enabled, Fabric will block paint to allow for state updates in
// useLayoutEffect hooks to be processed. This changes affects scheduling of
// when a transaction is mounted.
static bool blockPaintForUseLayoutEffect;
// Whether to use Hermes' NativeState instead of HostObject
// in simple data passing scenarios with JS
static bool useNativeState;
// Creating NSTextStorage is relatively expensive operation and we were
// creating it twice. Once when measuring text and once when rendering it.
// This flag caches it inside ParagraphState.
static bool cacheNSTextStorage;
};
} // namespace react
} // namespace facebook