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

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -