Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "TextInputs are zero height if there is no value and no placeholder text",
"packageName": "react-native-windows",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ facebook::react::RectangleEdges<bool> ComponentView::focusNudges() const noexcep

Assert(m_componentHostingFocusVisual);

if (layoutMetrics.frame.origin.x < 0) {
if (layoutMetrics.frame.origin.x < m_componentHostingFocusVisual->m_layoutMetrics.frame.origin.x) {
nudgeEdges.left = true;
}
if (layoutMetrics.frame.origin.y < 0) {
if (layoutMetrics.frame.origin.y < m_componentHostingFocusVisual->m_layoutMetrics.frame.origin.y) {
nudgeEdges.top = true;
}
if (layoutMetrics.frame.getMaxX() > m_componentHostingFocusVisual->m_layoutMetrics.frame.getMaxX()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,8 @@ void WindowsTextInputComponentView::DrawText() noexcept {
}

bool isZeroSized =
m_layoutMetrics.frame.size.width <= (m_layoutMetrics.contentInsets.left + m_layoutMetrics.contentInsets.right);
m_layoutMetrics.frame.size.width <= (m_layoutMetrics.contentInsets.left + m_layoutMetrics.contentInsets.right) ||
m_layoutMetrics.frame.size.height <= (m_layoutMetrics.contentInsets.top + m_layoutMetrics.contentInsets.bottom);
if (!m_drawingSurface || isZeroSized)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/attributedstring/AttributedStringBox.h>
#include <react/renderer/attributedstring/PlaceholderAttributedString.h>
#include <react/renderer/attributedstring/TextAttributes.h>
#include <react/renderer/components/text/BaseTextShadowNode.h>
#include <react/renderer/core/LayoutConstraints.h>
Expand Down Expand Up @@ -185,6 +186,7 @@ AttributedString WindowsTextInputShadowNode::getPlaceholderAttributedString(cons
const auto &props = getConcreteProps();

AttributedString attributedString;
attributedString.setBaseTextAttributes(props.textAttributes);
//[windows
if (!props.placeholder.empty()) {
auto textAttributes = TextAttributes::defaultTextAttributes();
Expand All @@ -203,7 +205,7 @@ AttributedString WindowsTextInputShadowNode::getPlaceholderAttributedString(cons
}
// windows]

return attributedString;
return ensurePlaceholderIfEmpty_DO_NOT_USE(attributedString);
}

#pragma mark - LayoutableShadowNode
Expand Down
Loading