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

applying onFocus disable list opening #65

Open
ionistrati opened this issue Mar 19, 2021 · 3 comments
Open

applying onFocus disable list opening #65

ionistrati opened this issue Mar 19, 2021 · 3 comments

Comments

@ionistrati
Copy link

I want to add the onFocus method, but it doesn't open the list. I think it's overwriting the method to open the list, any workarounds for this?

@domhacking
Copy link

@ionistrati , were you able to resolve this? Thanks

@domhacking
Copy link

@ionistrati, On reading some of the other issues it seems you can pass onFocus or onBlur directly to the component e.g

<SearchableDropdown
        onItemSelect={props.onItemSelect}
        onRemoveItem={props.onRemoveItem}
        itemStyle={styles.dropdownRow}
        itemTextStyle={styles.dropdownText}
        itemsContainerStyle={styles.dropdownContainer}
        items={props.items}
        defaultIndex={2}
        resetValue={false}
        onBlur={() => setDropdownActive(false)}
        onFocus={() => setDropdownActive(true)}
        textInputProps={{
          style: {
            padding: 12,
            paddingLeft: dropdownActive ? 50 : 12,
            borderWidth: 1,
            borderColor: '#ccc',
            borderRadius: 5,
          },

          onTextChange: text => console.log('Group', text),
        }}
        listProps={{
          nestedScrollEnabled: true,
        }}
      />

@shanutthankachan
Copy link

  • Go to your node_module
  • Find react-native-searchable-dropdown package
  • Update focus: false to focus: true in index.js
export default class SearchableDropDown extends Component {
  constructor(props) {
    super(props);
    this.renderTextInput = this.renderTextInput.bind(this);
    this.renderFlatList = this.renderFlatList.bind(this);
    this.searchedItems = this.searchedItems.bind(this);
    this.renderItems = this.renderItems.bind(this);
    this.state = {
      item: {},
      listItems: [],
      //focus: false
      focus: true
    };
  }

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

3 participants