Skip to content

Commit

Permalink
Remove AutoFill from context menu when using contextMenuHidden (#43468
Browse files Browse the repository at this point in the history
)

Summary:
This pull request resolves the issue #43452
Previously, when utilizing `contextMenuHidden`, the context menu wasn't entirely hidden as the "AutoFill" option remained visible. However, it's now possible to eliminate it using the menu builder.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[IOS] [FIXED] - hide AutoFill from context menu when using `contextMenuHidden`

Pull Request resolved: #43468

Test Plan:
Manual tests in RNTester:

https://github.com/facebook/react-native/assets/39670088/dc0f828c-f613-412d-b560-f3b795dd3ffb

Reviewed By: javache

Differential Revision: D54902269

Pulled By: tdn120

fbshipit-source-id: e0f3d3b5a0817db1c072caf2f01648432c7d868d
  • Loading branch information
jakex7 authored and facebook-github-bot committed Apr 2, 2024
1 parent 3571f9a commit 493dbb2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Expand Up @@ -267,6 +267,16 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
return [super canPerformAction:action withSender:sender];
}

- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder
{
if (_contextMenuHidden) {
if (@available(iOS 17.0, *)) {
[builder removeMenuForIdentifier:UIMenuAutoFill];
}
}
[super buildMenuWithBuilder:builder];
}

#pragma mark - Dictation

- (void)dictationRecordingDidEnd
Expand Down
Expand Up @@ -142,6 +142,16 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
return [super canPerformAction:action withSender:sender];
}

- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder
{
if (_contextMenuHidden) {
if (@available(iOS 17.0, *)) {
[builder removeMenuForIdentifier:UIMenuAutoFill];
}
}
[super buildMenuWithBuilder:builder];
}

#pragma mark - Dictation

- (void)dictationRecordingDidEnd
Expand Down

0 comments on commit 493dbb2

Please sign in to comment.