2016-08-02 9 views
0

ヘッダータグにラップされた小さな文字列を表示した作業用コンポーネントがあります。 は、が正しく表示されているため、私のインポート/エクスポートが正しく設定されていることがほぼ肯定的です。私がrender()メソッドに<Spring />コンポーネントを追加しようとすると、インバリアント違反の原因となるリアクションモーションスプリングコンポーネント

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of Animationと表示されます。

なぜ、<Spring>コンポーネントは、以前はすべてが正しく動作していたときにこれを引き起こしますか?以下の私のコード:

import React from 'react'; 
import { Spring } from 'react-motion'; 

class Animation extends React.Component { 
    constructor(props){ 
     super(props); 
    } 

    render() { 
    return (
     <Spring defaultValue={0} endValue={120}> 
     {val => { 
      let style = { 
      height: val, 
      position: 'absolute' 
      } 
      return <div style={style}><h1>Hi!</h1></div> 
     }} 
     </Spring> 
    ) 
    } 
} 

export default Animation; 

答えて

1

反応する動きは、もはや小道具やコンテキスト取るコンポーネントを反応させるのに使用されるSpring機能を公開されていない、代わりにあなたが使用することができます機能を持っMotionStaggeredMotion、そしてTransitionMotionspringに加えて、valueとconfigをとる関数(、小文字の ')。 Githubのreact-motionレポに関する最新のドキュメントを確認してください。

関連する問題