Skip to content
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

Back button Android Ripple effect is not showing up on react-navigation 6 #9794

Closed
2 of 10 tasks
hsjoberg opened this issue Aug 6, 2021 · 7 comments · Fixed by #11386
Closed
2 of 10 tasks

Back button Android Ripple effect is not showing up on react-navigation 6 #9794

hsjoberg opened this issue Aug 6, 2021 · 7 comments · Fixed by #11386

Comments

@hsjoberg
Copy link

hsjoberg commented Aug 6, 2021

Current behavior

The Android Ripple effect is not showing up when pressing the back button on react-navigation 6.

I suppose this is a bug and I've somewhat tracked it down, although I'm not experienced enough in react-navigation to fix it.

<PlatformPressable
disabled={disabled}
accessible
accessibilityRole="button"
accessibilityLabel={accessibilityLabel}
testID={testID}
onPress={disabled ? undefined : handlePress}
pressColor={pressColor}
pressOpacity={pressOpacity}
android_ripple={{ borderless: true }}
style={[styles.container, disabled && styles.disabled, style]}
hitSlop={Platform.select({
ios: undefined,
default: { top: 16, right: 16, bottom: 16, left: 16 },
})}

<AnimatedPressable
onPressIn={handlePressIn}
onPressOut={handlePressOut}
android_ripple={
ANDROID_SUPPORTS_RIPPLE
? {
color:
pressColor !== undefined
? pressColor
: dark
? 'rgba(255, 255, 255, .32)'
: 'rgba(0, 0, 0, .32)',
...android_ripple,
}
: undefined
}
style={[{ opacity: !ANDROID_SUPPORTS_RIPPLE ? opacity : 1 }, style]}
{...rest}
/>

Removing borderless: true makes it show up, but as a square. It looks like radius is missing or something.

I guess there is a reason, but why not just use react-native's TouchableNativeFeedback?
https://github.com/hsjoberg/blixt-wallet/blob/e1a689f5d8b9ddfc2950aec205b71748065acb64/src/components/NavigationButton.tsx

Expected behavior

Ripple effect should show up on supported Android devices.

Reproduction

https://github.com/hsjoberg/react-navigation-back

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-bottom-tabs
  • @react-navigation/material-top-tabs
  • @react-navigation/stack

Environment

package version
@react-navigation/native 6.0.1
@react-navigation/stack 6.0.1
react-native-safe-area-context 3.2.0
react-native-screens 3.5.0
react-native-gesture-handler 1.10.3
react-native-reanimated 2.2.0
react-native 0.64.2
node 15.10.0
npm or yarn npm
@github-actions
Copy link

github-actions bot commented Aug 6, 2021

Couldn't find version numbers for the following packages in the issue:

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-bottom-tabs
  • @react-navigation/material-top-tabs

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

@hsjoberg hsjoberg changed the title Back button Android Ripple effect is not showng up on react-navigation 6 Back button Android Ripple effect is not showing up on react-navigation 6 Aug 9, 2021
@github-actions
Copy link

github-actions bot commented Aug 9, 2021

Couldn't find version numbers for the following packages in the issue:

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-bottom-tabs
  • @react-navigation/material-top-tabs

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

  • @react-navigation/native (found: 6.0.1, latest: 6.0.2)
  • @react-navigation/stack (found: 6.0.1, latest: 6.0.3)

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

@SergioAN007
Copy link

SergioAN007 commented Nov 7, 2021

Issue still exists

Packages:
"@react-navigation/drawer": "^6.1.8",
"@react-navigation/elements": "^1.2.1",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"react-native": "^0.66.2",
"react-native-reanimated": "^2.2.3",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",

@hsjoberg
Copy link
Author

hsjoberg commented Nov 7, 2021

Can confirm.
The code is still buggy, preventing the ripple effect to play out correctly.

@gaodeng
Copy link

gaodeng commented Jan 12, 2022

any news? @satya164

@JerakRus
Copy link

Это до сих пор не поправлено ?

@diegolmello
Copy link
Contributor

diegolmello commented Jun 28, 2022

The same issue is going to happen if you use PlatformPressable with borderless: true to render header right buttons.
I could pinpoint the issue to the header background, which is an absolute positioned view

<HeaderBackground style={backgroundStyle} />

That also happens outside react-navigation.

Relevant to:

kacperkapusciak pushed a commit that referenced this issue Aug 1, 2023
Please provide enough information so that others can review your pull
request.

**Motivation**

closes #9794

also observed that the ripple radius can be very slightly increased to
be like in the native android toolbar

why the `foreground` isn't simply `true`? see
facebook/react-native#37901

**Test plan**

tested locally
kacperkapusciak pushed a commit that referenced this issue Aug 1, 2023
Please provide enough information so that others can review your pull
request.

**Motivation**

closes #9794

also observed that the ripple radius can be very slightly increased to
be like in the native android toolbar

why the `foreground` isn't simply `true`? see
facebook/react-native#37901

**Test plan**

tested locally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants