react-native-bottom-sheet icon indicating copy to clipboard operation
react-native-bottom-sheet copied to clipboard

BottomSheet Issue on Android 14 and iOS 17.1/17.2

Open salmaAlouane opened this issue 1 year ago • 26 comments

Bug

The BottomSheet component of the @gorhom/bottom-sheet plugin is not functioning correctly on Android 14. on iOS, it works on version 17.0 but does not work on versions 17.1 and 17.2.

Environment info

Library Version
@gorhom/bottom-sheet ^4.5.1
react-native ^0.72.7
react-native-reanimated ^3.6.1
react-native-gesture-handler ^2.14.0

Steps To Reproduce

1.Open the app 2.Click on the button designed to display the BottomSheet. 3.The BottomSheet should open as a result of these steps, but it is not functioning as expected on Android 14 and iOS 17.1/17.2.

Describe what you expected to happen:

The BottomSheet should open .

Reproducible sample code

https://snack.expo.io/@gorhom/bottom-sheet-v4-reproducible-issue-template

salmaAlouane avatar Dec 25 '23 15:12 salmaAlouane

I don't know it is same case with me. I comment additional environment of this bug. I found this issue only iPhone 14 series and iOS 17.2.1+

ricoh-willog avatar Dec 26 '23 02:12 ricoh-willog

Same issue here

chamellion avatar Jan 01 '24 21:01 chamellion

@gorhom is there any solution for that please ?

salmaAlouane avatar Jan 02 '24 14:01 salmaAlouane

experiencing problems as well, any update @gorhom

jdicami avatar Jan 08 '24 21:01 jdicami

@jdicami It is related to reanimated with reduced motion, here is a patch that can temporarily fix this issue.

@gorhom+bottom-sheet+4.6.0.patch

FawadMahmood avatar Jan 09 '24 06:01 FawadMahmood

thx @FawadMahmood your patch fix the issue

jetaix avatar Jan 09 '24 17:01 jetaix

@gorhom can we get this added in to the next release if possible?

daveosterjr avatar Jan 17 '24 15:01 daveosterjr

@daveosterjr, it needs to be appropriately implemented. I just made a quick patch.

FawadMahmood avatar Jan 17 '24 17:01 FawadMahmood

This has been causing some major issues for us on both iOS and Android. We love this library and have used it liberally across our app, which in turn made our app unusable for users on the problematic device/os combos. I applied the patch and its now fixed (Thank you @FawadMahmood!). Is there anything I can do to help get this fix moved into a release?

tbonebrad avatar Jan 30 '24 18:01 tbonebrad

@jdicami It is related to reanimated with reduced motion, here is a patch that can temporarily fix this issue.

@gorhom+bottom-sheet+4.6.0.patch

Quick clarification to others who find this. Reduce motion is a phone setting...

  • iOS found under Settings -> Accessibility -> Motion -> Reduce Motion
  • Android found under Settings -> Accessibility -> Remove Animations

When enabled the bottom sheet does not work

tbonebrad avatar Jan 30 '24 20:01 tbonebrad

+1 please and thanks!

@gorhom can we get this added in to the next release if possible?

uhhhsoyan avatar Feb 15 '24 18:02 uhhhsoyan

I've submitted a PR which should fix this in v5 of the library: https://github.com/gorhom/react-native-bottom-sheet/pull/1743

fobos531 avatar Feb 19 '24 08:02 fobos531

You can extend the animationConfigs with reduceAnimation value if you use react-native-reanimated v3.

import { ANIMATION_CONFIGS } from '@gorhom/bottom-sheet';
import { ReduceMotion } from 'react-native-reanimated';

<BottomSheet
      animationConfigs={{ ...ANIMATION_CONFIGS, reduceMotion: ReduceMotion.Never }}

guvenakcoban avatar Feb 22 '24 17:02 guvenakcoban

this should be fixed on v5

gorhom avatar Feb 27 '24 09:02 gorhom

@gorhom great to hear! This is a pretty big issue, are you able to give a rough timeline for when v5 is stable?

ericpoulinnz avatar Mar 08 '24 03:03 ericpoulinnz

This worked for me

const reducedMotion = useReducedMotion();

animateOnMount={!reducedMotion}

iusama46 avatar Mar 08 '24 06:03 iusama46

On changing the animationConfigs, the bottomSheet is finally starting to show, but I'm facing a new problem now. 3 out of 10 times the bottom sheet doesn't close properly with the close or dismiss function. It goes down and comes back up. Anyone else facing the same issue?

singhayush1403 avatar Mar 11 '24 09:03 singhayush1403

On changing the animationConfigs, the bottomSheet is finally starting to show, but I'm facing a new problem now. 3 out of 10 times the bottom sheet doesn't close properly with the close or dismiss function. It goes down and comes back up. Anyone else facing the same issue?

@singhayush1403 I had the same issue and fixed it by applying the patch @FawadMahmood provided ! I hope it helps.

gtsadaris avatar Mar 13 '24 09:03 gtsadaris

You can extend the animationConfigs with reduceAnimation value if you use react-native-reanimated v3.

import { ANIMATION_CONFIGS } from '@gorhom/bottom-sheet';
import { ReduceMotion } from 'react-native-reanimated';

<BottomSheet
      animationConfigs={{ ...ANIMATION_CONFIGS, reduceMotion: ReduceMotion.Never }}

This solution appears to break BottomSheetTextInput

When we apply this change, the sheet no longer extends to accommodate keyboard. Does anyone know of a solution around that.

We bumped to the version with the patch built in and the same issue happens.

image

codebycorey avatar Mar 21 '24 13:03 codebycorey

You can extend the animationConfigs with reduceAnimation value if you use react-native-reanimated v3.

import { ANIMATION_CONFIGS } from '@gorhom/bottom-sheet';
import { ReduceMotion } from 'react-native-reanimated';

<BottomSheet
      animationConfigs={{ ...ANIMATION_CONFIGS, reduceMotion: ReduceMotion.Never }}

This solution appears to break BottomSheetTextInput

When we apply this change, the sheet no longer extends to accommodate keyboard. Does anyone know of a solution around that.

We bumped to the version with the patch built in and the same issue happens.

image

Hi, I'm facing the same issue. Any suggestions?

buzunboy avatar Mar 25 '24 16:03 buzunboy

bottom sheet not appearing for users that have reduced motion turned on (https://github.com/gorhom/react-native-bottom-sheet/issues/1743)(by @fobos531) (9b4ef4d) https://github.com/gorhom/react-native-bottom-sheet/releases/tag/v5.0.0-alpha.8

UgurGumushan avatar Mar 27 '24 12:03 UgurGumushan

Checked after upgrading to v5.0.0-alpha.8 but the issue seems to persist. The bottom sheet does not open the first time, I need to call sheetRef.current?.snapToIndex(0); twice to actually open it. I started facing this issue after upgrading to RN version 0.70.x from 0.68.x.

The issue persists on RN version 71 as well as on 72. I also tried upgrading reanimated to the latest version: 3.8.1 and tried applying the patch mentioned here: https://github.com/gorhom/react-native-bottom-sheet/issues/1674#issuecomment-1882488777 after downgrading bottom sheet to 4.6.0 but the issue persists.

JJSLIoT avatar Apr 02 '24 11:04 JJSLIoT

You can extend the animationConfigs with reduceAnimation value if you use react-native-reanimated v3.

import { ANIMATION_CONFIGS } from '@gorhom/bottom-sheet';
import { ReduceMotion } from 'react-native-reanimated';

<BottomSheet
      animationConfigs={{ ...ANIMATION_CONFIGS, reduceMotion: ReduceMotion.Never }}

This solution appears to break BottomSheetTextInput When we apply this change, the sheet no longer extends to accommodate keyboard. Does anyone know of a solution around that. We bumped to the version with the patch built in and the same issue happens. image

Hi, I'm facing the same issue. Any suggestions?

Same issue here ☹️ Has anyone been able to address this?

Code-yWilliams avatar Apr 15 '24 17:04 Code-yWilliams

This is resolved here: https://github.com/gorhom/react-native-bottom-sheet/releases/tag/v5.0.0-alpha.8 But v5 has other issues. Please patch the v4 and close this issue.

UgurGumushan avatar Apr 16 '24 09:04 UgurGumushan

On changing the animationConfigs, the bottomSheet is finally starting to show, but I'm facing a new problem now. 3 out of 10 times the bottom sheet doesn't close properly with the close or dismiss function. It goes down and comes back up. Anyone else facing the same issue?

I have encountered this, and its unrelated to the reduced motion. Whenever you change the animationConfig, this issue starts to arise.

hirbod avatar Apr 17 '24 10:04 hirbod

"Reduced Motion" breaks a lot of stuff in this library even previous to 17.1.. IE onClose handlers fire instantly... kind of makes it unusable IMO. In my current project we're going to have to swap out BottomSheet for our own bottom sheet component because of these issues

iway1 avatar Apr 24 '24 02:04 iway1

On changing the animationConfigs, the bottomSheet is finally starting to show, but I'm facing a new problem now. 3 out of 10 times the bottom sheet doesn't close properly with the close or dismiss function. It goes down and comes back up. Anyone else facing the same issue?

I have encountered this, and its unrelated to the reduced motion. Whenever you change the animationConfig, this issue starts to arise.

I had the same issue and found that it happens when the animationConfig is not memoized. If the component containing <BottomSheet> re-renders during the close animation this useEffect is run and re-opens the bottom sheet.

I actually noticed the same issue when using useBottomSheetSpringConfigs as well because it's not correctly memoized. The config object is not "shallow equal", so the useMemo has no effect.

I fixed it by declaring the config object outside the component, which keep the same reference between each render.

import { ANIMATION_CONFIGS } from '@gorhom/bottom-sheet';
import { ReduceMotion } from 'react-native-reanimated';

// Constants
const bottomSheetAnimationConfig = {...ANIMATION_CONFIGS, reduceMotion: ReduceMotion.Never};

// In Component
<BottomSheet
      animationConfigs={bottomSheetAnimationConfig}

sparga avatar May 15 '24 23:05 sparga

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jun 15 '24 09:06 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Jun 21 '24 09:06 github-actions[bot]