Skip to main content

TouchableOpacity

TouchableOpacity is one of React Native core components but optimized to work on multiplatform environment.

Usage

import * as React from 'react';
import { App, Screen, Text, TouchableOpacity, StyleSheet } from '@flexn/create';

const MyComponent = () => {
return (
<App>
<Screen style={styles.container}>
<TouchableOpacity style={styles.button} onPress={() => console.log('Pressed')}>
<Text>Press me</Text>
</TouchableOpacity>
</Screen>
</App>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFFFFF',
},
button: {
marginHorizontal: 20,
borderWidth: 2,
borderRadius: 25,
borderColor: '#111111',
height: 50,
width: 200,
justifyContent: 'center',
alignItems: 'center',
},
});

export default MyComponent;

Props

Inherits all properties and functionality from React Native TouchableOpacity. Also sharing custom API with Pressable.