-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Share TextLayoutManager.h across all platforms (#48210)
Summary: Pull Request resolved: #48210 [Changelog] [Internal] - Share TextLayoutManager.h across all platforms The goal of this change is to enable to share `TextLayoutManager.h` across all platforms, the same we do for: https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/imagemanager/ImageManager.h Reviewed By: philIip Differential Revision: D67064488 fbshipit-source-id: 15ee02f3c2351ad65590b5f0dee2f3dbbde4df32
- Loading branch information
1 parent
c2fd35a
commit ae90dd3
Showing
8 changed files
with
59 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextLayoutManager.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#include "TextLayoutManager.h" | ||
|
||
namespace facebook::react { | ||
|
||
Float TextLayoutManager::baseline( | ||
const AttributedStringBox& attributedStringBox, | ||
const ParagraphAttributes& paragraphAttributes, | ||
const Size& size) const { | ||
auto lines = | ||
this->measureLines(attributedStringBox, paragraphAttributes, size); | ||
|
||
if (!lines.empty()) { | ||
return lines[0].ascender; | ||
} else { | ||
return 0; | ||
} | ||
} | ||
|
||
} // namespace facebook::react |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 0 additions & 76 deletions
76
...eact-native/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
...derer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters