react-native-collapsible icon indicating copy to clipboard operation
react-native-collapsible copied to clipboard

ListView within collapsible

Open myfoostrong opened this issue 10 years ago • 4 comments

Hey how's it going? Love the library but I'm having a little trouble putting a ListView within a collapsible component.

Whenever I put a ListView into a Collapsible, it seems to lose the screen border, and renders the rest of the list off page with no scrolling (But collapsing works fine!). If I remove Collapsible, it flex's to the edge of screen and allows scroll.

If I give the ListView a static height, it renders and scrolls fine, but needs to be precise, and feels wrong. I think something about collapsible is losing the screen dimensions? I'm sure I'm missing a React trick somewhere, I've just started playing around with this.

So essentially: Parent Class:

  renderPage: function(){
    return (
      <View style={styles.main} >
        <TouchableOpacity onPress={this.toggleRoster} >
          <KkToolbar title={"Roster"} />
        </TouchableOpacity>
        <Collapsible collapsed={!this.state.rosterToggle} style={styles.roster}>
          <Child id={this.props.id} navigator={this.props.navigator} />
        </Collapsible>
        <KkToolbar title={"Team Matches"}/>
      </View>
    );
  },

Child Class:

 renderChild: function(){
    return (
      <View style={styles.main} >
        <TouchableOpacity onPress={this.grabTeamHistory.bind(this,this.state.team_id)}>
            <KkToolbar title={this.state.team} style={[this.props.style]} />         
          </TouchableOpacity>
        <ListView
            dataSource={this.state.dataSource}
            renderRow={this.renderPlayer}
            style={[styles.roster]}  />
      </View>
    );
  },

and, the styles:

  main: {
    flex: 1,
    flexDirection: 'column',
    //alignItems: 'center',
    backgroundColor: '#000',
  },
  roster: {
    flexDirection: 'column',
    flex:1,
    // height: windowSize.height-269,
  },

myfoostrong avatar Jan 25 '16 19:01 myfoostrong

Hi, it seems like a bug. Collapsible.js ..... start(event => this.setState({ animating: true }));

fix: start(event => this.setState({ animating: false }));

Cheers

Efimster avatar Mar 16 '16 19:03 Efimster

It is fixed on github, but not in latest npm package

Efimster avatar Mar 16 '16 19:03 Efimster

Released in 0.5.6.

oblador avatar Mar 16 '16 19:03 oblador

thank you!

Efimster avatar Mar 16 '16 19:03 Efimster