button component working, the design is not perfect

pull/3/head
Rayhân HASSOU 1 year ago
parent 836f4f2f13
commit c4baa57882

@ -1,24 +1,14 @@
import { StatusBar } from 'expo-status-bar'; import { StatusBar } from 'expo-status-bar';
import React from 'react'; import React from 'react';
import { StyleSheet, Text, View, Alert } from 'react-native'; import { StyleSheet, Text, View} from 'react-native';
import CustomButton from './components/CustomButton';
export default function App() { export default function App() {
const handleButtonPress = () => {
console.log("test 1");
};
const handleButtonPress2 = () => {
console.log("test 2");
};
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text>Ceci va etre la page qui charge le splashScreen</Text> <Text>Ceci va etre la page qui charge le splashScreen</Text>
<StatusBar style="auto" /> <StatusBar style="auto" />
<CustomButton title="Appuyez-moi" onPress={handleButtonPress} />
<CustomButton title="Autre test" onPress={handleButtonPress2} />
</View> </View>
); );
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

@ -1,32 +1,33 @@
import React from 'react'; import React from 'react';
import { Button, View } from 'react-native'; import {StyleSheet,Pressable, Text, Image} from 'react-native';
export default function CustomButton(props) { export default function CustomButton(props) {
return ( return (
<View style={styles.View}> <Pressable style={styles.button} >
<Button <Text style={styles.text}>{props.title}</Text>
title={props.title} </Pressable>
onPress={props.onPress}
/>
</View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
button: { button: {
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
paddingVertical: 12, paddingVertical: 12,
paddingHorizontal: 32, paddingHorizontal: 32,
borderRadius: 4, borderRadius: 4,
elevation: 3, elevation: 3,
backgroundColor: 'black', backgroundColor: 'rgba(0, 0, 0, 0.7)',
}, },
text: { text: {
fontSize: 16, width: '100%', // L'image prend toute la largeur du conteneur
lineHeight: 21, height: '100%',
fontWeight: 'bold', fontSize: 16,
letterSpacing: 0.25, lineHeight: 21,
color: 'white', fontWeight: 'bold',
}, letterSpacing: 0.25,
}); color: 'white',
},
});

@ -0,0 +1,4 @@
declare module "*.png";
declare module "*.svg";
declare module "*.jpeg";
declare module "*.jpg";

8744
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
{
"dependencies": {
"@eva-design/eva": "^2.2.0",
"@ui-kitten/components": "^5.3.1",
"react-native-svg": "^13.14.0"
}
}
Loading…
Cancel
Save