-
Notifications
You must be signed in to change notification settings - Fork 328
Touchable Opacity inside renderContent has no actions when tapped on Android. iOS working fine. #16
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
Comments
I see the problem. |
I was able to repro, but I don’t have now a strong opinion |
is this fixed yet in the new release? |
same issues |
@osdnk Looks like the pull is ready, no? This blocks a lot of plans for our app, possible to merge? |
And react-native-gesture-handler not working on iOS, so we have to choose touchable dependent on OS |
Please fix this issue, we are waiting for fixes |
Sorry for not being very active. I’ll happily accept any PRs but now I’m truly overwhelmed by my job and react navigation stuff. Sorry I do my best, but I’m not any superhero :/ |
If that helps you can do a custom component to fix it like this one: import { TouchableOpacity as RNGHTouchableOpacity } from 'react-native-gesture-handler';
const BottomSheetTouchableWorkaround = ({
children,
onPress,
}: {
children: ReactNode;
onPress: () => void;
}) =>
Platform.select({
android: <RNGHTouchableOpacity onPress={onPress}>{children}</RNGHTouchableOpacity>,
ios: (
<TouchableOpacity onPress={onPress}>{children}</AppTouchableOpacity>
),
}); |
I face a little difference from this problem. I hope this problem will be resolved in the next release because my boss has asked when I can release this application. |
Might be resolved by the PR I just submitted: #85 |
After a little rework of @slorber example I've got something like this. Works at least for iOS at the time and I will test it on android tomorrow. import React, { memo } from "react";
import { Platform, TouchableOpacity } from "react-native";
import { TouchableOpacity as RNGHTouchableOpacity } from "react-native-gesture-handler";
const BottomSheetButton = ({ children, ...otherProps }) => {
if (Platform.OS === "android") {
return (
<RNGHTouchableOpacity {...otherProps}>{children}</RNGHTouchableOpacity>
);
}
return <TouchableOpacity {...otherProps}>{children}</TouchableOpacity>;
};
export default memo(BottomSheetButton); Anyways,, hope that #85 get merge asap... |
@sebinq - were you able to try the PR I submitted? It’s working great for me (both iOS and Android) but your use case may be different. |
@rgoldiez i didn't right now I'm in busy but tomorrow maybe :) |
@rgoldiez same issue with the new prop |
@Under-Warz - just to make sure, did you set both |
Set |
here is the config I've made to make it work on both iOS and Android with button and horizontal drag slider
And the button inside the view use |
I need the internal scroll but with this configuration not working the scroll, works only onpress but the scroll does not, how does this project to operate the scroll and also the onpress |
i find a solution for me
in renderinner
and important in style
|
Hey For what it's worth, here's the solution I've found to encapsulate the workaround: export const AppBottomSheetTouchableWrapper = (
props: { children: ReactNode } & Pick<
TouchableWithoutFeedbackProps,
'onPress' | 'disabled'
>,
) =>
Platform.select({
android: <RNGHTouchableWithoutFeedback {...props} />,
ios: (
<TouchableWithoutFeedback {...props}>
<View>
<View pointerEvents="none">{props.children}</View>
</View>
</TouchableWithoutFeedback>
),
}); And I have to wrap the existing touchable component (without providing it the onPress prop:) <AppBottomSheetTouchableWrapper onPress={onPress}>
<AppButton>ButtonText</AppButton>
</AppBottomSheetTouchableWrapper> I'm happy with that as it seems to encapsulate the workaround with a common abstraction for both platforms |
Hi, as many folks here I was facing an issue with using snapTo on a touchable element inside sheet content. In my case, it was a button based on TouchableOpacity. After a few hours of debugging, I found that on Android whenever any touchable element inside sheet is beeing touched this.panMasterState is not END but CANCELLED. That's why cond that should start spring animation is not evet evaluated. I think this closes at least #76 #16 #69
Having the same issue, and I stumbled upon the same workaround on my own, however, this is not a perfect solution if one uses a UI library, (ex: react-native-paper) in my case, then the components stop working (ex: button) and there is not easy way to patch it, besides re-implementing the components using Touchables. Just my 2 cents here, would like to know if/when this gets fixed. |
Does anyone have a workaround to make a I have tried setting each |
When I inspect there's a |
Have you tried using flatlist component from react native gesture package? |
@ospfranco I have, thank you. Unfortunately it's the same. I think it is stemming from having multiple sheets rendered at once and somehow it's pushing a |
Hey Guys. I too encountered the same issue. and I have tried an alternative solution and it worked for me and per my requirement. Alert.alert( |
One work around i found was to call <TouchableOpacity
onPress={() => {
bottomSheetRef.current?.snapTo(0);
bottomSheetRef.current?.snapTo(0);
}}
> |
@safaiyeh 's solution worked perfectly for me 🎉 |
Nice, I'm assuming the first tap brings the content to view.. then gets initialized. Not exactly sure if that logic sounds right. Might be a step in the right direction about the bug. |
yea @safaiyeh i was having the same issue, i created a button to snapTo but it took two button presses to get the component to respond. what's interesting is that in my other project (expo based), this works just fine TouchableOpacity from RN is also not working on android react version 16.8.1 |
Yeah I tried |
This problem still exists and @safaiyeh double call workaround does not work for me unfortunately. Will this be fixed anytime soon? Thank you!
setting these 2 to false works for me actually! not sure why, but thanks! |
Used same workaround as @safaiyeh, issue is reproducible for both platforms |
Same issue. Again @safaiyeh 's workaround works for me |
I don't know do i have same issue but evry time i am tring to close bottom sheet after pressing button inside the sheet, it doesnt closing even tho i see that my method working (i am changing quality of a hls stream in player) but chooseQuality = (quality: ParsedStream) => {
this.setState({
currentQuality: quality.url
})
this.bottomSheet.current.snapTo(1);
this.bottomSheet.current.snapTo(1);
} copying evrywhere where i call |
Hello Guys, I have same issue, in render content, I import my own component "Player Controller"
|
For me the issue was that I had to put the BottomSheet
It didn't matter what Also I have few buttons and horizontal scroll view inside the BottomSheet and it is working fine with standard
My BottomSheet configuration looks like this:
|
@Fallup I implement a mini-player So the parent View i set the height to 60 and backgroundColor: black, and as i say i can't respond to any action inside the component inside the renderContent Function But when i deleted the background property from View style, So why? :"D
|
It solved my problem for react native switch, |
@timothystewart6 Did you able to solve the Webview interaction problem? |
I haven't tried that. you can send make a sandbox.
|
Hi all enabledContentTapInteraction={false} ✅ |
yes i have the same problem with bottomsheet when i put a touchableopacity , it didnr work any help pleaase ?
|
Touchable Opacity inside renderContent has no actions when tapped on Android. iOS is working fine.
It can be reproduced in this snack. (Took one of the snack from earlier issues)
Long press the "Profile" tab to show the bottom sheet.
Inside bottom sheet, press click me text.
https://snack.expo.io/@roshangm1/bottom-sheet
The text was updated successfully, but these errors were encountered: