-
-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pressable elements not working in native-stack on Android devices with new architecture #2219
Comments
🫨 |
Is that the thing only on real devices? |
Yes. So far, only tested with Samsung devices, incl. S24, S8+ and a Samsung tablet (dont remember the name) |
Plus everything pressable goes completely crazy in the screen (not only the header bar), if it is an actually build apk instead of an expo development build. However, not sure if this related. |
Also happening in our app, we've only seen it happen on-device, specifically the S23. It seems to do with the RN JS responder system, because using react-native-gesture-handler replacements for buttons and other things makes them work. ScrollViews and FlatLists also work when the bug happens. It also feels like it sometimes happens when the app is backgrounded for a while and then returns to focus, but this is not confirmed. |
I have the same issue here but with iOS (not tested on Android) Screen <- Pressable working EmptyScreen ScreenWithStuff I hope it's understandable Here is the behavior that I have Note : It is only happening in production build with new arch enabled |
Hi @DrZoidberg09! Thanks for creating this issue. I can observe there are some several issues, related to this one: #2150 However, I didn't check if #2150 is related to the behavior of onPressIn/Out. Have you tried creating a navigation from stack navigator with |
@tboba I tried it with detachInactiveScreens true or false. It does not make any difference. Both do not work. |
@DrZoidberg09 thanks for checking. This means that probably this issue is out of scope of react-native-screens (since the weird behavior still happens after disabling screens). I'll try to reproduce it on my side and re-check the scenario given above, but as I said, I would report this issue on react-navigation repository or official react-native one. |
I actually did open the issue at react-native first. They redirected me to react navigation, and they directed me here. Feels a little bit like going from one doctor to another :) For my understanding: Why this is not coming from screens? It can defitely be tracked down to the native-stack from react native navigation. Hence, they mentioned it is related to screens. |
@DrZoidberg09 I understand your point of view 😄 That's why I asked if this issue also happens on the classic Stack Navigator with |
Oh, I noticed I misread your posting from above. I tried detachInactiveScreens true or false on native-stack navigator. Normal stack does work completely fine. |
+1 Have the same issue since upgraded to latest Expo SDK 51 using expo-router. Works fine on the simulator, but on our Samsung Galaxy Tab Active4 Pro 5g tablets, the issue is present (even with a development build instead of sdk). One thing I saw too is that if I try to long press the button, the button's focused color does not stay active like it should, it flashes a fraction of a second. |
This is a real drawback of enabling newArch in Expo. |
Just like in #1975 (comment) Using |
Oh this works! Thank you |
[react-native-screens/issues/2219](software-mansion/react-native-screens#2219)
In my case I'm not even able to focus on TextInputs |
onPress also not working for me. But onPressIn does work. I'm on the latest beta version and Android. But it seems to only be a problem for me in certain situations (like in a scrollview that's inside a drawer content). |
RectButton does work. But I'm not sure it can sub touchable opacity. |
I wonder #2292 fixes this. But it is shipped on The component in |
The progress on the issue is being made in #2466 guys, we're aware of the issue. |
Any updates? I can't replace the Pressable component with the RectButton? |
@kkafar that will fix pressables on the header but will that fix the pressable in the body in case there is a drawer navigation nested with the stack navigation like I refered on my previous comment? |
+1. I started migrating to RN 0.76 & new arch but this is blocking me. Pixel 4, real device. |
Hi any solution? the button or pressable press not work correctly in header. |
Here's my workaround import {Gesture, GestureDetector} from 'react-native-gesture-handler'
// workaround
const tap = Gesture.Tap().runOnJS(true).onEnd(onPress as any)
return (
<GestureDetector gesture={tap}>
<RNPressable {...props} />
</GestureDetector>
)
// orignal impl. restore once RN new-arch bug is fixed
//return <RNPressable onPress={onPress} {...props} /> |
This works for me, but just as a temporary solution until this issue is fixed |
+1 +1 +1 🙏 I just ran into this issue upgrading to Expo 52 with New Architecture. |
Expanding on temp solution that works import { Pressable } from 'react-native';
import {Gesture, GestureDetector} from 'react-native-gesture-handler'
const RNPressable = ({ onPress, ...props }) => {
const tap = Gesture.Tap().runOnJS(true).onEnd(onPress)
return <GestureDetector gesture={tap}>
<Pressable {...props} />
</GestureDetector>
}
export default RNPressable; |
I cannot make sense of this. It's weird that onPressOut will work with TouchableOpacity, but not with Button. So the Button component is not usable at all, while TouchableOpacity has a simple workaround by using onPressOut instead of onPress. |
its' same solution, from to |
That worked for me, thanks! |
import { TouchableOpacity } from 'react-native-gesture-handler'; this code does not work in Stack.Screen on iphone 11 -> ios 18.0.1. The best option seems to be onPressIn. |
same thing in ios expo/expo#32927 |
Having the same issue here. Appears to be both on iOS and Android with Expo 52 and, in our case, we are not using Expo-Router. The workaround so far has been using react-native-gesture-handler, but those onPress components come with different styling challenges that force us to do silly things like making View wrappers with styling to get the same effects that we had before with react-native onPress events. Eagerly looking forward to the fix for this. |
same issue on ios with expo 52, looking forward to the fix so much!!! |
If it helps, I've found that in an iOS simulator running on a MacBook, the header buttons don't work if the trackpad is pressed hard (with haptic feedback) but do work when clicking lightly on the trackpad. It's weird, but it reliably works this way. Maybe it has something to do with the duration of the press? |
While debugging, I noticed an issue related to This led me to a hypothesis: the scrolling offset introduced by For context, I tested this on an iPhone X running iOS |
Guys there is PR related: #2466 However since it introduces volatile changes, we would love go get as much feed back from you as possible. You can install screens directly with following line in your package.json:
|
Thanks so much for the fix! I'm leaving testing feedback in the PR. (Note: |
Description
When using Android devices (iOS and Android emulator is fine) you cannot use onPress in the header bar. onPressIn and onPress out does work. This was tested mostly with Samsung devices.
This only happens with native-stack / Expo Router.
Please have a look here:
expo/expo#30032
react-navigation/react-navigation#12039
facebook/react-native#44643
Steps to reproduce
Snack or a link to a repository
https://github.com/DrZoidberg09/RN-Android-Touch-Issue/
For comparison a repo with bare RN, one with Expo and react navigation stack and one with Expo router / native-stack
Screens version
3.32.0
React Native version
0.74
Platforms
Android
JavaScript runtime
Hermes
Workflow
None
Architecture
Fabric (New Architecture)
Build type
None
Device
None
Device model
Samsung S23, Samsung S8+
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: