GithubHelp home page GithubHelp logo

solidjs-community / solid-spring Goto Github PK

View Code? Open in Web Editor NEW
83.0 6.0 3.0 248 KB

Like react-spring, but for SolidJS.

License: MIT License

JavaScript 0.63% TypeScript 99.37%
solidjs animation spring react-spring

solid-spring's People

Contributors

aslemammad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

solid-spring's Issues

SSR - animated `Unrecoverable Hydration Mismatch` error

Hi!
Thank you for creating this lib!
I use this library with solid-start.
I created a page in the routes folder with

export default function Page() {
    return  <animated.div>
        test
    </animated.div>
}

But if I render it in SSR - I get warnings:

Unable to find DOM nodes for hydration key: 0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-1-0-0-0-0-0
Unable to find DOM nodes for hydration key: 0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-1-0-0-0-1
Unable to find DOM nodes for hydration key: 0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-1-0-0-1-0-0

And then the error

ErrorBoundary.tsx:27 Error: Unrecoverable Hydration Mismatch. No template for key: 0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-1-0-0-0-1
    at getNextElement (dev.js:250:26)
    at Object.fn (dev.js:590:43)
    at runComputation (dev.js:705:22)
    at updateComputation (dev.js:688:3)
    at Object.readSignal (dev.js:621:99)
    at resolveChildren (dev.js:972:82)
    at createMemo.name [as fn] (dev.js:587:33)
    at runComputation (dev.js:705:22)
    at updateComputation (dev.js:688:3)
    at createMemo (dev.js:244:10)

so I could not use it in SSR

You can reproduce it in any solid-start example with this page content.
For example:
https://github.com/solidjs/solid-start/tree/main/examples/bare
And replace https://github.com/solidjs/solid-start/blob/main/examples/bare/src/routes/index.tsx content with

export default function Page() {
    return  <animated.div>
        test
    </animated.div>
}

How to use with props?

The examples are all using const value, I'm not sure how to use it with props value? , eg:

const springs = createSpring({
   from: { x: props.x, y: props.y}
...

But then the animted.div doesn't get react anyway, any solution for this issue?

And here is my code snippet for using spring to show an dot animation on positions (passed by props.x, props.y):

function Dot(props) {
  const [local] = splitProps(props, ["x", "y"])

  const styles = createSpring({
    from: {
      x: local.x,
      y: local.y 
    },
    to: {
      x: local.x,
      y: local.y
    }
  })


  
  return (
    <>
      <animated.div
        style={{
          width: `20px`,
          height: `20px`,
          background: '#ff6d6d',
          "border-radius": '50%',
          ...styles()
        }}
      >
        <span>RID:{Math.random()}</span>
      </animated.div> 
    
    </>
  )
}

No documentation

This Repository has no documentation and the .start() update the state and .update() does nothing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.