This app shows two cards using the CustomCard component. Each card has a title and description. The cards have simple styling and accessibility labels.
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
function CustomCard({ title, description }) {
return (
<View style={styles.card} accessible={true} accessibilityLabel={title}>
<Text style={styles.title}>{title}</Text>
<Text style={styles.description}>{description}</Text>
</View>
);
}
export default function App() {
return (
<View style={styles.container}>
<CustomCard title="Welcome" description="This is a custom card component." />
<CustomCard title="React Native" description="Build mobile apps with JavaScript." />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#f0f0f0'
},
card: {
backgroundColor: 'white',
padding: 16,
margin: 8,
borderRadius: 8,
width: 300,
shadowColor: '#000',
shadowOpacity: 0.1,
shadowRadius: 5,
shadowOffset: { width: 0, height: 2 },
elevation: 3
},
title: {
fontSize: 18,
fontWeight: 'bold',
marginBottom: 4
},
description: {
fontSize: 14,
color: '#555'
}
});