I had a similar error while I was creating a custom modal.
const CustomModal = (visible, modalText, modalHeader) => {}
Problem was that I didn't wrap my values to curly brackets like this.
const CustomModal = ({visible, modalText, modalHeader}) => {}
If you have multiple values to pass to the component, you should use curly brackets around it.