Created
April 13, 2016 07:31
-
-
Save lesniakania/e7dad5e15d9686648f10b83fb4c59525 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict' | |
| import React from 'react-native'; | |
| import { connect } from 'react-redux/native'; | |
| import { fetchSubmissionsList } from '../action_creators/SubmissionsActionCreator'; | |
| import { Actions } from 'react-native-router-flux'; | |
| import ActionTypes from '../constants/ActionTypes'; | |
| import styles from '../styles/application'; | |
| let { | |
| ScrollView, | |
| View, | |
| Text, | |
| } = React; | |
| class SubmissionsContainer extends React.Component { | |
| componentDidMount() { | |
| this.props.dispatch(fetchSubmissionsList('pending')); | |
| } | |
| render() { | |
| let submissions = this.props.submissions.map((submission) => { | |
| return ( | |
| <View key={submission.id} style={styles.listItem}> | |
| <Text style={styles.listItemText}> | |
| {`${submission.first_name} ${submission.last_name}`} | |
| </Text> | |
| </View> | |
| ); | |
| }); | |
| return ( | |
| <ScrollView style={styles.list}> | |
| {submissions} | |
| </ScrollView> | |
| ) | |
| } | |
| }; | |
| function select(state) { | |
| let submissions = Object.keys(state.submissions) | |
| .map(k => state.submissions[k]); | |
| return { | |
| submissions: submissions | |
| } | |
| } | |
| export default connect(select)(SubmissionsContainer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment