Say I have this wrapper component:
export class WrapperComponent extends React.Component {
constructor(props) {
super(props);
this.opacity = 1
this.editable = true
this.placeholder = ''
this.state = {
text: ''
}
}
makeInvisible() {
this.opacity = 0
this.editable = false
}
makeVisible() {
this.opacity = 1
this.editable = true
}
setPlaceHolder(placeHolder) {
this.placeHolder = placeholder
}
getText() {
return this.state.text
}
render() {
return (
<View style = {styles.horizontalView}>
{this.props.children}
<TextInput
placeholder = "day"
style={styles.textInput}
opacity = {this.opacity}
editable = {this.editable}
onChangeText = {(text) => {
this.setState({text: text })
}}
/>
</View>
)
}
}
And I have another class that uses the this WrapperComponent class like so:
export class ClassUsingWrapperComponent extends React.Component {
this.wrapper = new WrapperComponent()
this.wrapper.makeInvisible()
constructor(props) {
super(props);
}
render() {
return (
<WrapperComponent>
</WrapperComponent>
<WrapperComponent>
</WrapperComponent>
<WrapperComponent>
</WrapperComponent>
)
}
}
I have three WrapperComponents here but I just want to make one invisible while keeping the others visible. How would I distinguish which WrapperComponent gets invisible?
Thank you so much for your help.