Skip to content

fix(fabric, textinput): enable spelling and grammer props - #2290

Merged
Saad Najmi (Saadnajmi) merged 7 commits into
microsoft:mainfrom
Saadnajmi:fabric/text-input-grammer
Dec 4, 2024
Merged

fix(fabric, textinput): enable spelling and grammer props#2290
Saad Najmi (Saadnajmi) merged 7 commits into
microsoft:mainfrom
Saadnajmi:fabric/text-input-grammer

Conversation

@Saadnajmi

@SaadnajmiSaad Najmi (Saadnajmi) commented Nov 21, 2024

Copy link
Copy Markdown
Collaborator

This is part of a series of PRs where we are cherry-picking fixes from #2117 to update our Fabric implementation on macOS.

Summary:

React Native macOS on the old architecture has some macOS specific props for toggling some of the built-in autocorrect / spell check / grammer check in text inputs. This change cherry-picks the changes to bring them to the new architecture.

I needed to make a couple of followup changes:

  • I needed to add the emitted events to the static view config. I think this is because when the commits were made, static view config validation wasn't enabled in React Native yet.
    -I changed the paper event types to direct events. These feel like they should be direct events, and now they are for both paper and fabric

Test Plan:

Testing...

Summary:
**Context**
- Port Paper TextInput api's to Fabric
https://www.internalfb.com/code/fbsource/[dab91113a70a2f967fa2996f4aca0f49a58aea17]/third-party/microsoft-fork-of-react-native/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.m?lines=440-444
**Change**
- Automatic spelling correction works on Fabric TextInput
Test Plan:
**Enable "Correct Spelling Automatically"**
|https://pxl.cl/3MFjJ|https://pxl.cl/3MFx6|
{F1146645411}
Reviewers: chpurrer, lefever, #rn-desktop
Reviewed By: chpurrer
Differential Revision: https://phabricator.intern.facebook.com/D51158136
Summary:
**Context**
- Port Paper TextInput api's to Fabric
https://www.internalfb.com/code/fbsource/[25297dddce1b]/third-party/microsoft-fork-of-react-native/react-native-macos/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm?lines=500-505
**Change**
- Automatic spell checking works on Fabric TextInput
Test Plan:
**Enable "Check Spelling While Typing"**
https://pxl.cl/3MG01
Reviewers: chpurrer, lefever, #rn-desktop
Reviewed By: chpurrer
Differential Revision: https://phabricator.intern.facebook.com/D51177294
Summary:
**Context**
- Port Paper TextInput api's to Fabric
https://www.internalfb.com/code/fbsource/[25297dddce1b]/third-party/microsoft-fork-of-react-native/react-native-macos/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm?lines=507-512
**Change**
- Automatic grammar checking works on Fabric TextInput
Test Plan:
Enable "Check Grammar With Spelling"
https://pxl.cl/3MWj6
{F1146663064}
Reviewers: chpurrer, lefever, #rn-desktop
Reviewed By: chpurrer
Differential Revision: https://phabricator.intern.facebook.com/D51179163
Summary: `BOOL` being a char type, when building with our current BUCK config we need to static cast it to `bool` in Obj-C++ files when assigning those to a `bool`.
Test Plan:
Build Zeratul with BUCK.
```
BUILDING: FINISHED IN 5m 13.7s (100%) 11302/11302 JOBS, 6/11302 UPDATED
BUILD SUCCEEDED
```
Reviewers: shawndempsey
Reviewed By: shawndempsey
Differential Revision: https://phabricator.intern.facebook.com/D51258122
@Saadnajmi
Saad Najmi (Saadnajmi) requested a review from a team as a code ownerNovember 21, 2024 03:40
@SaadnajmiSaad Najmi (Saadnajmi) changed the title fix(fabric, textinput): Enable grammer propsfix(fabric, textinput): enable autocorrect / spell check / grammer check propsNov 21, 2024
@SaadnajmiSaad Najmi (Saadnajmi) changed the title fix(fabric, textinput): enable autocorrect / spell check / grammer check propsfix(fabric, textinput): enable spelling and grammer propsNov 30, 2024

@tido64Tommy Nguyen (tido64) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should reconsider whether unsetting autocorrection means falling back to default user setting.

@Saadnajmi
Saad Najmi (Saadnajmi) merged commit fe7d532 into microsoft:mainDec 4, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Saadnajmi@tido64@shwanton