Skip to content

how to optionally hide an item? #239

Open
@shie-erlich

Description

@shie-erlich

my setup requires certain ActionButton.Items to be shown or not, depending on context.
i tried to use renderIf (https://github.com/ajwhite/render-if) which works as long as it's rendering, but results in an exception if it doesn't render ("null is not an object" while evaluating ActionButton.props).

any thoughts?

code:

<ActionButton buttonColor="blue">
          <ActionButton.Item buttonColor='#9b59b6' title="Edit" onPress={() => {}}>
            <Icon name="edit" style={styles.actionButtonIcon} />
          </ActionButton.Item>
          {renderIf(memory.names.length + memory.emails.length > 0) (() => (
            <ActionButton.Item buttonColor='#3498db' title="Do Something Else" onPress={() => {}}>
              <Icon name="" style={styles.actionButtonIcon} />
            </ActionButton.Item>
          ))}
          <ActionButton.Item buttonColor='red' title="Delete" onPress={() => {}}>
            <Icon name="delete" style={styles.actionButtonIcon} />
          </ActionButton.Item>
        </ActionButton>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions