Questions tagged [touchablehighlight]
59 questions
53
votes
28 answers
React native TouchableOpacity onPress not working on Android
TouchabelOpacity works fine on iOS but the onPress method does not work on Android for me.
My react-native version: 0.57.4
My code:
const initDrawer = navigation => (
…

user3653164
- 979
- 1
- 8
- 24
31
votes
11 answers
Prevent Double tap in React native
How to prevent a user from tapping a button twice in React native?
i.e. A user must not be able tap twice quickly on a touchable highlight

gourav.singhal
- 373
- 1
- 3
- 7
15
votes
4 answers
React Native TouchableOpacity not updating styles
I have a strange issue with the TouchableOpacity component. I have a MainButton component which takes 2 props, item and disabled. Based on the the disabled prop I want my MainButton component to apply a different style. The problem is when the…

Zolve
- 514
- 5
- 13
6
votes
3 answers
How do I use React Native onLongPress properly?
I have a simple piece of code that's just a TouchableOpacity with a onLongPress prop, but it does not seem to be working.
{console.log("pressed")}} activeOpacity={0.6}>
…

Nerdragen
- 2,976
- 2
- 11
- 22
6
votes
0 answers
TouchableOpacity highlighting when scroll inside Flatlist
I have TouchableOpacity rendered inside the row item of Flatlist. I wanted to show a click effect when user click on the item. However, the click effect also triggered when user start scrolling. How can I disable the highlighting effect when user…

Zhen Jing Heng
- 109
- 2
- 8
6
votes
5 answers
react-native - TouchableHighlight: Remove highlighting after onPress?
I am developing a simple react-native app and am encountering an issue on TouchableHighlight:
When pressing the TouchableHighlight, a new screen is displayed (using StackNavigator from react-navigation). After pressing the back-button and returning…

Martin Bories
- 1,067
- 17
- 37
6
votes
1 answer
React Native prevent touch bubbling to parent elements
If I want to prevent the onPress event on the View component propagating to the parent Touchable for the following Sample component, what's the best option other than wrapping the child view in a Touchable please?
export default function Sample ():…

aprofromindia
- 1,111
- 1
- 13
- 27
6
votes
1 answer
React Native equivalent to mousedown
If I'm making a website, I can use a mousedown event to trigger something when the mouse button is pressed (and not yet released).
In React Native, I've got a TouchableHighlight and can register an onPress callback, but this only triggers when I…

Jack
- 2,153
- 5
- 28
- 43
5
votes
1 answer
Nested Touchables in React Native
I experience a problem, where double-touches (to simultaneous touches) within nested Touchables arrive at the parent Touchable instead.
In the example below, Touchables are nested three layers deep. When I press the deepest touchable (coloured…

sune
- 171
- 1
- 9
4
votes
1 answer
How to pass props from FlatList item to Modal?
I have implemented a View component containing a FlatList, which renders TouchableHighlights. Also I have implemented a Modal component, which I'd like to import at various places including the component that renders the FlatList.
I have already…

conste
- 390
- 1
- 4
- 16
4
votes
2 answers
How to make a TouchableOpacity or TouchableHighlight clickable on devices that support 3d touch (force touch)
I've got this code:
{console.log('hello')}>
…

SudoPlz
- 20,996
- 12
- 82
- 123
3
votes
1 answer
TouchableHighlight underlayColor not working. The color just does not change
I have a component with this:
this.bootEvent(item)}>

Giacomo M
- 4,450
- 7
- 28
- 57
3
votes
1 answer
React Native align icon left and text centered
I'm farily new to React Native, and I'm trying to do something very simple:
I want to create the following component:
A TouchableHighlight that has an image aligned to its left and text centered relative to the Touchable.
I've tried a bunch of…

Franch
- 621
- 4
- 9
- 22
3
votes
2 answers
react-native TouchableHighlight disable onPress color flickering
I want to disable the "color blink" or "color flickering" effect that blackens the image when TouchableHighlight gets pressed.
Here is the screen render:

Jacs
- 1,437
- 4
- 21
- 31
3
votes
2 answers
onPress error "is not a function" and "is undefined"
Taking my first baby steps towards learning Rect Native, and have been stuck with these errors for a while. When i click item:
I get these errors:
Here is my React Native code:
import React, { Component } from 'react';
import {
AppRegistry,
…

fransBernhard
- 362
- 2
- 7
- 24