简体   繁体   English

无法取消菜单选择 IOS - React Native

[英]Can't dismiss menu selection IOS - React Native

I have an issue with the react-native-selection-menu: https://github.com/prscX/react-native-selection-menu我对 react-native-selection-menu 有疑问: https ://github.com/prscX/react-native-selection-menu

On IOS it's impossible to dismiss the menu without clicking on a value.在 IOS 上,不单击某个值就无法关闭菜单。 I want to dismiss it when the user click outside of it or at least add a button cancel.当用户在其外部单击或至少添加一个取消按钮时,我想将其关闭。 By the way it works well on Android.顺便说一句,它在 Android 上运行良好。

It seems this component doesn't take a props like isVisible so I can't dismiss it with a change in the state.似乎这个组件没有像 isVisible 这样的道具,所以我不能通过改变状态来关闭它。

There is my code:有我的代码:

onPress(props) {
    RNSelectionMenu.Show({
      values: ['One', 'Two', 'Three', 'Four', 'Five'],
      selectedValues: [],
      selectionType: 0,
      title: 'Browse by category',
      presentationType: 0,
      enableSearch: false,
      cancellable: true,
      onSelection: selectedValues => {
        console.log('Selected Values: ' + selectedValues);
      },
      isVisible: false,
      // searchTintColor: "#FFFFFF",
    });
  }

Any help will be appreciated:) Thanks!任何帮助将不胜感激:)谢谢!

try this:试试这个:

RNSelectionMenu.Show({
      values: [
        "One",
        "Two",
        "Three",
        "Four",
        "Five"
      ],
      selectedValues: ["One", "Two"],
      selectionType: 1,
      presentationType: 0,
      enableSearch: false,
      onSelection: selectedValues => {
        console.log("Selected Values: " + selectedValues);
      },
      ...props
    });

I am wondering if you forgot to pass a props我想知道你是否忘记传递道具

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM