mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-04 12:05:54 +03:00
added beneficiary remove method
This commit is contained in:
parent
97d55c57a7
commit
98436fe1f2
@ -22,6 +22,7 @@ interface BeneficiarySelectionContentProps {
|
|||||||
powerDown?: boolean;
|
powerDown?: boolean;
|
||||||
powerDownBeneficiaries?: Beneficiary[];
|
powerDownBeneficiaries?: Beneficiary[];
|
||||||
handleSaveBeneficiary?: (beneficiaries: Beneficiary[]) => void;
|
handleSaveBeneficiary?: (beneficiaries: Beneficiary[]) => void;
|
||||||
|
handleRemoveBeneficiary?: (beneficiary: Beneficiary) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BeneficiarySelectionContent = ({
|
const BeneficiarySelectionContent = ({
|
||||||
@ -30,6 +31,7 @@ const BeneficiarySelectionContent = ({
|
|||||||
powerDown,
|
powerDown,
|
||||||
powerDownBeneficiaries,
|
powerDownBeneficiaries,
|
||||||
handleSaveBeneficiary,
|
handleSaveBeneficiary,
|
||||||
|
handleRemoveBeneficiary,
|
||||||
}: BeneficiarySelectionContentProps) => {
|
}: BeneficiarySelectionContentProps) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@ -306,8 +308,13 @@ const BeneficiarySelectionContent = ({
|
|||||||
|
|
||||||
const _onRemovePress = () => {
|
const _onRemovePress = () => {
|
||||||
beneficiaries[0].weight = beneficiaries[0].weight + item.weight;
|
beneficiaries[0].weight = beneficiaries[0].weight + item.weight;
|
||||||
beneficiaries.splice(index, 1);
|
const removedBeneficiary = beneficiaries.splice(index, 1);
|
||||||
setBeneficiaries([...beneficiaries]);
|
setBeneficiaries([...beneficiaries]);
|
||||||
|
console.log('removedBeneficiary : ', removedBeneficiary);
|
||||||
|
if(handleRemoveBeneficiary){
|
||||||
|
handleRemoveBeneficiary(removedBeneficiary[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_saveBeneficiaries(beneficiaries);
|
_saveBeneficiaries(beneficiaries);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,6 +185,17 @@ class PowerDownView extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _handleRemoveBeneficiary = (beneficiary) => {
|
||||||
|
if (beneficiary) {
|
||||||
|
const beneficiaryAccount = {
|
||||||
|
username: beneficiary.account,
|
||||||
|
percent: beneficiary.weight / 100,
|
||||||
|
autoPowerUp: beneficiary.autoPowerUp,
|
||||||
|
};
|
||||||
|
this._removeDestinationAccount(beneficiaryAccount);
|
||||||
|
}
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<View style={styles.beneficiaryContainer}>
|
<View style={styles.beneficiaryContainer}>
|
||||||
<BeneficiarySelectionContent
|
<BeneficiarySelectionContent
|
||||||
@ -192,6 +203,7 @@ class PowerDownView extends Component {
|
|||||||
powerDown={true}
|
powerDown={true}
|
||||||
powerDownBeneficiaries={powerDownBeneficiaries}
|
powerDownBeneficiaries={powerDownBeneficiaries}
|
||||||
handleSaveBeneficiary={_handleSaveBeneficiary}
|
handleSaveBeneficiary={_handleSaveBeneficiary}
|
||||||
|
handleRemoveBeneficiary={_handleRemoveBeneficiary}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user