@@ -1193,6 +1193,11 @@ void WindowsTextInputComponentView::updateProps(
11931193 updateAutoCorrect (newTextInputProps.autoCorrect );
11941194 }
11951195
1196+ if (oldTextInputProps.keyboardType != newTextInputProps.keyboardType ||
1197+ oldTextInputProps.secureTextEntry != newTextInputProps.secureTextEntry ) {
1198+ updateKeyboardType (newTextInputProps.keyboardType );
1199+ }
1200+
11961201 if (oldTextInputProps.selectionColor != newTextInputProps.selectionColor ) {
11971202 m_needsRedraw = true ;
11981203 }
@@ -1439,6 +1444,10 @@ void WindowsTextInputComponentView::onMounted() noexcept {
14391444 m_propBitsMask |= TXTBIT_CHARFORMATCHANGE;
14401445 m_propBits |= TXTBIT_CHARFORMATCHANGE;
14411446 }
1447+
1448+ // Initialize keyboardType
1449+ updateKeyboardType (windowsTextInputProps ().keyboardType );
1450+
14421451 InternalFinalize ();
14431452
14441453 // Handle autoFocus property - focus the component when mounted if autoFocus is true
@@ -1554,25 +1563,59 @@ void WindowsTextInputComponentView::UpdateParaFormat() noexcept {
15541563 m_pf.dwMask = PFM_ALL;
15551564
15561565 auto &textAlign = windowsTextInputProps ().textAlign ;
1566+ auto &baseWritingDirection = windowsTextInputProps ().textAttributes .baseWritingDirection ;
1567+
1568+ // Handle writingDirection (baseWritingDirection)
1569+ // For WritingDirection::Natural, use the computed layout direction from the layout tree
1570+ // since direction can be overridden at any point in the tree
1571+ bool isRTL = false ;
1572+ if (baseWritingDirection.has_value ()) {
1573+ if (*baseWritingDirection == facebook::react::WritingDirection::RightToLeft) {
1574+ isRTL = true ;
1575+ m_pf.dwMask |= PFM_RTLPARA;
1576+ m_pf.wEffects |= PFE_RTLPARA;
1577+ } else if (*baseWritingDirection == facebook::react::WritingDirection::LeftToRight) {
1578+ isRTL = false ;
1579+ // Ensure RTL flag is not set
1580+ m_pf.wEffects &= ~PFE_RTLPARA;
1581+ } else if (*baseWritingDirection == facebook::react::WritingDirection::Natural) {
1582+ // Natural uses the layout direction computed from the tree
1583+ isRTL = (layoutMetrics ().layoutDirection == facebook::react::LayoutDirection::RightToLeft);
1584+ if (isRTL) {
1585+ m_pf.dwMask |= PFM_RTLPARA;
1586+ m_pf.wEffects |= PFE_RTLPARA;
1587+ } else {
1588+ m_pf.wEffects &= ~PFE_RTLPARA;
1589+ }
1590+ }
1591+ } else {
1592+ // No explicit writing direction set - use layout direction from tree
1593+ isRTL = (layoutMetrics ().layoutDirection == facebook::react::LayoutDirection::RightToLeft);
1594+ if (isRTL) {
1595+ m_pf.dwMask |= PFM_RTLPARA;
1596+ m_pf.wEffects |= PFE_RTLPARA;
1597+ } else {
1598+ m_pf.wEffects &= ~PFE_RTLPARA;
1599+ }
1600+ }
15571601
1602+ // Handle textAlign
15581603 if (textAlign == facebook::react::TextAlignment::Center) {
15591604 m_pf.wAlignment = PFA_CENTER;
15601605 } else if (textAlign == facebook::react::TextAlignment::Right) {
15611606 m_pf.wAlignment = PFA_RIGHT;
1607+ } else if (textAlign == facebook::react::TextAlignment::Justified) {
1608+ m_pf.wAlignment = PFA_JUSTIFY;
1609+ } else if (textAlign == facebook::react::TextAlignment::Natural) {
1610+ // Natural alignment respects writing direction
1611+ m_pf.wAlignment = isRTL ? PFA_RIGHT : PFA_LEFT;
15621612 } else {
1613+ // Default to left alignment
15631614 m_pf.wAlignment = PFA_LEFT;
15641615 }
15651616
15661617 m_pf.cTabCount = 1 ;
15671618 m_pf.rgxTabs [0 ] = lDefaultTab;
1568-
1569- /*
1570- if (m_spcontroller->IsCurrentReadingOrderRTL())
1571- {
1572- m_pf.dwMask |= PFM_RTLPARA;
1573- m_pf.wEffects |= PFE_RTLPARA;
1574- }
1575- */
15761619}
15771620
15781621void WindowsTextInputComponentView::OnRenderingDeviceLost () noexcept {
@@ -1877,4 +1920,10 @@ void WindowsTextInputComponentView::ShowContextMenu(const winrt::Windows::Founda
18771920 DestroyMenu (menu);
18781921}
18791922
1923+ void WindowsTextInputComponentView::updateKeyboardType (const std::string &keyboardType) noexcept {
1924+ // Store the keyboard type for future use
1925+ // Note: Fabric's windowless RichEdit doesn't have direct InputScope support like Paper's XAML controls.
1926+ // The keyboard type is stored but the actual keyboard behavior is handled by the system's IME.
1927+ m_keyboardType = keyboardType;
1928+ }
18801929} // namespace winrt::Microsoft::ReactNative::Composition::implementation
0 commit comments