What is TouchableOpacity in React Native?
Using TouchableOpacity in React Native, 2-D touch event handlers can be attached to existing view elements such as buttons. This positioned element becomes a UI control that responds to touches in a similar way to the default button elements in iOS and Android apps.
touchableopacity as button in react native
By Live to Code
on Apr 25, 2020
//React Native Button element doesn't have style props and offers very
//few customization. Use TochableXXX elements instead.
//TouchableOpacity works fine
import {
TouchableOpacity,
Text,
} from "react-native";
<TouchableOpacity
style={styles.button}
onPress={this.onSubmit}
disabled={!this.state.isFormValid}
>
<Text style={styles.btnText}>Add
</Text>
</TouchableOpacity>
const styles = StyleSheet.create({
button: {
width: 200,
marginTop: 20,
backgroundColor: "green",
padding: 15,
borderRadius: 50,
},
btnText: {
color: "white",
fontSize: 20,
justifyContent: "center",
textAlign: "center",
},
});
1
touchableopacity
By Arvind Jitta
on Mar 27, 2021
<TouchableOpacity
style={styles.button}
onPress={onPress}
>
<Text>Press Here</Text>
</TouchableOpacity>
0
TouchableOpacity is an element that lets you to manipulate the opacity of a React Native element with respect to touch.
Javascript answers related to "touchableopacity"
View All Javascript queriesJavascript queries related to "touchableopacity"
Browse Other Code Languages
Abap ActionScript Assembly BASIC C C# C++ Clojure Cobol CSS Dart Delphi Elixir Erlang F# Fortran Go Groovy Haskell Html Java Javascript Julia Kotlin Lisp Lua Matlab Objective-C Pascal Perl PHP PostScript Prolog Python R Ruby Rust Scala Scheme Shell/Bash Smalltalk SQL Swift TypeScript VBA WebAssembly Whatever