How to increase the width of a button in React Native? | SoloLearn: Learn to code for FREE!

+3

How to increase the width of a button in React Native?

I am using flex for styling my buttons. Two buttons horizontally in a row at flex-end. I tried using width: value but it doesn't have any effect on their size. Their width is equal to the placeholder.

5/9/2020 7:38:28 AM

cmcodes

5 Answers

New Answer

+1

Resolved. Had to enclose the button in a view and style in that view.

+3

Try using touchableopacity. I guess buttons have really limited customization of styling I React native. But using touchableopacity you can create your own design of button, also it has onPress prop supported so it can work like a button. How to import: import { Text, TouchableOpacity } from 'react-native'; How to use: <TouchableOpacity onPress={pressHandler} style={styles.btn}> <Text>Click me</Text> </TouchableOpacity>

+2

https://stackoverflow.com/questions/61753837/width-of-buttons-not-changing-in-react-native

+1

cmcodes let me see your code or component please. I can't figure out without seeing source code.

0

Already tried. No useful. Moreover, it disappears the buttons.