import React, { useState } from "react"; import { View, Text, TextInput, Image, TouchableOpacity, StyleSheet, ScrollView, Alert, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; const EditProfileScreen = () => { // State for profile fields const [profile, setProfile] = useState({ name: "Okta", email: "okta@example.com", phone: "08123456789", address: "Jl. Raya No. 123, Jakarta", }); // Function to handle input changes const handleInputChange = (field, value) => { setProfile({ ...profile, [field]: value, }); }; // Function to handle save button click with confirmation const handleSave = () => { Alert.alert( "Konfirmasi Edit Data", "Apakah Anda yakin ingin mengedit data pribadi?", [ { text: "Tidak", onPress: () => console.log("Edit cancelled"), style: "cancel", }, { text: "Yakin", onPress: () => { console.log("Data pribadi berhasil disimpan!"); // Implement save logic here (e.g., save to API or local storage) }, }, ], { cancelable: false } ); }; return ( {/* Header with Back Button */} console.log("Go back")} > Informasi Pribadi {/* Profile Picture Section */} Ubah Foto Profil {/* Input Fields for Profile Information */} handleInputChange("name", text)} /> handleInputChange("email", text)} /> handleInputChange("phone", text)} /> handleInputChange("address", text)} /> {/* Save Button */} Simpan ); }; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#f9f9f9", paddingHorizontal: 20, paddingTop: 30, }, header: { flexDirection: "row", // Align back button and title in one row alignItems: "center", marginBottom: 20, }, backButton: { marginRight: 10, }, title: { fontSize: 22, fontWeight: "bold", color: "#333", }, profileImageContainer: { alignItems: "center", marginBottom: 30, }, profileImage: { width: 100, height: 100, borderRadius: 50, marginBottom: 10, }, changeImageButton: { backgroundColor: "#dcdcdc", paddingVertical: 5, paddingHorizontal: 20, borderRadius: 5, }, changeImageText: { color: "#333", fontSize: 14, }, formSection: { marginBottom: 30, }, inputField: { backgroundColor: "#fff", padding: 15, borderRadius: 8, marginBottom: 15, fontSize: 16, borderColor: "#ddd", borderWidth: 1, }, saveButton: { backgroundColor: "#2D572C", // Green color paddingVertical: 12, borderRadius: 8, alignItems: "center", }, saveButtonText: { fontSize: 16, color: "#fff", fontWeight: "bold", }, logoutButtonText: { fontSize: 16, color: "#fff", fontWeight: "bold", }, }); export default EditProfileScreen;