uge*_*ang 5 react-native react-native-navigation react-native-popup-menu
是否可以使用"react-native-navigation"导航栏中的"react-native-popup-menu"设置三点上下文菜单?或者我们是否有任何其他方法在IOS和Android中使用"react-native-navigation"导航栏设置三点上下文菜单?
您可以使用属性控制每个按钮的优先级和位置(在 Android 上)showAsAction。请参阅文档了解更多详细信息。
简而言之,以下代码片段将在菜单中添加两个按钮,在菜单外部添加一个按钮:
static navigatorButtons = {
rightButtons: [
{
id: 'btn1',
title: 'Menu button 1'
showAsAction: 'never'
},
{
id: 'btn2',
title: 'Menu button 2'
showAsAction: 'never'
},
{
id: 'btn3',
title: 'Regular Button'
icon: require('./img/button.jpeg'),
showAsAction: 'always'
}
]
);
Run Code Online (Sandbox Code Playgroud)
这在 iOS 上不可用,因为在 iOS 上通常使用操作表而不是菜单。