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

[v4] Text is cropped for buttons inside bottomsheet on IOS only #1867

Closed
kav opened this issue Jun 21, 2024 · 7 comments
Closed

[v4] Text is cropped for buttons inside bottomsheet on IOS only #1867

kav opened this issue Jun 21, 2024 · 7 comments
Labels
bug Something isn't working no-issue-activity

Comments

@kav
Copy link

kav commented Jun 21, 2024

Bug

Buttons appearing inside a bottom sheet (on IOS) get cropped off. This behavior is random and does not occur every time, the best way to reproduce is to constantly refresh the app. This happens in the simulator and on my ios device.

Screen Shot 2022-12-07 at 9 08 23 AM

Another example:

Screen Shot 2022-12-07 at 9 20 26 AM

Environment info

Library Version
@gorhom/bottom-sheet 4.6.0
react-native 0.74.2
react-native-reanimated 3.10.1
react-native-gesture-handler 2.16.1

Steps To Reproduce

  1. Create a simple bottomsheet from https://gorhom.github.io/react-native-bottom-sheet/usage
  2. Add a button
  3. Add the following style to the content container:
  contentContainer: {
    flex: 1,
    alignItems: 'center',
  }
  1. Continue refreshing the app until the text gets cropped off. E.g.

Screen Shot 2022-12-07 at 9 18 07 AM

Expected behavior:

Text does not get cut off:

Screen Shot 2022-12-07 at 9 21 38 AM

Reproducible sample code

  1. Open https://snack.expo.dev/@jeannei91/bottom-sheet-cropped-button
  2. Switch to the ios view
  3. Reload the app until the button is cropped

Note this was also reported in 2021 ( #645 ) but the issue was closed
And again in 2022 #1218 but again the issue was closed

@kav kav added the bug Something isn't working label Jun 21, 2024
Copy link

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.

@kav
Copy link
Author

kav commented Jul 22, 2024

Still a problem.

@ArseniiLyzenko
Copy link

+1 victim of this bug

@Darnell-Chen
Copy link

Darnell-Chen commented Jul 29, 2024

From my tests, it only appears to be the case in some scenarios. My solution was to just use another view instead of since it seems to be a problem within that specific View component.

import React, { useCallback, useMemo, useRef } from 'react';
import { View, Text, StyleSheet, Button, TextInput } from 'react-native';
import BottomSheet, { BottomSheetView } from '@gorhom/bottom-sheet';
import { ScrollView } from 'react-native-gesture-handler';

const ManualForm = () => {
  // ref
  const bottomSheetRef = useRef<BottomSheet>(null);

  // callbacks
  const handleSheetChanges = useCallback((index: number) => {
    console.log('handleSheetChanges', index);
  }, []);

  return (
    <View style={styles.container}>
      <BottomSheet
        ref={bottomSheetRef}
        onChange={handleSheetChanges}
        snapPoints={['5%', '25%', '50%', '75%', '90%']}
      >
        <BottomSheetView style={styles.contentContainer}>
          <Button title="a Button"/>
        </BottomSheetView>

        <View>
          <Button title="In Regular View"/>
        </View>
        <ScrollView>
        <Button title="In ScrollView"/>
        </ScrollView>
      </BottomSheet>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 24,
    backgroundColor: 'grey',
  },
  contentContainer: {
    flex: 1,
    alignItems: 'center',
  },
  textInput: {
    borderColor: 'lightgray',
    borderWidth: 2,
    padding: 5,
    fontSize: 20
  }
});

export default ManualForm;

In the example above, neither ScrollView nor View exhibit the same sort of issue. It might also be possible to not wrap the items with a View component.

*** This was tested on Expo Go

@Episodex
Copy link

Episodex commented Aug 28, 2024

I have the same problem still on 4.6.4. Changing BottomSheetView to View doesn't seem to do anything in my case. It's only on iOS and sometimes it crops just one button, sometimes more. It's kind of a show stopper unfortunately.

Edit: I noticed that v4 is not maintained anymore, so I installed 5.0.0-alpha.11 instead. The problem persisted, but when I changed enableDynamicSizing to true (and added back BottomSheetView) it now works perfectly.

Copy link

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.

Copy link

github-actions bot commented Oct 3, 2024

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

@github-actions github-actions bot closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

4 participants