loan order store not bad

This commit is contained in:
2025-07-08 11:42:33 +05:00
parent 7e6a0846dd
commit 381bd5fa32
3 changed files with 85 additions and 49 deletions

View File

@@ -4,7 +4,7 @@ import * as ImagePicker from 'expo-image-picker';
import { Ionicons } from '@expo/vector-icons';
import { COLORS } from '../constants/colors';
const ImageInput = ({ label, image, onChange }) => {
const ImageInput = ({ label, image, onChange, error = false }) => {
const [hasPermission, setHasPermission] = useState(null);
useEffect(() => {
@@ -22,25 +22,20 @@ const ImageInput = ({ label, image, onChange }) => {
const result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaType,
quality: 0.7,
base64: true,
quality: 0.8,
base64: false,
});
if (!result.canceled && result.assets && result.assets.length > 0) {
const asset = result.assets[0];
const fileObj = {
uri: asset.uri,
name: asset.fileName || `photo_${Date.now()}.jpg`,
type: asset.mimeType || 'image/jpeg',
};
onChange && onChange(fileObj);
onChange && onChange(asset.uri);
}
};
return (
<View style={styles.container}>
{label && <Text style={styles.label}>{label}</Text>}
<TouchableOpacity style={styles.box} activeOpacity={0.8} onPress={pickImage}>
<TouchableOpacity style={[styles.box, error && styles.error]} activeOpacity={0.8} onPress={pickImage}>
{image ? (
<Image source={{ uri: image.uri ? image.uri : image }} style={styles.preview} />
) : (
@@ -90,6 +85,9 @@ const styles = StyleSheet.create({
height: '100%',
borderRadius: 12,
},
error: {
borderColor: COLORS.error,
},
});
export default ImageInput;

View File

@@ -29,6 +29,7 @@ const SelectInput = ({
onValueChange,
placeholder = 'Select',
disabled = false,
error = false,
}) => {
const [modalVisible, setModalVisible] = useState(false);
@@ -53,7 +54,7 @@ const SelectInput = ({
<View style={styles.container}>
{label && <Text style={styles.label}>{label}</Text>}
<TouchableOpacity
style={[styles.selectBox, disabled && styles.disabled]}
style={[styles.selectBox, disabled && styles.disabled, error && styles.error]}
onPress={openModal}
activeOpacity={0.7}
>
@@ -128,6 +129,9 @@ const styles = StyleSheet.create({
backgroundColor: COLORS.gray[100],
opacity: 0.6,
},
error: {
borderColor: COLORS.error,
},
modalOverlay: {
flex: 1,
backgroundColor: 'rgba(0,0,0,0.3)',