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: allow addition of custom component to dropdown list, added unit … #77

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

azeezat
Copy link
Owner

@azeezat azeezat commented Aug 22, 2024

Description

  1. Allow addition of custom component to dropdown list
  2. Added autoCloseOnSelect prop that allows user to prevent dropdown from closing when only one option is selected

Fixes #73 #70

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

 <DropdownSelect
            label="Border has been removed"
            placeholder="Select users"
            options={[
              {
                value: '01',
                labelComponent: (
                  <View
                    style={{
                      flexDirection: 'row',
                      justifyContent: 'center',
                      alignItems: 'center',
                    }}>
                    <Image
                      style={styles.avatarStyle}
                      source={{
                        uri: 'https://avatar.iran.liara.run/public/boy?username=Ash',
                      }}
                    />

                    <Text>John Doe</Text>
                  </View>
                ),
              },
              {
                value: '02',
                labelComponent: (
                  <View
                    style={{
                      flexDirection: 'row',
                      justifyContent: 'center',
                      alignItems: 'center',
                    }}>
                    <Image
                      style={styles.avatarStyle}
                      source={{
                        uri: 'https://avatar.iran.liara.run/username?username=Azeezat+Raheem',
                      }}
                    />

                    <Text>James Bond</Text>
                  </View>
                ),
              },
            ]}
            optionLabel={'labelComponent'}
            optionValue={'value'}
            selectedValue={users}
            onValueChange={(itemValue: any) => setUsers(itemValue)}
            isSearchable
          />
Screenshot 2024-08-21 at 4 58 27 PM

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@azeezat azeezat self-assigned this Aug 22, 2024
@azeezat azeezat requested a review from Tabspear August 22, 2024 22:04
@azeezat azeezat merged commit 91870d5 into main Aug 22, 2024
3 checks passed
@azeezat azeezat deleted the fix/custom-label branch August 22, 2024 22:09
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

Successfully merging this pull request may close these issues.

Custom render label/value for options
1 participant