AdelRedaa97 / react-native-select-dropdown

react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.
MIT License
322 stars 139 forks source link

How to stop button text from being truncated #105

Closed Jake-Mulhern closed 6 months ago

Jake-Mulhern commented 1 year ago

I have set up my drop down component, however the text within the dropdown is truncated. I would like it to display the entire text regardless of the length of the string.

This is my current code:

<SelectDropdown
                defaultValue={Constants['walletList'][defaultDropdownValue().nickName] ? Constants['walletList'][defaultDropdownValue()].nickName : Constants['walletList'][defaultDropdownValue()]}
                data={Constants['walletList']}
                onSelect={(selectedWallet) => {
                  setGlobalVariableValue({
                    key: 'currentWallet',
                    value: selectedWallet
                  });
                }}
                buttonTextAfterSelection={(selectedWallet) => {
                  return selectedWallet.walletInstance.address
                }}
                rowTextForSelection={(item, index) => {
                  return item.walletInstance.address
                }}
                buttonStyle={{ backgroundColor: theme.colors['Background'], padding: 0, margin: 0 }}
                buttonTextStyle={{ fontSize: 14, padding: 0, margin: 0 }}
                renderDropdownIcon={() => {
                  return (
                    <Icon
                      size={18}
                      name={'AntDesign/down'}
                      color={'#3D4C63'}
                    />
                  )
                }}
              />
Jake-Mulhern commented 1 year ago

There also appears to be some padding or margin on the button. I tried setting the buttonStyle to {{ margin: 0, padding: 0 }} but I still can't line up another element directly next to the text. Is there any additional documentation on styling the button so that I can customize it?

Juanfe98 commented 1 year ago

I'm not sure is this works for you but if it's the content inside the options... You can use renderCustomizedRowChild to render your own component and avoid the value to be truncated.

AdelRedaa97 commented 6 months ago

Fixed in v4.0 take a look at the changes made in v4.0 https://github.com/AdelRedaa97/react-native-select-dropdown?tab=readme-ov-file#-major-changes

Feel free to open the issue again if it still exists