zubairpaizer / react-native-searchable-dropdown

Searchable Dropdown
148 stars 98 forks source link

textInputProps fails to pass props to textInput #24

Closed inf3rnus closed 3 years ago

inf3rnus commented 5 years ago

Hi, after playing around with this for a half an hour I have decided the passing of props to the internal textInput component is broken.

Please check the way the textInputProps prop is being distributed to the props of the textInput component inside of the SearchableDropdown.

Currently the following code fails to produce any change to my SearchableDropdown (notice the max length prop, it does not restrict the textInput field to 35 characters):

              <SearchableDropdown
                onTextChange={text => this.state.building = text}
                onItemSelect={item => this.state.building = item.name}
                // AlignSelf breaks wrapping, as wrapping and flex is controlled by parent component's calculated dimensions.
                containerStyle={{
                  alignSelf: 'stretch',
                  marginBottom: 10,
                  backgroundColor: 'white',
                  borderBottomWidth: 3,
                  borderBottomColor: '#CCCCCC'
                }
                }
                textInputStyle={{
                  alignSelf: 'stretch',
                  padding: 0,
                  marginLeft: 10
                }}
                itemStyle={{
                  alignSelf: 'stretch',
                  marginHorizontal: 20,
                  padding: 10,
                  marginVertical: 2,
                  backgroundColor: '#CFB87C',
                  borderColor: '#E6E6E6',
                  borderWidth: 1,
                  borderRadius: 5,
                }}
                itemTextStyle={{ color: '#222' }}
                itemsContainerStyle={{ alignSelf: 'stretch', maxHeight: 150 }}
                items={items}
                defaultIndex={null}
                placeholder="Enter building"
                resetValue={false}
                textInputProps={{maxLength: 35}}
                underlineColorAndroid="transparent"
              />