In this section of my parent component, I am invoking my child component AttachmentField.
configurableField.attachments.map((item, i) => {
if (item.type.includes("pdf")) {
const url = item.url.substring(item.url.indexOf(".com") + 4, item.url.indexOf(".pdf") + 4)
this.documentOrganizerService.getFile(url)
.then(async (res) => {
if (res.data.success) {
const buffer = Buffer.from(res.data.data.Body.data).toString('base64')
let uri = FileSystem.cacheDirectory + i.toString() + '.pdf'
await FileSystem.writeAsStringAsync(uri, buffer, { encoding: "base64" })
item.uri = uri
configurableField = {...configurableField}
}
})
}
})
return (
<AttachmentField
attachments={configurableField.attachments}
/>
);
}
Below is the extracted portion from my child component:
componentDidUpdate(prevProps: Readonly<IFormControlProps>, prevState: Readonly<IAttachmentState>): void {
console.log("check1", prevProps.attachments, this.props.attachments)
}
The componentDidUpdate method is not getting triggered, even though the field uri in configurableField.attachments is being updated. I can confirm this by observing the changes in the child component of AttachmentField where I have passed on these props and checked them in the componentDidMount function.
My goal is to monitor any changes in the props of the AttachmentField component and adjust accordingly.