import React, { useState } from 'react';
import { View, Text, TextInput, Button, StyleSheet } from 'react-native';
export default function PostDataScreen() {
const [message, setMessage] = useState('');
const [responseId, setResponseId] = useState(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const sendData = async () => {
// TODO: Implement POST request using fetch
};
return (
<View style={styles.container}>
<Text style={styles.title}>Post Data Screen</Text>
<Text>Message:</Text>
<TextInput
style={styles.input}
value={message}
onChangeText={setMessage}
placeholder="Type your message"
accessibilityLabel="Message input"
/>
<Button title={loading ? 'Sending...' : 'Send'} onPress={sendData} disabled={loading} accessibilityLabel="Send button" />
<Text style={styles.responseLabel}>Response:</Text>
<Text style={styles.responseText}>{responseId ? `ID: ${responseId}` : error ? `Error: ${error}` : ''}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: { padding: 20, flex: 1, backgroundColor: '#fff' },
title: { fontSize: 20, fontWeight: 'bold', marginBottom: 10 },
input: { borderWidth: 1, borderColor: '#ccc', padding: 8, marginVertical: 10, borderRadius: 4 },
responseLabel: { marginTop: 20, fontWeight: 'bold' },
responseText: { marginTop: 5, fontSize: 16 }
});