I wonder how I can declare that the param ...props
inside my function declaration are of type BaseViewProps
in the following notation:
export interface BaseViewProps extends ScrollViewProps {
}
/**
* Underlying layout for all screens
*/
export function BaseView({ children, ...props }) {
return (
<SafeAreaView style={styles.mainContainer}>
<ScrollView
contentContainerStyle={styles.scrollContainer}
{...props}
>
<AppHeader/>
{children}
</ScrollView>
</SafeAreaView>
)
}
I have tried something like this:
export function BaseView({ children, ...props} = { any, BaseViewProps})
But then I get an error 'any' refers to a type but is used as a value here
.
Try:
export function BaseView({ children, ...props}: : { children: any, [key: string]: BaseViewProps })
=
is used for default value, not type
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.