Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What kind a logic i need? #179

Open
Bayramito opened this issue Mar 13, 2020 · 1 comment
Open

What kind a logic i need? #179

Bayramito opened this issue Mar 13, 2020 · 1 comment

Comments

@Bayramito
Copy link

Bayramito commented Mar 13, 2020

Hello,

i have a flatlist, and each item on the list has a button that need to pop up a menu to do somethings...

so how should be the logic behind this, i mean i can't set the

component somehow...
What the problem is?
Well actually its not working correctly, for example if i click to another item's button to pop its menu without closing previous one, its bugging...
On the first 2 clicks its working fine, i mean, im clicking to item 1 for example, it shows the menu and if go and click to item 6 it closes to first one and toggles the 6th one, but if i go and click to another item nothing happens, its waiting to click and close the previous item which is 6th, then pops the new item...

Here is my component:

const PopUpMenu = props => {
  const {iconOptions, menuOptions} = props;
  const [open, setOpen] = useState(false);
  const {Popover} = renderers;
  BackButtonListener(open, () => setOpen(false));
  const onpress = () => {
    console.log(open);
    setOpen(true);
  };
  return (
    <Menu
      opened={open}
      onBackdropPress={() => setOpen(false)}
      renderer={Popover}
      rendererProps={{anchorStyle: {backgroundColor: colors.grey4}}}
      onSelect={value => alert(`Selected number: ${value}`)}>
      <MenuTrigger
        children={
          <IconButton
            style={iconOptions.style}
            name={iconOptions.name}
            color={iconOptions.color}
            size={iconOptions.size}
            onPress={() => onpress()}
          />
        }
      />
      <MenuOptions optionsContainerStyle={styles.options}>
        <MenuOption style={styles.option} value={1}>
          <Icon name="eye" color={colors.primary} size={15} />
          <Text style={styles.text}>Inspect User</Text>
        </MenuOption>
        <MenuOption style={styles.option} value={2}>
          <Icon name="user-slash" color={colors.warning} size={15} />
          <Text style={styles.text}>Block User</Text>
        </MenuOption>
        <MenuOption style={styles.option} value={3}>
          <Icon name="user-times" color={colors.error} size={15} />
          <Text style={styles.text}>Remove User</Text>
        </MenuOption>
      </MenuOptions>
    </Menu>
  );
};
@mehdihussain9
Copy link

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants