Skip to content

[typescript] How to type poor component with animated.div inside? #1796

Answered by joshuaellis
gormonn asked this question in Support
Discussion options

You must be logged in to vote

You can either use SpringValue or what I would probably use is SpringValues. I'm not familiar with what library you're using to enable the sx prop but beside that this is how I would approach it

type SpaceItemMarkProps = {
  springs: SpringValues<{
    opacity: number
  }>
}

export const SpaceItemMark = ({springs}: SpaceItemMarkProps) => (
  <animated.div
    sx={{
      display: 'flex',
      height: 52,
      width: 52,
      alignItems: 'center',
      justifyContent: 'flex-end',
      position: 'absolute',
      right: 24,
    }}
    style={
      springs
    }
  >
    <SvgIconSelectedProperty116X16 />
  </animated.div>
);

const App = () => {
  const springs = useSpring({
    opacity: 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gormonn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants