React-native: onPress works only on debugging mode!

Created on 24 May 2019  路  6Comments  路  Source: facebook/react-native

I've got an issue, The whole app i am building is only working on debugging mode, all the buttons and components that has onPress not firing any event if i am not opening remote debugger, also its not working on the production for both android and iOS

React Native version:
Environment:
OS: macOS 10.14.4
Node: 10.15.3
Yarn: 1.10.0
npm: 6.4.1
Watchman: 4.9.0
Xcode: Xcode 10.2.1 Build version 10E1001
Android Studio: 3.2 AI-181.5540.7.32.5014246

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

Steps To Reproduce

  1. Run the app when Remote debugging mode is ON everything is working perfectly
  2. Run the app when remote debugging mode is OFF nothing firing events, everything is not working except scrolling

Snack, code example, or link to a repository:
Code Example:
<TouchableOpacity style={styles.touchable} onPress={() => console.log('Pressed!!')} > <Text> Press Me </Text> </TouchableOpacity>

Bug Locked

Most helpful comment

@react-native-bot
I did update React native and it still freezing, i wonder why i am replying to a bot :D

All 6 comments

It looks like you are using an older version of React Native. Please update to the latest release, v0.59 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@react-native-bot
I did update React native and it still freezing, i wonder why i am replying to a bot :D

I guess that onPress was firing, but you don't see what showing, so... Try again with alert (Because alert show a modal)
<TouchableOpacity style={styles.touchable} onPress={() => alert('Pressed!!')} > <Text> Press Me </Text> </TouchableOpacity>

Can you provide a full repro where this doesn't work?

@Philemono Feel free to reopen if you find onPress not work, from your code example, I think it may you use console.log which may not work in release mode. You can also try https://github.com/facebook/react-native/issues/25032#issuecomment-495973252.

clear all console.log or comment console.log.........because debugger mode take console.log so ......it will hang

this is work for me

Was this page helpful?
0 / 5 - 0 ratings