Hey there, I'm currently working on a new app in React Native using TypeScript and TSX syntax. I have a question regarding defining a prop type function without resorting to using the "any" type. In JavaScript with PropTypes, I can define a prop type as "function", but I am unsure of how to achieve this in TypeScript.
import React from 'react'
import { View, StyleSheet, Text, Modal, TouchableOpacity } from 'react-native';
import { RNCamera } from 'react-native-camera';
interface propTypes {
isVisible : boolean,
scanCallback: any,
OnCloseModal: any
}
const ScannerModal = ({isVisible, scanCallback, OnCloseModal}: propTypes) => {
if (!isVisible) {
return null
}
const onBarCodeRead = (e : {data : string, type: string}) => {
scanCallback(e.data, e.type)
}
return (
.....
)
}