Skip to content

Instantly share code, notes, and snippets.

@kiok46
Created June 10, 2018 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiok46/7e249bffdc0373984c0b647933c808a2 to your computer and use it in GitHub Desktop.
Save kiok46/7e249bffdc0373984c0b647933c808a2 to your computer and use it in GitHub Desktop.
Redux, Reactotron, Actions, Reducers and Sagas (2)
import React, { Component } from 'react';
import { AppRegistry, TextInput, View } from 'react-native';
import { connect } from 'react-redux';
import * as actions from '../redux/actions';
class CustomTextInput extends Component {
onTextChange = text => {
this.props.textChanged(text);
};
render() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<TextInput
onChangeText={text => this.onTextChange(text)}
placeholder="Search"
value={this.props.text}
style={{ height: 80, width: 200, fontSize: 30 }}
/>
</View>
);
}
}
const mapStateToProps = state => {
return {
text: state.TextReducer.text
};
};
export default connect(mapStateToProps, actions)(CustomTextInput);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment