How to use the react-spring.config.gentle function in react-spring

To help you get started, we’ve selected a few react-spring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github madebymany / front-end-london / src / components / Search / SearchResults.js View on Github external
results.map(data => {
      const height = maxHeight[data.topic] || 0
      return {
        ...data,
        height,
        y: (totalHeight += height) - height,
      }
    }),
    item => item.topic,
    {
      unique: true,
      from: () => ({ height: 0, y: totalHeight }),
      leave: () => ({ height: 0, y: totalHeight }),
      enter: ({ y, height }) => ({ y, height }),
      update: ({ y, height }) => ({ y, height }),
      config: config.gentle,
      onDestroyed: item => {
        // Clear out removed Result's heights from state
        const updateHeights = { ...maxHeight }
        delete updateHeights[item.topic]
        setMaxHeights(updateHeights)
      },
    }
  )
  return (
    
      
        {transitions.map(({ item, key, props: { y, ...rest } }, index) => {
          return (
github arackaf / booklist / react / app / components / modal.tsx View on Github external
render() {
    let { isOpen, onHide, headerCaption, focusRef = null, style = { maxWidth: "600px" }, children } = this.props;
    return (
      
        {isOpen
          ? (styles: any) => (
              
                
                  {headerCaption ?  : null}
github pylnata / teddy / src / features / Intro / components / House / components / Spider.js View on Github external
export default ({ img }) => {
  const [toggleSpider, setToggleSpider] = useState(false);
  const propsLine = useSpring({
    from: { height: toggleSpider ? 50 : 0 },
    to: [{ height: toggleSpider ? 15 : 50 }],
    config: { ...config.gentle, duration: 2000 },
    delay: 1000,
    onRest: () => {
      setToggleSpider(state => !state);
    }
  });

  return (
    
      
      <img alt="spider" src="{img}">
    
  );
};