React Native 中的选择/编辑菜单 [英] Selection/Edit menu in React Native

查看:56
本文介绍了React Native 中的选择/编辑菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS 中,可以配置选择和编辑菜单.看起来像这样:

In iOS it's possible to configure a Selection and Edit Menu. That looks like this:

此外,API 显示在此处:https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/AddingCustomEditMenuItems/AddingCustomEditMenuItems.html

Also, the API is displayed here: https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/AddingCustomEditMenuItems/AddingCustomEditMenuItems.html

这在 React Native 上可行吗?我正在构建一个聊天应用程序,我们需要允许复制消息和自定义菜单项.

So is this possible on React Native? I am building a chat app where we need to allow copying messages and also custom menu items.

推荐答案

在 iOS 上,自定义编辑菜单是通过 UIMenuController 实现的.但是,如果我们查看 react-native 存储库,可以在 RCTTextView 类.

On iOS, customising the edit menu is achieved through UIMenuController. However if we look at the react-native repo the only occurrence of that class (until today) can be found in the RCTTextView class.

如果你想将它用于其他组件,你必须自己桥接.

If you want to use it for other components you'll have to bridge it yourself.

存在一些第三方库.

这篇关于React Native 中的选择/编辑菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆