Skip to content

fix: correct Chip touchable style#2976

Merged
lukewalczak merged 2 commits intomainfrom
fix/chip-styles
Dec 10, 2021
Merged

fix: correct Chip touchable style#2976
lukewalczak merged 2 commits intomainfrom
fix/chip-styles

Conversation

@lukewalczak
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Member Author

@brunohkbx sure, good point! Will add it!

@lukewalczak
Copy link
Copy Markdown
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
Copy Markdown

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

@github-actions
Copy link
Copy Markdown

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