react native button
<Button
title="Press button"
onPress={() => {function}} //change "function" with your function for the button pressing
/>
react native button
<Button
title="Press button"
onPress={() => {function}} //change "function" with your function for the button pressing
/>
react native create button
import { Button } from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';
<View style={styles.buttonContainer}>
<Button title='update state' onPress={do something}/>
</View>
or
<Button
title="Solid Button"
/>
<Button
title="Outline button"
type="outline"
/>
<Button
title="Clear button"
type="clear"
/>
<Button
icon={
<Icon
name="arrow-right"
size={15}
color="white"
/>
}
title="Button with icon component"
/>
<Button
icon={{
name: "arrow-right",
size: 15,
color: "white"
}}
title="Button with icon object"
/>
<Button
icon={
<Icon
name="arrow-right"
size={15}
color="white"
/>
}
iconRight
title="Button with right icon"
/>
<Button
title="Loading button"
loading
/>
Source:
https://reactnativeelements.com/docs/button/
how to add a button to react native
import { Button } from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';
<Button
title="Solid Button"
/>
<Button
title="Outline button"
type="outline"
/>
<Button
title="Clear button"
type="clear"
/>
<Button
icon={
<Icon
name="arrow-right"
size={15}
color="white"
/>
}
title="Button with icon component"
/>
<Button
icon={{
name: "arrow-right",
size: 15,
color: "white"
}}
title="Button with icon object"
/>
<Button
icon={
<Icon
name="arrow-right"
size={15}
color="white"
/>
}
iconRight
title="Button with right icon"
/>
<Button
title="Loading button"
loading
/>
how to add button react native app.js
var tapSpeed = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Tap me as fast as you can!
</Text>
<View style={styles.button}>
!
</View>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFCCCC'
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10
},
button: {
textAlign: 'center',
color: '#ffffff',
marginBottom: 7,
border: 1px solid blue,
borderRadius: 2px
}
});
react native button
<Button
title="click me"
onPress={() => console.log("you clicked a button")}
/>
// <Button /> does not accept a style you can change its color but thats that.
// if you want a custom button you need to use <Pressable /> or any thing else-
//- the thing you want to press just need to have onPress on it.
<Text onPress={() => console.log("you pressed a text")}>click me</Text>
<Text onPress={() => function()}>click me</Text>
//function is your own function.
//if you want the thing you press on to chance so the user can see that they puched it.
//you can use the Touchable component.
//here we are using the TouchableOpactity where the opacity change when it is pressed.
<TouchableOpacity onPress={() => console.log("you pressed a touchableOpacty component")}>
<Text>click me</Text>
</TouchableOpacity>
<Pressable onPress={() => console.log("you pressed me")}><Text>click me</Text></Pressable>
//as you can see you can use a lot of thing as a button but if you use-
//-these you can style them as you want.
//rember you need to import Touchable and Pressable before you can use em.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us