How to use the react-relay.PropTypes function in react-relay

To help you get started, we’ve selected a few react-relay 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 denvned / isomorphic-relay / src / IsomorphicRenderer.js View on Github external
return (
      
    );
  }
}

IsomorphicRenderer.propTypes = {
  Container: Relay.PropTypes.Container,
  forceFetch: React.PropTypes.bool,
  initialReadyState: React.PropTypes.shape({
    aborted: React.PropTypes.bool.isRequired,
    done: React.PropTypes.bool.isRequired,
    error: React.PropTypes.any,
    ready: React.PropTypes.bool.isRequired,
    stale: React.PropTypes.bool.isRequired,
  }),
  onReadyStateChange: React.PropTypes.func,
  queryConfig: Relay.PropTypes.QueryConfig.isRequired,
  environment: Relay.PropTypes.Environment,
  render: React.PropTypes.func,
  shouldFetch: React.PropTypes.bool,
};

IsomorphicRenderer.defaultProps = {
github denvned / isomorphic-relay-router / examples / todo / src / components / TodoList.js View on Github external
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

import MarkAllTodosMutation from '../mutations/MarkAllTodosMutation';
import Todo from './Todo';

import React from 'react';
import Relay from 'react-relay';

class TodoList extends React.Component {
  static contextTypes = {
    relay: Relay.PropTypes.Environment,
  };
  _handleMarkAllChange = (e) => {
    var complete = e.target.checked;
    this.context.relay.commitUpdate(
      new MarkAllTodosMutation({
        complete,
        todos: this.props.viewer.todos,
        viewer: this.props.viewer,
      })
    );
  };
  renderTodos() {
    return this.props.viewer.todos.edges.map(edge =>
github denvned / isomorphic-relay-router / examples / todo / src / components / Todo.js View on Github external
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

import ChangeTodoStatusMutation from '../mutations/ChangeTodoStatusMutation';
import RemoveTodoMutation from '../mutations/RemoveTodoMutation';
import RenameTodoMutation from '../mutations/RenameTodoMutation';
import TodoTextInput from './TodoTextInput';

import React from 'react';
import Relay from 'react-relay';
import classnames from 'classnames';

class Todo extends React.Component {
  static contextTypes = {
    relay: Relay.PropTypes.Environment,
  };
  state = {
    isEditing: false,
  };
  _handleCompleteChange = (e) => {
    var complete = e.target.checked;
    this.context.relay.commitUpdate(
      new ChangeTodoStatusMutation({
        complete,
        todo: this.props.todo,
        viewer: this.props.viewer,
      })
    );
  };
  _handleDestroyClick = () => {
    this._removeTodo();
github denvned / isomorphic-relay-router / examples / todo / src / components / TodoApp.js View on Github external
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

import AddTodoMutation from '../mutations/AddTodoMutation';
import TodoListFooter from './TodoListFooter';
import TodoTextInput from './TodoTextInput';

import React from 'react';
import Relay from 'react-relay';

class TodoApp extends React.Component {
  static contextTypes = {
    relay: Relay.PropTypes.Environment,
  };
  _handleTextInputSave = (text) => {
    this.context.relay.commitUpdate(
      new AddTodoMutation({text, viewer: this.props.viewer})
    );
  };
  render() {
    var hasTodos = this.props.viewer.totalCount > 0;
    return (
      <div>
        <section>
          <header>
            <h1>
              todos
            </h1>
            </header></section></div>
github denvned / isomorphic-relay-router / examples / todo / src / components / TodoListFooter.js View on Github external
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

import {IndexLink, Link} from 'react-router';
import RemoveCompletedTodosMutation from '../mutations/RemoveCompletedTodosMutation';

import React from 'react';
import Relay from 'react-relay';

class TodoListFooter extends React.Component {
  static contextTypes = {
    relay: Relay.PropTypes.Environment,
  };
  _handleRemoveCompletedTodosClick = () =&gt; {
    this.context.relay.commitUpdate(
      new RemoveCompletedTodosMutation({
        todos: this.props.viewer.todos,
        viewer: this.props.viewer,
      })
    );
  };
  render() {
    var numCompletedTodos = this.props.viewer.completedCount;
    var numRemainingTodos = this.props.viewer.totalCount - numCompletedTodos;
    return (
      <footer>
        <span>
          <strong>{numRemainingTodos}</strong> item{numRemainingTodos === 1 ? '' : 's'} left</span></footer>