question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to Iterate and create ActionButton.Items

See original GitHub issue

Trying to perform the following , but no success

  <ActionButton buttonColor="red" verticalOrientation="down" position="right" offsetX={10} offsetY={5} hideShadow={true}>
        <ActionButton.Item buttonColor='#9b59b6' title="All Offers" onPress={() => this.filterAdverts(0,"All Offers")}>
        <Icon name="md-create" style={styles.actionButtonIcon} />
        </ActionButton.Item>
        {
           allUserInterests.map((AUL, x) => {
             <ActionButton.Item
                key={x}
                buttonColor='#9b59b6' title={<Text>{AUL.interestName}</Text>}
                onPress={() => this.filterAdverts(AUL.interestID,AUL.interestName)}>
                <Icon name="md-create" style={styles.actionButtonIcon} />
            </ActionButton.Item>
          })
        }
        </ActionButton>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mauricioaraldicommented, Nov 15, 2018

I see. The problem is that I had the array.map AND an item. Like:

<ActionButton>
  array.map(
    //...
  )

  <ActionButton.Item>
    //...
  </ActionButton.Item>
</ActionButton>

If I left only the array.map, it works. Thanks for showing me this @DimitrisTzimikas

0reactions
mazenchamicommented, Dec 16, 2019

if you do all your logic prior to the return in render it works;

render = () => {
  let actionButtons = [];
  actionButtons.push(<ActionButton.Item key={'a'}>{...}</ActionButton.Item>);
  array.map(x =>
    actionButtons.push(<ActionButton.Item key={x.id}>{...}</ActionButton.Item>);
  )
  actionButtons.push(<ActionButton.Item key={'z'}>{...}</ActionButton.Item>);
  return (
      ...
      <ActionButton>
        {actionButtons}
      </ActionButton>
      ...
  );
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Action Button - Unable to Add buttons Dynamically
I have created a function that returns me views of these buttons. getDynamicBtns() { return dynamicButtonsList.map(item, key) => {( return < ...
Read more >
How to conditionally append a list using action buttons
... iterating through a list of lists using a 'yes' and 'no' action button. ... I want to be able to build a...
Read more >
Shiny series: Implementing a next and back button
Reviewing the exercise, I see that I need three UI elements: ... We use two functions here to set up the UI: actionButton()...
Read more >
Web Video / Action Button - TV Tropes
The videos are peppered with ruminations on core elements of the game in question, such as the gameplay loop and narrative, as well...
Read more >
Python "for" Loops (Definite Iteration)
Watch Now This tutorial has a related video course created by the Real Python team. ... This type of loop iterates over a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found