Skip to content

Conversation

@Nitin-100
Copy link
Contributor

@Nitin-100 Nitin-100 commented Nov 12, 2025

Description

Type of Change

  • New feature (non-breaking change which adds functionality)

Why

The keyboardType prop is a standard React Native TextInput property that allows developers to specify which keyboard type to display (e.g., numeric, email, phone pad). This prop was already defined and parsed in Fabric's WindowsTextInputProps but was not being applied to the native component, creating a parity gap with Paper (XAML) implementation where it is fully functional.

Current Status:

  • Paper (XAML): Fully implemented with InputScope support
  • Fabric (Composition): Prop defined and parsed but NOT applied ← This PR fixes this

This change is part of the ongoing effort to achieve feature parity between Paper and Fabric architectures for TextInput components.

What

This PR implements proper handling of the keyboardType prop in Fabric's TextInput component:

Files Modified:

  1. WindowsTextInputComponentView.h

    • Added updateKeyboardType() method declaration
    • Added m_keyboardType member variable to store the keyboard type
  2. WindowsTextInputComponentView.cpp

    • Implemented updateKeyboardType() method to store the keyboard type value
    • Added keyboard type update logic in updateProps() to detect prop changes
    • Added keyboard type initialization in onMounted() for initial setup

Implementation Approach:
Since Fabric uses windowless RichEdit controls with TextServices (not XAML controls), and Windows.UI.Xaml.Input.InputScope is not available in Composition architecture, this implementation stores the keyboard type value to maintain the prop contract. The keyboard behavior is primarily handled by the system's Input Method Editor (IME).

Supported Keyboard Types:

  • Cross-platform: default, numeric, number-pad, decimal-pad, email-address, phone-pad, url
  • Windows-specific: web-search
  • Password mode: Handles different keyboard types when secureTextEntry is enabled

Screenshots

keyboardtype.mp4

Verify that:

  • The prop is properly stored and tracked
  • Changing the prop triggers updateKeyboardType()
  • No regressions in existing TextInput functionality

Changelog

Should this change be included in the release notes: Yes

Summary for release notes:
Added support for keyboardType prop in Fabric TextInput to achieve parity with Paper implementation. This standard React Native prop now properly handles keyboard type specification (numeric, email, phone, etc.) in Fabric architecture.

Microsoft Reviewers: Open in CodeFlow

@Nitin-100 Nitin-100 requested a review from a team as a code owner November 12, 2025 05:03
@Nitin-100 Nitin-100 requested a review from acoates-ms November 12, 2025 05:04
@Nitin-100 Nitin-100 force-pushed the nitin/parity-fabric/textinput-keyboardtype branch from 6b080f9 to 882dede Compare November 12, 2025 06:32
HCURSOR m_hcursor{nullptr};
std::chrono::steady_clock::time_point m_lastClickTime{};
std::vector<facebook::react::CompWindowsTextInputSubmitKeyEventsStruct> m_submitKeyEvents;
std::string m_keyboardType{};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be storing copies of props on the component. The value already exists in the prop object, lets not duplicate memory.

Copy link
Contributor

@acoates-ms acoates-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does nothing. It just duplicates the prop storage, and doesn't implement the functionality of this prop.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Nov 12, 2025
@Nitin-100
Copy link
Contributor Author

Nitin-100 commented Nov 13, 2025

This PR does nothing. It just duplicates the prop storage, and doesn't implement the functionality of this prop.

Yes, it is not complete and I was just trying to explore but windowless RichEdit controls do not support InputScope. This feature requires XAML controls (Paper architecture) or a future Windows platform API that supports windowless input scope hints.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 An issue that had been tagged "Needs: Author Feedback" has received activity (label applied by bot) and removed Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) labels Nov 13, 2025
@Nitin-100
Copy link
Contributor Author

Can't use TSF by using InputScope APIs (ITfContextOwner, ITfInputScope) but require a window handle (HWND), but Fabric is windowless.
I think we cannot implement it at all, partially we can restrict via filtering input like for numeric only keyboard and others, but not a good way.

@Nitin-100 Nitin-100 marked this pull request as draft November 13, 2025 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Attention 👋 An issue that had been tagged "Needs: Author Feedback" has received activity (label applied by bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants