/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
} from 'react-native';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { push } from '../BasicNavigator/actions';


type Props = {};
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

class JSComponentList extends Component<Props> {
  render() {
    console.log('MainPage', this.props);
    return (
      <View style={styles.container}>
        <TouchableOpacity onPress={() => { this.props.push('JSPage'); }}>
          <Text style={styles.instructions}>JSComponentList</Text>
        </TouchableOpacity>
      </View>
    );
  }
}


function actionMapping(dispatch) {
  return {
    push: compose(dispatch, push),
  };
}

export default connect(null, actionMapping)(JSComponentList);
