I have a child component that renders a button. When this button is pressed, I would like to animate the button, while simultaneously updating the state of the parent component so that it shows a different view.
How can these both be done from the one event? I thought to call a single function/method, but I am unsure how to update the parents state from within a method - I only know how to do this on an event listener in the render method.
Heres the child -
return (
        <View>
             <View style={styles.switch}>
                 <TouchableHighlight onPress={this.props.buttonClick}>
                    <Animated.View
                        style={{
                          marginLeft,
                          height: 30,
                          width: 40,
                          backgroundColor: 'red'}} />
                 </TouchableHighlight>
              </View>              
        </View> 
    );
  }
}
 
     
    