I am using the new components library called (gluestack-ui).
I am using typescript and I want to use the "Box" component props types interface in my component.
I can't find, is the interface exported?
import { Box } from '@gluestack-ui/themed'
export interface PaperProps extends PropsWithChildren {}
export default function Paper({ children }: PaperProps) {
return <Box>{children}</Box>
}
In material-ui for example, you can:
import { Box, type BoxProps } from '@mui/material'
the I can for example:
export interface PaperProps extends PropsWithChildren & BoxProps {}
How can I do the same with gluestack-ui?
At present, it's still in Beta, so there might be changes in the near future.
Even though I am uncertain if that's the intended usage, you could employ it in the following manner for now. Since
Boxis essentiallyViewwith additional styling andButtonisPressablewith extra styling, you could utilize the nativereact-nativeProp Types for these components.There are a few more components like this, but unfortunately, I had to dig into the codebase since I couldn't find any documentation on this yet.
If it happens that there's no interface exported at all, you could always give
ComponentPropsa shot.Matt Pocock has written a great article about it. It's a great tool to have in your toolbox in general!