Closed PaulTondeur closed 1 year ago
You could make your own wrapper if you want:
import { MotiView as View } from 'moti'
import { Sx, useSx } from 'dripsy'
type Props = Omit<React.ComponentProps<typeof MotiView>, 'animate'> & {
animate?: Sx
}
export function MotiView(props: Props) {
const sx = useSx()
return <View {...props} animate={props.animate && sx(props.animate)} />
}
I generally recommend wrapping all third-party components for design systems anyway.
I don't think I plan to implement this on the library end.
It would be great if the
styled
function could be used to not only add thesx
prop to components, but also set other props that rely on the dripsy theme.For example: I'm using
dripsy
together withmoti
and would like to be able to use tokens in theanimate
prop.In order to achieve this, I now use the following (pseudo) code:
Instead I'd like to simply be able to:
In terms of the API, something like the following would be great:
export const MotiView = styled(moti.MotiView, ["animate"])({});
Is this already possible? If not, I'd like to request this as a feature :-)
Thanks so much!