Good morning
I don't understand why my form is not showing in the emulator. Thank you to help me.
`import React, { useState } from 'react';
import { View, Text, TextInput, Button, StyleSheet, DatePickerAndroid } from 'react-native';
const AccountingForm = () => {
const [entryDate, setEntryDate] = useState(new Date());
const [entryAmount, setEntryAmount] = useState('');
const [entryComment, setEntryComment] = useState('');
const [exitAmount, setExitAmount] = useState('');
const [exitComment, setExitComment] = useState('');
const showDatePicker = async () => {
try {
const { action, year, month, day } = await DatePickerAndroid.open({
date: entryDate,
});
if (action !== DatePickerAndroid.dismissedAction) {
const newDate = new Date(year, month, day);
setEntryDate(newDate);
}
} catch ({ code, message }) {
console.warn('Cannot open date picker', message);
}
};
const onSubmit = () => {
console.log({
entryDate,
entryAmount,
entryComment,
exitAmount,
exitComment,
});
};
return (
Date:
Entre:
style={styles.input}
keyboardType="numeric"
value={entryAmount}
onChangeText={setEntryAmount}
/>
Commentaire de lentrée:
Sortie:
style={styles.input}
keyboardType="numeric"
value={exitAmount}
onChangeText={setExitAmount}
/>
Commentaire de la sortie:
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 16,
},
field: {
marginBottom: 16,
},
label: {
fontWeight: 'bold',
marginBottom: 8,
},
input: {
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 4,
paddingHorizontal: 8,
paddingVertical: 4,
},
});
export default AccountingForm;
`
`import React from 'react';
import { AppRegistry } from 'react-native';
import AccountingForm from './AccountingForm';
const App = () => (
);
AppRegistry.registerComponent('MyApp', () => App);
`

Top comments (0)