/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/ReactCommon/react/renderer/attributedstring/PlaceholderAttributedString.h
34 строки
1 KB
Nick Gerleman
Remove Measurement Placeholder Logic from Text ShadowNodes (#51465)
20 май 2025, 04:15
20 май 2025, 04:15
9fe20d4
Код
Авторство
О чём код?
/* * 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 #include <react/renderer/attributedstring/AttributedString.h> namespace facebook::react { /** * Prior to D63303709 AttributedString could not represent formatting on an * empty string, and so some text content was forcefully added to empty strings * during measurement. Usages of this function should be replaced with * formatting based off of baseTextAttributes. */ inline AttributedString ensurePlaceholderIfEmpty_DO_NOT_USE( const AttributedString& attributedString) { if (attributedString.isEmpty()) { AttributedString placeholder{attributedString}; placeholder.appendFragment( {.string = "I", .textAttributes = attributedString.getBaseTextAttributes(), .parentShadowView = {}}); return placeholder; } return attributedString; } } // namespace facebook::react