-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Add ability to toggle selector actions on and off when an input field is long clicked #498
Conversation
SelectAll, | ||
Share | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If more actions are needed to be available, this enum can be edited in the future.
} | ||
|
||
class UITextFieldWrapper : UITextField | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CanPerform
does not work unless UITextField
is subclassed; hence the wrapper.
if (e.OldElement != null) | ||
{ | ||
UnregisterEvents(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On each platform, we're checking old element, setting _noCaretField
(down below), and implementing dispose for consistency.
return config; | ||
} | ||
|
||
public static IPlatformElementConfiguration<iOS, FormsElement> EnableDisabledSelectorActions(this IPlatformElementConfiguration<iOS, FormsElement> config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just key on them setting/disabling the actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I'm misunderstanding you, but SelectorAction.All
should disable all actions. This would be the default behavior of this method if the list is empty. If it is not empty, it doesn't change anything. Do you mean I should add all actions to the list when this method is called?
We really like the ideas expressed in this PR, unfortunately we also feel it belongs in a community driven effect library which is not currently possible to make due to the need to override methods on a UIKit object. Therefor we are looking into options to make this possible so that we can avoid having every edge case PlatformSpecific end up in core and instead allow them to become independent nugets which can move and change (and break compat) much more freely. |
Description of Change
There is no way on iOS to disable selector actions when an input field is long clicked. This functionality may be needed in cases such as when preventing users from editing a password entry via the clipboard. I wanted to implement the same behavior on Android, but AppCompat seems to be ignoring all efforts. For now, it's left for another time.
This feature is currently implemented for
Entry
,Picker
,TimePicker
, andDatePicker
.Bugs Fixed
API Changes
Added:
SelectorAction
enumPR Checklist