import React, {Component, PropTypes} from 'react'; import { Text, Image, View, ScrollView, TouchableOpacity, StyleSheet, Alert } from 'react-native'; import { connect } from 'react-redux'; import * as counterActions from '../reducers/counter/actions'; // this is a traditional React component connected to the redux store class SecondTabScreen extends Component { static navigatorStyle = { drawUnderNavBar: true, drawUnderTabBar: true, navBarTranslucent: true }; static propTypes = { str: PropTypes.string.isRequired, obj: PropTypes.object.isRequired, num: PropTypes.number.isRequired }; constructor(props) { super(props); this.buttonsCounter = 0; } render() { return ( Here Too: {this.props.counter.count} Increment Counter String prop: {this.props.str} Number prop: {this.props.num} Object prop: {this.props.obj.str} Array prop: {this.props.obj.arr[0].str} ); } onIncrementPress() { this.props.dispatch(counterActions.increment()); } } const styles = StyleSheet.create({ text: { textAlign: 'center', fontSize: 18, marginBottom: 10, marginTop:10, }, button: { textAlign: 'center', fontSize: 18, marginBottom: 10, marginTop:10, color: 'blue' } }); // which props do we want to inject, given the global state? function mapStateToProps(state) { return { counter: state.counter }; } export default connect(mapStateToProps)(SecondTabScreen);