ここからコードはdemo0-githubからの簡単な移行です。 Link どのようにコンテンツを移動div要素に追加しますか? フライアウトメニューを実行するためにこのバリエーションを使用したいと考えていましたが、内部のコンテンツを取得する方法を見つけることができませんでした。 おかげリアクションモーションdivのネスト
import React from 'react';
import {Motion, spring} from '../../src/react-motion';
const Demo = React.createClass({
getInitialState() {
return {open: false};
},
handleMouseDown() {
this.setState({open: !this.state.open});
},
handleTouchStart(e) {
e.preventDefault();
this.handleMouseDown();
},
render() {
return (
<div>
<button
onMouseDown={this.handleMouseDown}
onTouchStart={this.handleTouchStart}>
Toggle
</button>
<Motion style={{x: spring(this.state.open ? 400 : 0)}}>
{({x}) =>
// children is a callback which should accept the current value of
// `style`
<div className="demo0">
<div className="demo0-block" style={{
WebkitTransform: `translate3d(${x}px, 0, 0)`,
transform: `translate3d(${x}px, 0, 0)`,
}} />
</div>
}
</Motion>
</div>
);
},
});
export default Demo;
私はdemo0-blockに入れません。それは一番上の別の部門です。私は他の要素を入れ子にして動きを継承するように飛び跳ねていました。 – JGC