tuto-react-native-expo/app/home.tsx

44 lines
863 B
TypeScript
Raw Normal View History

import { useState } from 'react';
import { Text, TextInput, View } from 'react-native';
export default function Home() {
const users = [
"alice",
"bob",
"charlie"
]
const variable = true;
const [nom, setNom] = useState('');
return (
<View style={{ flex: 1, padding: 16, gap: 12 }}>
{variable && <Text>Test</Text>}
{variable ? <Text>Vrai</Text> : <Text>Faux</Text>}
{users.map(user => {
return <Text key={user}>{user}</Text>
})}
<View style={{ height: 1, borderWidth: 1 }} />
<Text style={{ fontSize: 18, fontWeight: '600' }}>
Saisie + bouton "Valider"
</Text>
<Text>Valeur validée : {nom || '(vide)'}</Text>
<TextInput
value={nom}
onChangeText={setNom}
placeholder="Taper un nom "
style={{ borderWidth: 1, padding: 12, borderRadius: 10 }}
autoCapitalize="none"
/>
</View>
);
}