react-native-sectioned-multi-select icon indicating copy to clipboard operation
react-native-sectioned-multi-select copied to clipboard

[Question] Can you make the chipsWrapper scrollable

Open Anthonyamcm opened this issue 5 years ago • 3 comments

is it possible to make the chipsWrapper scrollable so that only the chips underneath scroll rather than wrapping thw whole multi select in a scroll view

Anthonyamcm avatar Sep 30 '21 07:09 Anthonyamcm

This is only currentlly possible with customChipsRenderer prop. Here's something you could play with, I think this is what you mean.

// ...

const ref = React.useRef()

return (
  <SectionedMultiSelect
    ref={ref}
    customChipsRenderer={props => (
      <ScrollView
        style={{
          height: 58,
          width: '100%',
        }}
        contentContainerStyle={{
          alignItems: 'center',
          flexDirection: 'row',
          flexWrap: 'wrap',
          padding: 8,
        }}>
        {selectedItems.map(itemId => {
          const item = items.find(({id}) => id === itemId);
          return (
            <View
              style={{
                marginRight: 10,
                alignItems: 'center',
                marginBottom: 6,
                paddingVertical: 4,
                backgroundColor: 'white',
                borderRadius: 24,
                flexDirection: 'row',
                borderColor: props.colors.chipColor,
                borderWidth: 1,
              }}
              key={item.id}>
              <Text
                style={{
                  fontSize: 16,
                  fontWeight: 'bold',
                  color: props.colors.chipColor,
                  marginLeft: 16,
                }}>
                {item.title}
              </Text>
              <TouchableOpacity
                style={{padding: 4, marginRight: 8}}
                onPress={() => ref.current?._removeItem(item)}>
                <Icon name="close" size={18} />
              </TouchableOpacity>
            </View>
          );
        })}
      </ScrollView>
    )}
// ...

renrizzolo avatar Dec 14 '21 15:12 renrizzolo

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.

github-actions[bot] avatar Jan 14 '22 02:01 github-actions[bot]

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

github-actions[bot] avatar Jan 20 '22 02:01 github-actions[bot]