import React, { useState } from "react"; import { View, Text, StyleSheet, Alert, ActivityIndicator, ScrollView, KeyboardAvoidingView, Platform, SafeAreaView, } from "react-native"; import * as Keychain from "react-native-keychain"; import { CustomInput, CustomButton } from "../../components/common/Custom"; import colors from "../../components/colors"; const BecomeOrg = () => { const [bankAccountNumber, setBankAccountNumber] = useState(""); const [bankName, setBankName] = useState(""); const [branchCode, setBranchCode] = useState(""); const [loading, setLoading] = useState(false); const handleSubmit = async () => { if (!bankAccountNumber || !bankName || !branchCode) { Alert.alert("Error", "Please fill all fields"); return; } try { setLoading(true); const credentials = await Keychain.getGenericPassword(); if (!credentials) { Alert.alert("Error", "You are not logged in"); return; } const token = credentials.password; const response = await fetch( "https://api.godemo.in/FundCollect/api/organizer/registration/apply", { method: "POST", headers: { Accept: "*/*", "Content-Type": "application/json", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ bankAccountNumber, bankName, branchCode, }), } ); const result = await response.json(); if (result.status === "success") { Alert.alert("Success", "Organizer registration applied successfully"); setBankAccountNumber(""); setBankName(""); setBranchCode(""); } else { Alert.alert("Error", result.message || "Failed to apply"); } } catch (error) { console.error("❌ Registration error:", error); Alert.alert("Error", "Something went wrong"); } finally { setLoading(false); } }; return ( Organizer Registration {loading && ( )} ); }; export default BecomeOrg; const styles = StyleSheet.create({ container: { flexGrow: 1, padding: 20, justifyContent: "center", }, title: { fontSize: 22, fontWeight: "700", marginBottom: 20, textAlign: "center", color: colors.textDark, }, });