react native - TouchableOpacity swallow touch event and never pass -
i'm trying make both onpress
happened touchableopacity
, second 1 1 fires:
<touchableopacity onpress={() => console.warn('first button')}> <touchableopacity onpress={() => console.warn('second button')}> <text> press me </text> </touchableopacity> </touchableopacity>
how can make both of them fire?
thanks in advance!
you can fire both of them using 'ref' concept , calling props onpress.
<touchableopacity onpress={() => alertios.alert('firstbutton') } ref={component => this.myfirsttouchable = component} > <touchableopacity onpress={() => { alertios.alert('second') this.myfirsttouchable.props.onpress() } }> <text> press me </text> </touchableopacity> </touchableopacity>
Comments
Post a Comment