bluesky-social / bluesky-social/react-native-uitextview

[Question]: How can I disable context menu that pops up after selecting text?

Open
#18 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
418
Forks
44
Avg merge
2d 57m
Merged PRs (30d)
4

Description

I'm trying to render a custom Context menu above selection. Therefore I have to disable system's default context menu.

How can I modify Swift side codes to do so? I tried React-Native's solution which is like below but it didn't work.

```swift
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
return false
}

override func buildMenu(with builder: UIMenuBuilder) {
if #available(iOS 17.0, *) {
builder.remove(menu: .autoFill)
}
super.buildMenu(with: builder)
}
```

I Added this in `RNUITextView.swift` and `RNUITextViewChild.swift`. Can anyone tell me what am I missing?

Thanks in advance.

Contributor guide

Open the contributing guide

Research direction

Start by reading RNUITextView.swift and RNUITextViewChild.swift, then reproduce text selection and the system context menu on iOS. Trace where these views handle selection or menu actions and compare that with the attempted overrides in the issue. Done means the default context menu is disabled while text selection still works for the custom menu.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, swift
Domain
mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.