I am passing data from a child component to its parent via a prop which is assigned to a button.
Code below:
Parent component
const Parent:React.FC<Props> = (props) =>{return (<View> <LocationPicker onSelect={(e,region)=>handleConfirm(region)} /> </View> )}
Child component:
interface LocationPickerProps { onSelect:(event:GestureResponderEvent,region: Region)=>void;}export const LocationPicker: React.FC<LocationPickerProps> = ({onSelect}) => { const region:Region = {...} return(<LargeButton onPress={(e)=>onSelect(e,region)}>SELECT LOCATION</LargeButton> )}
The error I get is TypeError: onSelect is not a function. (In 'onSelect(e, region)', 'onSelect' is undefined)
What am I doing wrong?