React-native: [React ref]How to get the ref of listView's sectionHeader view

Created on 2 Nov 2015  路  1Comment  路  Source: facebook/react-native

  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?

Locked

Most helpful comment

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

>All comments

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

Was this page helpful?
0 / 5 - 0 ratings