-
-
Notifications
You must be signed in to change notification settings - Fork 546
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 |
problem is not only that onPress does not work, but onPressIn also does not work all time. when u in development mode and usb cable is connected then 10+ times clicked onPressIn also stops working. i dont know, does this happens in live also, but at this moment I don't dare build anything to live. |
Could it be possible that despite the fix for screen content, and the latest one for header content, this issue still impacts form sheets? I tried different presentation modes (e.g. regular screens, modals, and form sheets), and it seems that pressable elements in form sheets are still kinda hard to press. Both regular screen and modal presentation modes are working perfectly, but not sheets. |
@antoinerey what platform do you speak of? Android or iOS? |
Android 🤗 |
Sorry for the late reproduction, but I've not been able to actually reproduce on a minimal application. There might be something conflicting in our production application, but I've not had time to deeply investigate, so I'm not sure what might be the root cause. Feel free to discard my report as it seems invalid. 🙇 |
This is still an issue as of now |
@pknrs Can you provide a reproducer using 4.6.0 version of screens? |
Facing the same issue. Observations till now:
|
In cases you're still experiencing issues, please provide a reproduction code, together with package versions you're using and preferably video of the bug occurring, if feasible. As of now I consider the bug fixed with release of 4.6.0. |
I've been spending hours on this already :( No idea what is causing this. I've tried to bisect it in every direction, but nothing helps. edit: as in my case there is no scrollview in the modal, I could add |
I can confirm the issue is still present. It is hard to provide on a sample as (on our project newArch enable, react native 0.77 screens 4.6.0) it is reproduced only in release mode with a real device ... |
- Perform changes recommended by the Upgrade Helper - Didn't update gradle-wrapper.jar since it is a binary file - Didn't manually remove all of the RnDiffAppTests/OrganizeTests references. I only kept the ones that were created by removing OrganizeTests.m and OrganizeTests Info.plist - Converted AppDelegate.mm to AppDelegate.swift - https://github.com/guardianproject/orbot-apple/blob/57dae6f/Orbot/AppDelegate.swift#L29 - https://github.com/haqq-network/haqq-wallet/blob/c6687e3/ios/AppDelegate.swift#L67-L73 - https://react-native-community.github.io/upgrade-helper/?from=0.75.3&to=0.77.0&package=app.getorganize.organize&name=Organize - Update local dev machine node from v23.3.0 to v23.6.1 and npm from 10.9.0 to 10.9.2 to fix a warning that happened when running `npm run` commands - npm/cli#7857 (comment) - Use align-deps to update and align dependencies - Fix "2 vulnerabilities (1 moderate, 1 high)" with `npm audit fix` - Update react-native-vision-camera from 4.5.3 to 4.6.3 to fix a build error - mrousavy/react-native-vision-camera#3263 - Fixed another react-native-vision-camera Android build error - Opened PR: mrousavy/react-native-vision-camera#3394 - Added devDependency on [email protected] to bring this fix in locally until the PR is merged - https://github.com/ds300/patch-package - Upgraded react-native-modal-datetime-picker from 17.1.0 to 18.0.0 to fix a default props warning - mmazzarolo/react-native-modal-datetime-picker#755 - https://github.com/mmazzarolo/react-native-modal-datetime-picker/releases/tag/v18.0.0 - Fix Android shadows looked bad by migrating from elevation to boxShadow, which was newly added in 77 - https://reactnative.dev/docs/view-style-props#boxshadow - https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow - Update react-native-pager-view from 6.4.1 to 6.7.0 to fix an android crash when navigating to FlaggedContent, then hitting the back button - callstack/react-native-pager-view#944 - https://github.com/callstack/react-native-pager-view/releases/tag/v6.6.1 - Fix CountdownClockBorder flicker on touch down by migrating from react native's built-in Animated to react-native-reanimated - This was caused by react native 77 using the new architecture by default - Add dependency on [email protected] - https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/ - Previously removed in 7b0b38a - Fix iOS RefreshControl not shown on mount - This was caused by react native 77 using the new architecture by default - Created PR on react-native: facebook/react-native#49240 - Used patch-package to bring this in locally until the PR is merged - Fix failing jest tests by removing jestSetupMockReactNavigation.ts - According to the docs, the mock is only needed when using DrawerNavigator or (non-native) StackNavigator - https://reactnavigation.org/docs/testing/#mocking-native-modules - Fix ListEmptyComponent briefly shown even though first page was non-empty - This was caused by react native 77 using the new architecture by default - This affected useModels, usePrependedModels, and useLeadItems because they used useEffect when they should have used useMemo, causing a render delay between when ready was true and when models were non-empty - As a result of the change from useEffect to useMemo in Models, I had to remove the isEqual check. This caused useModel consumers to have more renders than previously, since previously the isEqual check debounced many re-renders, e.g. when fetching data from the backend updated the cache, but didn't affect any of the ids watched by the specific instance of useModels - I updated useModelCache, which aleviated some of these unnecessary re-renders, but the scenario mentioned above still causes re-renders - The only place these new renders caused real issues was with OrgGraph. The useModelCache change fixed a re-render on pull-to-refresh of the OrgGraph. However, I specifically needed to debounce officers in VisGraphData or else selecting a node would trigger an OrgGraph re-render - Update react-native-screens from 4.5.0 to 4.6.0 to fix an issue where HeaderButton onPress was ignored on Android devices - react-navigation/react-navigation#12274 - software-mansion/react-native-screens#2219 (comment) - Add an override to rnx-kit config, since it expected react-native-screens to be 4.5.0 instead of 4.6.0 for react native 77 - https://microsoft.github.io/rnx-kit/docs/tools/align-deps#presets - https://microsoft.github.io/rnx-kit/docs/architecture/dependency-management#extensions - https://github.com/microsoft/rnx-kit/tree/main/packages/align-deps#configure
Any update on this? Pretty much stuck with my app updates as this is breaking the buttons. I'm also having issues with Pressables inside ScrollView components. Edit: Apparently my issues are related to gorhom bottomsheet, without it everything works. Edit2: Placed all other stuff inside a <View style={{position: 'absolute', top: 0, left: 0, right: 0, bottom: 0}}> { ... } and the bottomsheet outside of this this and pressables work again. |
Still an issue for me as well |
I can only repeat my previous comment #2219 (comment) |
can confirm it is fixed. Updating |
I just upgraded from |
I can only repeat my previous comment #2219 (comment) |
Pressabbles not working within headerSure, @kkafar , here is a minimum reproduction of where the issue is coming from. I'd also like to note that after upgrading from react-native-screen 4.4.0 to 4.7.0 the buttons changing widths is an issue. If the button gets wider it gets cut off. Swapping onPress with onPressIn seemed to sometimes fix the issue in 4.4.0. After upgrading to 4.7.0 the issue seems to be on IOS (simulator) now as well where it was only on physical Android devices before. Dependencies "react": "18.3.1",
"react-native": "0.76.5",
"react-native-gesture-handler": "~2.20.2",
"react-native-pager-view": "6.5.1",
"react-native-reanimated": "~3.16.1",
"react-native-screens": "^4.7.0",
"react-native-tab-view": "^3.5.2", Minimum exampleimport { useNavigation } from 'expo-router';
const ParentComponent = () => {
const [isEdit, setIsEdit] = useState(false);
const nav = useNavigation();
useLayoutEffect(() => {
nav.setOptions({
title: 'Device Details',
headerLeft: () => (
<CancelOrBackHeaderLeft isEdit={isEdit} handleEdit={handleEdit} />
),
headerRight: () => (
<EditHeaderRight
isEdit={isEdit}
hasEditPrivileges={hasEditPrivileges}
isEditLoading={isEditLoading}
handleEdit={handleEdit}
handleSaveEdits={handleSaveEdits}
disabled={
!newDeviceName || !validateTags() || isEditLoading || loading
}
/>
),
});
}, [
nav,
isEdit,
isEditLoading,
hasEditPrivileges,
handleEdit,
handleSaveEdits,
newDeviceName,
validateTags,
loading,
]);
return <></>;
};
const CancelOrBackHeaderLeft = ({
isEdit,
handleEdit,
}: DeviceDetailsHeaderProps) => {
return (
<View style={[a.flex_shrink]}>
{!isEdit ? (
<ScreenBack />
) : (
<TouchableOpacity onPress={handleEdit} style={{ minWidth: 100 }}>
<Text style={styles.headerCancel}>{t('general.cancel')}</Text>
</TouchableOpacity>
)}
</View>
);
};
const EditHeaderRight = ({
isEdit,
hasEditPrivileges,
isEditLoading,
handleEdit,
handleSaveEdits,
disabled,
}: DeviceDetailsHeaderProps) => {
return (
<View style={[a.flex_shrink]}>
{hasEditPrivileges && (
<Fragment>
{!isEdit ? (
<TouchableOpacity onPress={handleEdit}>
<Ionicons
name="create-outline"
size={24}
color={isEdit ? Colors.lightGray : Colors.black}
/>
</TouchableOpacity>
) : (
<TouchableOpacity
style={{
backgroundColor: disabled ? Colors.darkGray : Colors.black,
borderRadius: 99,
paddingVertical: 4,
paddingHorizontal: 14,
minWidth: 100,
}}
onPress={handleSaveEdits}
disabled={disabled}
>
{isEditLoading ? (
<LoadingDots color={Colors.white} />
) : (
<Text style={[a.btnText, { color: Colors.white }]}>
{t('general.save')}
</Text>
)}
</TouchableOpacity>
)}
</Fragment>
)}
</View>
);
}; |
Thanks for the repro! I'll get back to you once I investigate it |
I'm facing the same issue as @cyburns, any updates? |
All of the internal testers on android have reported header buttons not working at all despite being fine on emulators. Upgrading to 4.7.0 for screens did not help me. |
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: