0
votes

I see that react-native has TextInput, ListView, MapView ..... I'm not asking where is the Button. I know I can download react-native-button from npm, but the lack of a "native" button in react-native makes me wonder if I'm approaching react-native the wrong way. Is there some other paradigm I should be using on react-native apps and NOT using a button is the way to go?

Should I just be using the onPress for a View with TouchableOpacity?

Still trying to wrap my head around how to think in react-native.

1

1 Answers

2
votes

The Touchable* components( TouchableOpacity/TouchableHighlight/TouchableWithoutFeedback) are React-Native's button It has all the properties a View has. You have either wrap a View inside a Touchable component or just simply substitute the View with a Touchable component

<View style={{height:48,width:200,backgroundColor:'blue'}} />

can just be made into a button by

<TouchableOpacity onPress={this.onPress} style={{height:48,width:200,backgroundColor:'blue'}} />