microsoft / react-native-macos

A framework for building native macOS apps with React.
https://microsoft.github.io/react-native-windows/
MIT License
3.56k stars 137 forks source link

enableClearButton prop is not applied to TextInput #448

Closed tom-un closed 1 year ago

tom-un commented 4 years ago

Issue

On iOS the enableClearButton prop on TextInput shows an ⓧ. On macOS it is not implemented.

This will not be entirely trivial to implement on macOS. The NSTextField has no built-in support for icons on the left or right. There is the NSSearchField

Screen Shot 2020-06-11 at 3 22 22 PM

but it has no affordance to modify the left icon.

To get a cancel button in the RCTUITextField (the NSTextField subclass for single line TextInput) we would have to make an implementation similar to NSSearchField and add sub NSCell's to be the clear button. At the same time, we could add a new macOS specific prop to add a left-hand image also using an NSCell.

Steps to Reproduce

In RNTester go to the TextInput Example "Clear button mode" example.

iOS:

Screen Shot 2020-06-11 at 3 19 22 PM

macOS:

Screen Shot 2020-06-11 at 3 20 45 PM
Simek commented 2 years ago

Hmm, it looks like this "somewhat" works for me in 0.64 release using iOS clearButtonMode prop.

The "X" appears but not on every interaction it clears the input. It also appear that button re-activation after interaction could be quite a slow process in some cases:

Kapture 2021-12-13 at 23 08 18

This is a bit weird, but it looks like that pressing on the right side of the icon increase the chance for the successful clear.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.