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

[React ref]How to get the ref of listView's sectionHeader view #3829

Closed
xiekw2010 opened this issue Nov 2, 2015 · 1 comment
Closed

[React ref]How to get the ref of listView's sectionHeader view #3829

xiekw2010 opened this issue Nov 2, 2015 · 1 comment
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@xiekw2010
Copy link

  render() {
    <ListView
      ref={'listView'}
      dataSource={this.state.dataSource}
      renderRow={this.renderRow}
      renderSectionHeader={this.renderSectionHeader}
    />
  },

  renderSectionHeader() {
    <DXTextMenu
      ref={'textMenu'}
      style={{height: TEXT_MENU_HEIGHT}}
    />
  },

  componentDidMount() {
    // Got it
    const list = this.refs['listView'];

    // Not found
    const textMenu = this.refs['textMenu'];
  },

As the code shows, I can get the listView ref but not the listView's header's ref, how can I get it?

@ide
Copy link
Contributor

ide commented Nov 2, 2015

Use callback refs, which are superior to string refs: ref={component => whatever}

@ide ide closed this as completed Nov 2, 2015
@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants