fix: tampilan

Deskrispi:
- color input
- value length

No ISSues
This commit is contained in:
2025-07-02 16:49:34 +08:00
parent 32908e1362
commit b38d339a28
4 changed files with 11 additions and 9 deletions

View File

@@ -68,7 +68,7 @@ export function InputForm({ label, value, placeholder, onChange, info, disable,
value={value}
placeholder={placeholder}
keyboardType={type}
style={[Styles.inputRoundForm, error && { borderColor: "red" }, round && Styles.round30, { backgroundColor: bg && bg == 'white' ? 'white' : 'transparent' }]}
style={[Styles.inputRoundForm, error && { borderColor: "red" }, round && Styles.round30, { backgroundColor: bg && bg == 'white' ? 'white' : 'transparent' }, { color: 'black' }]}
onChangeText={onChange}
placeholderTextColor={'gray'}
/>

View File

@@ -44,7 +44,7 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
const response = await apiGetDivisionGroup({ user: hasil })
setData(response.data)
if (value.length > 0) {
if (value?.length > 0) {
const formatArray = value.reduce((result: any, obj: any) => {
result[obj.id] = obj.Division.map((item: any) => item.id);
return result;
@@ -84,7 +84,7 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
if (newChecked[groupId]) {
if (newChecked[groupId].includes(divisionId)) {
newChecked[groupId] = newChecked[groupId].filter(item => item !== divisionId);
if (newChecked[groupId].length === 0) {
if (newChecked[groupId]?.length === 0) {
delete newChecked[groupId];
}
} else {
@@ -102,7 +102,7 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
if (newChecked[groupId]) {
delete newChecked[groupId];
} else {
if (data.find((item: { id: string }) => item.id === groupId)?.Division.length == 0) {
if (data.find((item: { id: string }) => item.id === groupId)?.Division?.length == 0) {
return ToastAndroid.show('Tidak ada divisi', ToastAndroid.SHORT)
}
newChecked[groupId] = data.find((item: { id: string }) => item.id === groupId)?.Division.map((item: { id: any }) => item.id) || [];
@@ -174,9 +174,9 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
<Pressable style={[Styles.itemSelectModal]} onPress={() => { handleGroupCheck(item.id) }}>
<Text style={[Styles.textMediumSemiBold]}>{item.name}</Text>
{
checked[item.id] && checked[item.id].length === item.Division.length
checked[item.id] && checked[item.id]?.length === item.Division?.length
? <AntDesign name="check" size={20} />
: (checked[item.id] && checked[item.id].length > 0 && checked[item.id].length < item.Division.length)
: (checked[item.id] && checked[item.id]?.length > 0 && checked[item.id]?.length < item.Division?.length)
? <AntDesign name="minus" size={20} />
: <></>
}