Skip to content

Commit 7a0135d

Browse files
kubafloPureWeen
authored andcommitted
Improved Unfocus support for Picker on Mac Catalyst (#33127)
# PR Changes - MacCatalyst Picker Improvements Fixes #30897 Fixes #30891 ## Overview Improved MacCatalyst Picker implementation with proper focus management ## Changes Made ### 1. **PickerHandler.iOS.cs** - MacCatalyst-specific improvements #### Added UIAlertController instance field - Declared `UIAlertController? pickerController` as an instance field to enable proper dismissal via `Unfocus` command - Allows external code to programmatically close the picker dialog #### Improved picker dismiss logic - Moved picker dismiss logic from event handler to the "Done" button action - Removed `EditingDidEnd` event handler that was causing duplicate dismiss calls - Simplified focus state management by handling it directly in the Done action #### Added MapUnfocus command handler - Implemented `MapUnfocus` method for MacCatalyst to programmatically dismiss the picker - Properly updates `IsFocused` and `IsOpen` states when dismissed - Includes null checks for safety ### 2. **PickerHandler.cs** - Command mapper registration #### Registered Unfocus command for MacCatalyst - Added `#elif MACCATALYST` section to CommandMapper - Registered `nameof(IPicker.Unfocus)` command to enable programmatic picker dismissal on MacCatalyst - Brings MacCatalyst picker behavior in line with Android implementation ## Testing Issue2339 ## Platforms Affected - **MacCatalyst** (primary) - iOS (no behavior changes, shared code) ## Breaking Changes None - this is purely an implementation improvement with no API changes.
1 parent df57e97 commit 7a0135d

File tree

3 files changed

+466
-21
lines changed

3 files changed

+466
-21
lines changed

0 commit comments

Comments
 (0)