Sha256: fed6a47de0523a4adbc72dad9f69983b7c0bd0c04f01486eccd121a4114af361

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

import React from 'react';

import Scroller from './scroller';
import createPageComponent from '../create_page_component.jsx';

export default class PageContent extends React.Component {
  static childContextTypes = {
    pageScroller: React.PropTypes.object
  }

  getChildContext() {
    this._pageScroller = this._pageScroller || {
      disable: () => {
        this.refs.scroller.disable();
      },
      enable: () => {
        this.refs.scroller.enable();
      }
    };

    return {
      pageScroller: this._pageScroller,
    };
  }

  render() {
    return (
      <div className="content">
        <Scroller ref="scroller">
          <div className="contentWrapper">
            {this.props.children}
          </div>
        </Scroller>
      </div>
    );
  }

  pageWillActivate(options) {
    this.refs.scroller.resetPosition({position: options.position})
  }

  pageDidActivate() {
    this.refs.scroller.enable()
  }

  pageWillDeactivate() {
    this.refs.scroller.disable()
  }
};

export default createPageComponent(PageContent);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-react-0.1.1 js/src/components/page_content.jsx
pageflow-react-0.1.0 js/src/components/page_content.jsx