|
|
@@ -102,8 +102,6 @@ export default function FullReduction() {
|
|
|
changeFllReduction(_fullReductions);
|
|
|
};
|
|
|
const delInfo = (info, index) => {
|
|
|
- console.log(info);
|
|
|
- console.log(index);
|
|
|
showDialog({
|
|
|
bodyText: removeTips,
|
|
|
status: "danger",
|
|
|
@@ -170,8 +168,8 @@ export default function FullReduction() {
|
|
|
}
|
|
|
const addFullReduction = () => {
|
|
|
const _fullReductions = [...fullReductions];
|
|
|
- const last = _fullReductions[_fullReductions.length - 1];
|
|
|
- if (last.id) {
|
|
|
+ const last = _fullReductions[_fullReductions.length - 1] || {};
|
|
|
+ if (_fullReductions.length === 0 || last.id) {
|
|
|
_fullReductions.push({
|
|
|
fullAmount: "",
|
|
|
minusAmount: "",
|
|
|
@@ -208,14 +206,14 @@ export default function FullReduction() {
|
|
|
);
|
|
|
|
|
|
const editItem = (info, index) => (
|
|
|
- <Layout style={styles.item}>
|
|
|
+ <Layout style={styles.item} key={index}>
|
|
|
<Layout style={[styles.text, styles.flexRow]}>
|
|
|
<Text>{fullReduction1}</Text>
|
|
|
<Input
|
|
|
size="small"
|
|
|
defaultValue={info.fullAmount.toString()}
|
|
|
style={styles.input}
|
|
|
- key={`${index}_0`}
|
|
|
+ key={`${index + 1}_0`}
|
|
|
keyboardType="numeric"
|
|
|
onChangeText={value => changeText(value, index, "full")}
|
|
|
/>
|
|
|
@@ -224,7 +222,7 @@ export default function FullReduction() {
|
|
|
size="small"
|
|
|
defaultValue={info.minusAmount.toString()}
|
|
|
style={styles.input}
|
|
|
- key={`${index}_1`}
|
|
|
+ key={`${index + 1}_1272`}
|
|
|
keyboardType="numeric"
|
|
|
onChangeText={value => changeText(value, index, "minus")}
|
|
|
/>
|
|
|
@@ -237,16 +235,15 @@ export default function FullReduction() {
|
|
|
>
|
|
|
{confirm}
|
|
|
</Button>
|
|
|
- {!!info.id && (
|
|
|
- <Button
|
|
|
- size="small"
|
|
|
- appearance="outline"
|
|
|
- style={styles.buttonlast}
|
|
|
- onPress={() => cancelInfo(info, index)}
|
|
|
- >
|
|
|
- {cancel}
|
|
|
- </Button>
|
|
|
- )}
|
|
|
+
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ appearance="outline"
|
|
|
+ style={styles.buttonlast}
|
|
|
+ onPress={() => cancelInfo(info, index)}
|
|
|
+ >
|
|
|
+ {cancel}
|
|
|
+ </Button>
|
|
|
</Layout>
|
|
|
);
|
|
|
|
|
|
@@ -267,7 +264,6 @@ export default function FullReduction() {
|
|
|
data={fullReductions}
|
|
|
renderItem={renderItem}
|
|
|
ListEmptyComponent={EmptyComponent}
|
|
|
- keyboardShouldPersistTaps="handled"
|
|
|
/>
|
|
|
</Layout>
|
|
|
<ActionButton
|