Created
June 10, 2018 11:54
-
-
Save kiok46/7e249bffdc0373984c0b647933c808a2 to your computer and use it in GitHub Desktop.
Redux, Reactotron, Actions, Reducers and Sagas (2)
This file contains 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
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