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

[Bug]: Laggy and doesn't fully open with new architecture #2046

Open
aldebout opened this issue Nov 18, 2024 · 15 comments
Open

[Bug]: Laggy and doesn't fully open with new architecture #2046

aldebout opened this issue Nov 18, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@aldebout
Copy link

aldebout commented Nov 18, 2024

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS

What happened?

I just switched from expo 50 / RN 0.74 / old architecture to expo 52 / RN 0.76 / new architecture. The library upgrade went without problems but when I switched to the new architecture, most bottom sheets are laggy or don't fully open the first time I mount them on iOS simulator (I haven't tested on a real device yet).

First video is with expo 52 and old architecture, second and third videos are with expo 52 and new architecture.
The event sheets are dynamically sized, and the location ones have fixed snap points.

I'm wondering if other people are experiencing similar issues? I've looked at a bunch of threads and some comments hint at similar problems with Fabric, but I haven't found one that fit exactly this case.

oldarch.mp4
newarch.mp4
newarchmenu.mp4

Reproduction steps

At this point I don't know how to properly repro, I just added newArchEnabled: true to app.config.ts, rebuilt and the issue appeared. I've tried switching again and the problem disappears on the old arch + rebuild.

I've also tried removing Sentry in case it was the problem but it does not seem to make a difference. Other potentially conflicting libraries: nativewind, tanstack query with useQuery hooks in the bottom sheets (wrapped through trpc).

I added a straight link to the snack template with this lib and RNR bumped to the latest version and expo switched to 52. It looks janky to me but honestly with snack it's impossible to tell.

Reproduction sample

https://snack.expo.dev/@alexdb/bottom-sheet---issue-reproduction-template

Relevant log output

No response

@aldebout aldebout added the bug Something isn't working label Nov 18, 2024
@blaemmle
Copy link

Hey I have the same issue.

@juan-vilas
Copy link

same issue here, it's laggy if using the new architecture

@garrettwesley
Copy link

Same issue here, laggy with expo v52 and new architecture.

@r3dm4n
Copy link

r3dm4n commented Nov 25, 2024

Same issue after upgrading to expo52 and the new architecture. it's very slow

@garrettwesley
Copy link

I was able to fix the lag by specifying a custom backdropComponent prop. I copied most of the default BottomSheetBackdrop besides some unnecessary code for my purposes, and specifically removed the flex: 1 line here which caused me a lot of lag. I instead use StyleSheet.absoluteFill in the containerStyle return array.

@dkahdwk
Copy link

dkahdwk commented Nov 25, 2024

same issue

@aldebout
Copy link
Author

I was able to fix the lag by specifying a custom backdropComponent prop. I copied most of the default BottomSheetBackdrop besides some unnecessary code for my purposes, and specifically removed the flex: 1 line here which caused me a lot of lag. I instead use StyleSheet.absoluteFill in the containerStyle return array.

@garrettwesley thank you, this might make finding the root cause easier! For what it's worth, I already use a custom backdrop component everywhere:

const AnimatedPressable = Animated.createAnimatedComponent(Pressable);

const CustomBackdrop = ({ style }: BottomSheetBackdropProps) => {
  const { close } = useBottomSheet();
  return (
    <AnimatedPressable
      onPress={() => close()}
      entering={FadeIn.duration(50)}
      exiting={FadeOut.duration(20)}
      style={[style, { backgroundColor: "rgba(0, 0, 0, 0.4)" }]}
    />
  );
};

and this is my base modal (so adding the custom backdrop and top inset, I handle bottom inset through bottom padding in the scrollables and/or footer):

export const BottomSheetModal = forwardRef<
  NBottomSheetModal,
  BottomSheetModalProps
>(({ ...props }, ref) => {
  const insets = useSafeAreaInsets();
  return (
    <NBottomSheetModal
      ref={ref}
      backdropComponent={CustomBackdrop}
      topInset={insets.top}
      {...props}
    />
  );
});

Everyone that's commenting "same", please add a thumbs up on the first comment, it makes life easier for everyone :)

@shuo-hiwintech
Copy link

+1

@shuo-hiwintech
Copy link

I was quickly repeating opening closing BottomSheetModal on Android and the app would be unresponsive.

"react-native": "0.76.2",
"@gorhom/bottom-sheet": "^5.0.6",
"react-native-gesture-handler": "^2.21.2",
"react-native-reanimated": "^3.16.2",

@aeokay
Copy link

aeokay commented Nov 28, 2024

The same issue with Bottom Sheet Modal

@rochajulian
Copy link

rochajulian commented Dec 2, 2024

For what it's worth, I was having a similar issue and I was able to fix it by using React Native's View component rather than Gorhom's BottomSheetView component. I have a BSMTemplate component that does use the BottomSheetView and all of the instances of it use View to wrap its contents. This only seemed to make the BSM come up when called but it did not fix the laggyness.

@gunnartorfis
Copy link

Can confim that by removing the backdropComponent, the lagging stops.

@bikoevD
Copy link

bikoevD commented Dec 12, 2024

Actually, it's not only this library that lags. Almost any pop-up modal in the new architecture and expo 52 experiences significant lag.
For example:

  • @marceloterreiro/flash-calendar
  • custom modal that slides out from below via reanimated

Also, in many places my layout broke.
Unfortunately, this makes the new architecture not very usable right now.

@DMyashkov
Copy link

DMyashkov commented Dec 12, 2024

Same here at least for the lag part even though it seem like other animations in reanimated also have the same aggresive jitter at the end of the animation.

@rileysay
Copy link

rileysay commented Dec 14, 2024

Yeah my modal is stuttering near end of open animation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests