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.

Button onPress not working in android

See original GitHub issue

The onPress is not working on the android device. <> <StatusBar backgroundColor={theme.bgColor} barStyle={'dark-content'} /> <Button title="Schedule a Free Trial" onPress={() => {console.log('pressesd');}} /> </>

This is my complete code and it is working in ios device but it is not working in the android device. Can you please check it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
JaapWeijlandcommented, Dec 2, 2020

I just verified that this happens with:

<ListItem onPress={() => Alert.alert("Click!')} />

However, when debug mode turned off, it works perfectly fine. Note that my ListItem is placed inside a react-navigation@4 drawer. Since it is debugger-related I cannot create a snack for it.

0reactions
abrahamjsbcommented, Mar 9, 2021

Hello, thanks. Did you ran it on android device? still doesn’t change the text. Anyway I found the solution using the prop TouchableComponent and use TouchableOpacity from react-native-gesture-handler.

https://snack.expo.io/@abrahamjsb/bug-button-onpress

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native Button onPress not working - Stack Overflow
I'm trying to bind the function handleClick to my button onPress . But it's not working. When I refresh the page, I get...
Read more >
Button onPress not triggering in debug mode with Android ...
Button onPress will not trigger in debug mode on. I created a brand new project with the cli tool and got it to...
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 >
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
button, { backgroundColor: '#2277ee' }]} onPress={onTap} activeOpacity={0.6}> <Text>Blue button</Text> </TouchableOpacity> <TouchableOpacity ...
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