Suppose your modal is stored separately in /components/MyModalto summarize things.
You can make your Modal call a function that you passed to the details every time the input text changes. Here you can use simple callback logic.
Avoid using links as much as possible.
import MyModal from '../components/MyModal';
...
class Home extends Component {
onInputChanged = (changedText) => {
console.log('This is the changed text: ', changedText);
}
render() {
return (
<View>
...
<MyModal onInputChanged={this.onInputChanged} .../>
</View>
)
}
}
// components folder
class MyModal extends Component {
render() {
return (
<Modal
visible = {this.props.visible}
animationType="slide"
transparent
onRequestClose={() => {}} >
<TextInput
style = {styles.inputBox}
onChangeText={(changedText) => this.props.onInputChanged(changedText)} />
</Modal>
)
}
}
: MyModal stateless, .