question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] Button that created TouchableOpacity not triggering first click

See original GitHub issue

Hi,

I create a button in modal and When my code like this below

_myFunc = () => {
/* code here */
}

<TouchableOpacity
 onPress={this._myFunc}
>
   <Text>test<Text>
</TouchableOpacity>

OnPress event not trigger on the first click and i have to click more than one.Any idea?

I have tried to use ToucheWithoutFeedback, TouchabeNativeFeedback and TouchableHighligth.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:13

github_iconTop GitHub Comments

3reactions
Razorholtcommented, Jun 29, 2020

Try and import from gesture handler instead of react-native: import { TouchableOpacity } from "react-native-gesture-handler";

2reactions
lukewlmscommented, Mar 12, 2021

I’m using these options now which are the only ones that work for me. Which TouchableOpacity to use has to be dependent on platform:

export const WorkingTouchableOpacity = isIOS
  ? TouchableOpacityRNGestureHandler
  : TouchableOpacityReactNative;
Read more comments on GitHub >

github_iconTop Results From Across the Web

React native TouchableOpacity onPress not working on Android
I had the same issue, all TouchableOpacity buttons were working fine in iOS build, but there was one in Android that did not...
Read more >
TouchableOpacity - React Native
A wrapper for making views respond properly to touches. On press down, the opacity of the wrapped view is decreased, dimming it.
Read more >
React Native touchable vs. pressable components
Here, we created three custom buttons by using the TouchableOpacity component as the base element. We can: Adjust the pressed opacity level with ......
Read more >
React native TouchableOpacity onPress not working on Android
Android : React native TouchableOpacity onPress not working on Android [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >
Buttons | React Native Gesture Handler - Software Mansion
function that gets triggered when button changes from inactive to active and vice versa. It passes active state as a boolean variable as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found