How to use the react-redux/native.connect function in react-redux

To help you get started, we’ve selected a few react-redux 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 este / este / src / containers / home.react.js View on Github external
import {toggleMenu} from '../app/actions';

// Components
import Header from '../components/header.react';

// Selectors
import {selectTranslations} from '../intl/selectors';

// Style
import * as style from '../app/app.style';

const mapStateToProps = state => ({
  msg: selectTranslations(state).home
});

@connect(mapStateToProps)
export default class Home extends PureComponent {

  static propTypes = {
    dispatch: React.PropTypes.func.isRequired,
    msg: React.PropTypes.object.isRequired
  }

  render() {
    const {
      dispatch,
      msg
    } = this.props;

    return (
github este / este / src / containers / app.react.js View on Github external
import appStyle from '../app/app.style';

// Actions
import {toggleStatusBar, toggleMenu} from '../app/actions';
import {selectLanguage} from '../intl/actions';

// Selectors
import {selectTranslations} from '../intl/selectors';

const mapStateToProps = state => ({
  settings: state.app,
  msg: selectTranslations(state),
  availableLanguages: state.intl.availableLanguages
});

@connect(mapStateToProps)
export default class App extends PureComponent {

  static propTypes = {
    availableLanguages: React.PropTypes.array.isRequired,
    dispatch: React.PropTypes.func.isRequired,
    msg: React.PropTypes.object.isRequired,
    settings: React.PropTypes.shape({
      isMenuOpened: React.PropTypes.bool,
      isStatusBarHidden: React.PropTypes.bool,
      statusBarStyle: React.PropTypes.string
    }).isRequired
  }

  componentWillMount() {
    const {settings} = this.props;
    StatusBarIOS.setHidden(settings.isStatusBarHidden, true);
github trusty-cd-rom / wormie / orig_client / src / containers / ViewMyWormhole.js View on Github external
import { connect } from 'react-redux/native';
import ViewMyWormhole from '../components/ViewMyWormhole';
import * as ProfileActions from '../actions/profile';

function mapStateToProps(state) {
  console.log('state:', state);
  return {
    myCurrentWormhole: state.profile.wormhole,
  };
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators(ProfileActions, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(ViewMyWormhole);
github este / este / src / lib / connect.js View on Github external
export default function mergeSelectors(...selectors) {
  const mapStateToProps = createSelector(selectors, (...output) => {
    return assign({}, ...output);
  });
  return connect(mapStateToProps);
}
github trusty-cd-rom / wormie / orig_client / src / containers / Profile.js View on Github external
return {
    currentUser: state.userProfile.currentUser,
    updateProfile: state.userProfile.updateProfile,
    submissions: state.userProfile.currentUser.submissions,
    wormholes: state.userProfile.currentUser.wormholes,
    myCurrentSubmission: state.profile.myCurrentSubmission,
    myCurrentWormhole: state.profile.myCurrentWormhole,
    myCurrentWormholeSubmissions: state.profile.myCurrentWormholeSubmissions,
  };
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators(ProfileActions, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(Profile);
github danscan / fractal / app / scenes / EditElementProp / index.js View on Github external
import { applyElementProp } from '../../actions/tree';
import { elementPropTypeByElementPathAndPropName, elementPropValueByElementPathAndPropName } from '../../selectors/tree';
import AddElementChild from './component';

const mapStateToProps = (state, ownProps) => ({
  propType: elementPropTypeByElementPathAndPropName(ownProps.elementPath, ownProps.propName)(state),
  propValue: elementPropValueByElementPathAndPropName(ownProps.elementPath, ownProps.propName)(state),
});

const actionCreators = (dispatch) => ({
  onPressApply: (elementPath, propName, propValue) => {
    return dispatch(applyElementProp(elementPath, propName, propValue));
  },
});

export default connect(mapStateToProps, actionCreators)(AddElementChild);
export { AddElementChild };
github LeoLeBras / react-native-redux-starter-kit / src / scripts / containers / SampleApp.jsx View on Github external
import React, { Component } from 'react-native';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux/native';
import * as LinkActions from "actions/SampleActions";
import Sample from 'Sample/index';

@connect(state => ({ samples: state.samples }))
export default class SampleApp extends Component{

    /**
     * Props
     *
     */
    static defaultProps = { }
    static propTypes = { }



    /**
     * Render
     *
     * @return JSX
     */
github limscoder / react-present / remote / containers / App.js View on Github external
props.startTimer();
  }

  render() {
    if (this.props.pairedState.isPaired) {
      return ;
    }
    if (this.props.pairedState.isConnected) {
      return ;
    }

    return ;
  }
};
App = connect(mapStateToProps, mapDispatchToProps)(App);

export default class AppContainer extends Component {
  render() {
    return (
      
        { () =>  }
      
    );
  }
}
github danscan / fractal / app / scenes / CreateElementChild / index.js View on Github external
import router from '../../router';
import AddElementChild from './component';

const mapStateToProps = () => ({});

const actionCreators = (dispatch) => ({
  addElementChild: (elementPath, childType) => {
    const childElement = elementByType(childType);

    dispatch(addElementChild(elementPath, childElement));

    return dispatch(replaceInspectorRoute(router.getElementRoute({ elementPath })));
  },
});

export default connect(mapStateToProps, actionCreators)(AddElementChild);
export { AddElementChild };