+ 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.

9th May 2020, 7:38 AM
cmcodes
cmcodes - avatar
5 Answers
+ 1
Resolved. Had to enclose the button in a view and style in that view.
12th May 2020, 3:19 PM
cmcodes
cmcodes - avatar
+ 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>
9th May 2020, 7:47 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
cmcodes let me see your code or component please. I can't figure out without seeing source code.
10th May 2020, 7:47 AM
Raj Chhatrala
Raj Chhatrala - avatar
0
Already tried. No useful. Moreover, it disappears the buttons.
9th May 2020, 10:56 AM
cmcodes
cmcodes - avatar