Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Selecting button in React Native ButtonGroup

$
0
0

I have a small problem. I'm using a ButtonGroup which previously worked with two options but now I am offering 4 options.

It renders correctly on the screen but I can only select the first two options. How can I jump between the selections so that I can select different buttons.

Any help is welcome!

<ButtonGroup        selectedIndex={this.state.test === "First" ? 0 : 1}        buttons={["First", "Second", "Third", "Fourth"]}        containerStyle={{ height: 50 }}        selectedButtonStyle={{ backgroundColor: "red" }}        selectedTextStyle={{ color: "white" }}        textStyle={{ fontSize: 18, fontWeight: '600' }}        onPress={(selectedIndex) =>           this.setState({          test: buttons[selectedIndex]        })}      />

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>