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

Disabled MultiSelect Not Showing Previous Selected Chips After Being Disabled #234

Open
martyparker13 opened this issue Dec 6, 2023 · 1 comment

Comments

@martyparker13
Copy link

martyparker13 commented Dec 6, 2023

Hi,
Is there a way to disable the MultiSelect but still show the items/chips that have been selected? I tried using disable with the alwaysRenderItemSelected prop. The dropdown is disabled but not showing any of the selected items before its disabled.

Thanks

Expected Result - I need to show what has been selected previously but not allow edits
7704316D-FFC5-487E-AA67-ECA4BFB78C71_1_201_a

Actual result - Dropdown is disabled but does not show chips
B9962627-CF0A-42CE-8476-0591964CF465_4_5005_c

const [selected, setSelected] = useState([]);
const handleMultiSelectChange = (selectedItems) => {
        setState({ ...state, carType: selectedItems })
        setSelected(selectedItems);
        // Update the selected state when the user makes a selection
        console.log("called in multiselect");
      };

<View style={styles.container}>
    {carTypes ?
            <MultiSelect
                disable={car && car.id ? true : false}
                style={styles.dropdown}
                placeholderStyle={styles.placeholderStyle}
                selectedTextStyle={styles.selectedTextStyle}
                iconStyle={styles.iconStyle}
                data={carTypes}
                labelField="label"
                valueField="value"
                activeColor="#91A3B0"
                placeholder="Select The Services You Will Provide"
                value={selected}
                onChange={handleMultiSelectChange}
                mode='modal'
                renderLeftIcon={() => (
                        <MaterialCommunityIcons name="road" size={20} color={ colors.HEADER}  style {{paddingRight:35}} />
                )}
                selectedStyle={styles.selectedStyle}
                alwaysRenderItemSelected={true}
            />
            
      
        : null}
</View>




@martyparker13 martyparker13 changed the title Disable Option But Continue to Display What Has Been Selected Disabled MultiSelect Not Showing Previous Selected Chips After Being Disabled Dec 8, 2023
@martyparker13
Copy link
Author

Any help is appreciated! thanks @hoaphantn7604

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

No branches or pull requests

1 participant