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.

Can't seem to use Button Group due to it allways selecting the first button from the group.

See original GitHub issue

So, I have a list of cards(like IDs) that can change through time, each card is a pdf. I have a menu that is supposed to have a button for each card, and upon clicking a button I navigate to a window that will load that pdf with react-native-pdf. My current problem is, my selectedIndex seems to not work at all. I got two possible problems, either it just comes as undefined, or it always selects the first button. My code for the selected index and button group is basically the same as the one in the webpage but I have this inside the button group.

<ButtonGroup
              onPress={() => {this.updateIndex;
                              this.props.navigation.navigate('Details', {
                              cardName: this.state.cardList[this.state.selectedIndex]})
                      }}
              selectedIndex={selectedIndex}
              buttons={buttons}
              containerStyle={{height: numberOfButtons, flexDirection: 'column'}}
            />

thanks in advance for any help

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
MatiasNcommented, Sep 5, 2019

I ended up finding what I was doing wrong, thanks a lot for your help though! Really appreciate it

0reactions
iRoachiecommented, Sep 5, 2019

Can you create an example on https://snack.expo.io that reproduces this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selecting only one button from button-group - Stack Overflow
Let's suppose we have got three buttons, the user should be able to select only one button, so if user selects "Apple" then...
Read more >
Radio Buttons are Synched Together. How do I fix this?
I like using the radio buttons because somehow they can only choose one ... Probably you created radio button who share the same...
Read more >
Hiding first radio button in a group but keeping it pre-selected
I have a radiobutton group on a regular screen (not a selection) screen. It has five radiobuttons: SV_PHASE0. SV_PHASE1. SV_PHASE2. SV_PHASE3. SV_PHASE4.
Read more >
Why can't I select objects in Word? - Microsoft Support
The Group button is unavailable. Only one shape or picture is selected. Make sure you have multiple shapes or pictures selected. You can't...
Read more >
Radio Buttons: Always Select One? - Nielsen Norman Group
In traditional application design, the first radio button in the list was always selected by default. But the unbridled world of website design ......
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