I have a use case, where after a file upload I want to open lightbox wrapped inside <TouchableOpacity>
here is my code.
<TouchableOpacity style={{marginRight: ms(10), borderRadius: ms(10), overflow: 'hidden'}}>
<Lightbox>
<FastImage
style={{width: ms(75), height: ms(75), borderRadius: ms(10)}}
source={{uri: this.props.image.path}}
/>
</Lightbox>
</TouchableOpacity>
Lightbox does not have any event to trigger open programatically, here is the lighbox I am using https://github.com/oblador/react-native-lightbox
My only option seem to trigger TouchableOpacity.onPress programatically after file upload is done, tried using ref the following way.
TouchableOpacity ref={component => this.touchable = component} with this.touchable.props.onPress(); this gives me an error saying undefined is not an object, when I did console.log(this.touchable) I noticed it is not empty, however when I did console.log(this.touchable.props) it says undefined, perhaps syntax is changed which does not seem to be documented.
Is there any way to trigger onPress programatically?
Thanks.