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

fix: correct Chip touchable style #2976

Merged
merged 2 commits into from
Dec 10, 2021
Merged

fix: correct Chip touchable style #2976

merged 2 commits into from
Dec 10, 2021

Conversation

lukewalczak
Copy link
Member

Fixes: #2972, #2959

Summary

Setting the flexGrow to Touchable within Chip

Android ios web
Zrzut ekranu 2021-11-9 o 19 24 33 Zrzut ekranu 2021-11-9 o 19 31 52 Zrzut ekranu 2021-11-9 o 19 31 58

at the same time it's not breaking the previous issue: #2804

Android ios web
previous_bug bug_prev_ios bug_prev_web

Test plan

Run the code below from one of the issues and expect Chips are displayed properly:

import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Chip, List } from 'react-native-paper';

const ChipExample = () => {
  return (
    <>
      <List.Section title="Flat chip">
        <View style={styles.row}>
          <Chip selected onPress={() => { }} style={styles.chip}>
            Simple 1
          </Chip>
          <Chip selected onPress={() => { }} style={styles.chip}>
            Simple 2
          </Chip>
          <Chip selected onPress={() => { }} style={styles.chip}>
            Simple 3
          </Chip>
        </View>
      </List.Section>
    </>
  );
};

const styles = StyleSheet.create({
  row: {
    flexDirection: 'row',
    flexWrap: 'wrap',
    paddingHorizontal: 12,
  },
  chip: {
    margin: 4,
  },
});

export default ChipExample;

@github-actions
Copy link

github-actions bot commented Nov 9, 2021

The mobile version of example app from this branch is ready! You can see it here

.

@brunohkbx
Copy link
Collaborator

Thanks @lukewalczak. I didn't realize that using flex: 1 in the touchable would cause problems.
WDYT about adding a test to track this regression described in #2972?

@lukewalczak
Copy link
Member Author

@brunohkbx sure, good point! Will add it!

@lukewalczak
Copy link
Member Author

After the research I guess we are not able to test the regression without e2e tests. Snapshot indicates only change from flex to flexGrow. Also the component is always available within the tree, so firing event on it will always pass as well.

@callstack-bot
Copy link

Hey @lukewalczak, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@github-actions
Copy link

github-actions bot commented Dec 8, 2021

The mobile version of example app from this branch is ready! You can see it here

.

@lukewalczak lukewalczak merged commit 69d5ffe into main Dec 10, 2021
@lukewalczak lukewalczak deleted the fix/chip-styles branch December 10, 2021 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chip does not have a height
3 participants