I am new to React Native, been looking for an answer in google but could not find one. How can I add a cursor pointer to my View element with a nested TouchableOpacity element? I tried to use as property in stylesheet create method but got error that cursor in not a valid style property. Thank's in advance for any info.
Apply the CSS property cursor:pointer; to the elements. (This is the default style when a cursor hovers over a button.) Apply the CSS property cursor:url(pointer. png); using a custom graphic for your pointer.
The cursor property of CSS allows you to specify the type of cursor that should be displayed to the user. One good usage of this property is in using images for submit buttons on forms. By default, when a cursor hovers over a link, the cursor changes from a pointer to a hand.
The cursor is the mouse pointer, which is associated with the web browser and clicking links. Since React-Native is for mobile platforms, the typical situation is the user is tapping things with a finger, and so a 'cursor' or 'pointer' indicating the current mouse position is not necessary. The user just taps on the element.
I suggest using link styling, or button styling to indicate to the user that they can "click" specific text elements.
UPDATE
Web is now supported by react native, so just do
cursor: 'pointer'
For those using typescript
<View style={{
alignItems:'flex-end',
//@ts-ignore
cursor:'pointer'
}} >{text}</View>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With