Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140762

How to disabled button after array filter response value in react native

$
0
0

Here in my code. IdentificationType is an array where all value is present. Now I have to disabled the below button CustomButton : condition if mandatory: true and uploadStatus: false.

I tried some code but its not working . Basically i have to disable my save & proceed button if condition is false .in IdentificationType array I am getting value . I have to loop and fin the value if (mandatory === true && value.uploadStatus === false) then button should be disabled else enabled

const {IdentificationType}= this.state;
IdentificationType (3) [{…}, {…}, {…}]
0:
idType: "POID"
name: "Proof Identity"
description: "Upload your identity proof"
mandatory: true
eligibleDocumentList: (3) [{…}, {…}, {…}]
__typename: "IdentificationTypes"
doctype: (3) [{…}, {…}, {…}]
selectValue: "passport"
issueDate: "25/02/2020"
expDate: "25/02/2020"
idNumber: ""
place: ""
image: ""
uploadStatus: false
displayThumbnail: false
fileName: ""
__proto__: Object
1: {idType: "addressProof", name: "Address Proof", description: "Upload your address proof", mandatory: false, eligibleDocumentList: Array(3), …}
2: {idType: "ageProof", name: "Age Proof", description: "Upload your age proof", mandatory: false, eligibleDocumentList: Array(3), …}
length: 3



 <View style={{ alignSelf: 'center', paddingTop: 20, position: 'absolute', bottom: 10, zIndex: 10 }}>
                    <CustomButton backgroundColor={parentStyle[appliedTheme] ? parentStyle[appliedTheme][appliedMode].primaryButtonColor : null}
                        width={deviceWidth - 30} label={'Save & Proceed'} height={60} labelFontSize={hp('2.5%')}
                        // disabled={this.isButtonDisabled()=== undefined?true:this.isButtonDisabled()}
                        disabled={this.state.IdentificationType.filter(value => {
                            value.mandatory === true && value.uploadStatus === false?true:false      

                        })}
                        onPress={() => this.nextStep()}>
                    </CustomButton>
                </View>

Viewing all articles
Browse latest Browse all 140762

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>