Can I disable a View component in react native? Can I disable a View component in react native? reactjs reactjs

Can I disable a View component in react native?


You can use pointerEvents:

<View pointerEvents="none">  ...</View>

This will make the view unresponsive to touch events.

You can use something like

<View pointerEvents={myCondition ? 'none' : 'auto'}>


Adding to Kerumen's answer, in some rare cases:

<View pointerEvents={myCondition ? 'none' : 'auto'}>  ...</View>

You might need to wrap it in an anonymous function:

<View pointerEvents={() => myCondition ? 'none' : 'auto'}>  ...</View>