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

Surface and Card on iOS is weird #3943

Open
pnthach95 opened this issue Jun 22, 2023 · 3 comments
Open

Surface and Card on iOS is weird #3943

pnthach95 opened this issue Jun 22, 2023 · 3 comments
Assignees

Comments

@pnthach95
Copy link

pnthach95 commented Jun 22, 2023

Current behaviour

I have this item on horizontal flatlist.

const Relation = () => {
  return (
    <Surface style={styles.surface}>
      <TouchableRipple
        borderless
        style={styles.touchable}
        onPress={onPress}>
        <View style={styles.body}>
          {/** render something */}
        </View>
      </TouchableRipple>
    </Surface>
  );
};

const styles = StyleSheet.create({
  body: {
    alignItems: 'center',
    padding: 12
  },
  surface: {
    marginVertical: 12,
    maxWidth: 140,
    borderRadius: 16,
  },
  touchable: {
    backgroundColor: 'rgb(153, 246, 228)',
    borderRadius: 16,
    flexGrow: 1,
  },
})

Items have different height, so I set flexGrow: 1 in TouchableRipple. But it only works on Android. On iOS, it doesn't grow to fill like Android.

Card component has same bug.

Expected behaviour

View inside Surface should fill all when flexGrow: 1 is set

How to reproduce?

https://snack.expo.dev/@pnthach95/surfaceios

Preview

Android
android

iOS
ios

What have you tried so far?

I set flex: 1 at this line

flex: flattenedStyles.height ? 1 : undefined,

Your Environment

software version
ios 16.5
android 13
react-native 0.71.11
react-native-paper 5.8.0
node 16.19.0
yarn 1.22.19
expo sdk x.x.x
@RohovDmytro
Copy link

I experience similar visual weirdness with a Card component.

@lukewalczak
Copy link
Member

Hey @RohovDmytro, could you please also attach your example, to make sure that we'll fix both issues?

@pnthach95 pnthach95 changed the title Surface on iOS is weird Surface and Card on iOS is weird Jun 30, 2023
@pnthach95
Copy link
Author

Hi @lukewalczak, I updated my snack with Card component.

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

No branches or pull requests

4 participants