{"action":"created","issue":{"url":"https://api.github.com/repos/oblador/react-native-collapsible/issues/31","repository_url":"https://api.github.com/repos/oblador/react-native-collapsible","labels_url":"https://api.github.com/repos/oblador/react-native-collapsible/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/oblador/react-native-collapsible/issues/31/comments","events_url":"https://api.github.com/repos/oblador/react-native-collapsible/issues/31/events","html_url":"https://github.com/oblador/react-native-collapsible/issues/31","id":156870427,"number":31,"title":"Trouble using a Collapsible within a List View.","user":{"login":"SudoPlz","id":3070948,"avatar_url":"https://avatars.githubusercontent.com/u/3070948?v=3","gravatar_id":"","url":"https://api.github.com/users/SudoPlz","html_url":"https://github.com/SudoPlz","followers_url":"https://api.github.com/users/SudoPlz/followers","following_url":"https://api.github.com/users/SudoPlz/following{/other_user}","gists_url":"https://api.github.com/users/SudoPlz/gists{/gist_id}","starred_url":"https://api.github.com/users/SudoPlz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SudoPlz/subscriptions","organizations_url":"https://api.github.com/users/SudoPlz/orgs","repos_url":"https://api.github.com/users/SudoPlz/repos","events_url":"https://api.github.com/users/SudoPlz/events{/privacy}","received_events_url":"https://api.github.com/users/SudoPlz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-25T23:11:05Z","updated_at":"2016-05-26T10:05:28Z","closed_at":null,"body":"I have no idea what my problem is, but after hours of playing with it I found out, that if I create my custom element with `collapsible` set to true, all works well. \r\n\r\nFull code here:\r\n\r\n```javascript\r\n    import {Colors} from '../../../config/constants';\r\n    import React from 'react';\r\n    import {StyleSheet, Text, View, TouchableOpacity, ListView} from 'react-native';\r\n    import {getCorrectFontSizeForScreen} from '../../../lib/Utils/multiResolution'\r\n    import Dimensions from 'Dimensions';\r\n    const {height:h, width:w} = Dimensions.get('window'); // Screen dimensions in current orientation\r\n\r\n    import {createIconSetFromIcoMoon} from 'react-native-vector-icons';\r\n    import icomoonConfig from '../../../../assets/fonts/icomoon.json';\r\n    const PavIcon = createIconSetFromIcoMoon(icomoonConfig);\r\n    import Collapsible from 'react-native-collapsible';\r\n    import SubcommentContainerListCard from './SubcommentContainerListCard';\r\n    import getStyles from './accordionStyles'\r\n\r\n    class AccordionBillCommentCardContainer extends React.Component {\r\n      constructor(props) {\r\n        super(props);\r\n        this.state={\r\n          isCollapsed:true\r\n        }\r\n      }\r\n\r\n      expandCard(){\r\n        this.setState({isCollapsed:false});\r\n      }\r\n\r\n      collapseCard(){\r\n        this.setState({isCollapsed:true});\r\n      }\r\n\r\n      onHeaderClick(){\r\n        // alert(\"Render accordion content\");\r\n          this.setState({\r\n            isCollapsed:!this.state.isCollapsed\r\n          })\r\n      }\r\n\r\n      renderAccordionHeader(styles){\r\n        return (\r\n          <TouchableOpacity onPress={this.onHeaderClick.bind(this)} style={styles.headerContainer}>\r\n            <View style={styles.repliesBoxTextContainer}>\r\n              <Text style={styles.repliesBoxText}>{this.props.replies.length>1?this.props.replies.length+\" Replies \":\"1 Reply\"}  {this.state.isCollapsed==true?\"(Tap to expand)\":\"(Tap to collapse)\"}</Text>\r\n            </View>\r\n            <PavIcon name={this.state.isCollapsed==true?\"arrow-down\":\"arrow-up\"} size={15} style={styles.repliesBoxIcon}/>\r\n          </TouchableOpacity>\r\n        );\r\n      }\r\n\r\n\r\n\r\n\r\n      render() {\r\n        let isPortrait = (this.props.device.orientation!=\"LANDSCAPE\");\r\n        // console.log(\"@@@@ IS PORTRAIT : \"+isPortrait);\r\n        let styles= isPortrait?getStyles().getPortraitStyles(this):getStyles().getLandscapeStyles(this);\r\n        console.log(\"this.state.isCollapsed\"+this.state.isCollapsed);\r\n        return(\r\n          <View style={[styles.cardContainer,this.props.style]}>\r\n            {this.renderAccordionHeader(styles)}\r\n            <Collapsible collapsed={this.state.isCollapsed}>\r\n              <View style={{backgroundColor:'red', flex:1,}}>\r\n                <Text>Hello world\r\n                </Text>\r\n              </View>\r\n            </Collapsible>\r\n          </View>\r\n        );\r\n      }\r\n\r\n\r\n      shouldComponentUpdate(nextProps, nextState) {\r\n        return(\r\n          (nextProps.device.orientation !== this.props.device.orientation)\r\n          ||\r\n          (nextProps.replies !== this.props.replies)\r\n          ||\r\n          (nextState.isCollapsed !==this.state.isCollapsed)\r\n        );\r\n      }\r\n\r\n    }\r\n```\r\n\r\n\r\n![screen shot 2016-05-26 at 02 12 36](https://cloud.githubusercontent.com/assets/3070948/15558997/56a45694-22e7-11e6-9edc-5debba3050bc.png)\r\n\r\n\r\nIf on the other hand `collapsible` is set to false, the Collapsible never gets to work.\r\n\r\n\r\n![screen shot 2016-05-26 at 02 11 17](https://cloud.githubusercontent.com/assets/3070948/15558978/31805f70-22e7-11e6-893b-8e139032ad77.png)\r\n\r\nI really wanna use the Collapsible, but I've got great trouble using it within the ListView. \r\nWhat to do?"},"comment":{"url":"https://api.github.com/repos/oblador/react-native-collapsible/issues/comments/221830588","html_url":"https://github.com/oblador/react-native-collapsible/issues/31#issuecomment-221830588","issue_url":"https://api.github.com/repos/oblador/react-native-collapsible/issues/31","id":221830588,"user":{"login":"SudoPlz","id":3070948,"avatar_url":"https://avatars.githubusercontent.com/u/3070948?v=3","gravatar_id":"","url":"https://api.github.com/users/SudoPlz","html_url":"https://github.com/SudoPlz","followers_url":"https://api.github.com/users/SudoPlz/followers","following_url":"https://api.github.com/users/SudoPlz/following{/other_user}","gists_url":"https://api.github.com/users/SudoPlz/gists{/gist_id}","starred_url":"https://api.github.com/users/SudoPlz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SudoPlz/subscriptions","organizations_url":"https://api.github.com/users/SudoPlz/orgs","repos_url":"https://api.github.com/users/SudoPlz/repos","events_url":"https://api.github.com/users/SudoPlz/events{/privacy}","received_events_url":"https://api.github.com/users/SudoPlz/received_events","type":"User","site_admin":false},"created_at":"2016-05-26T10:05:28Z","updated_at":"2016-05-26T10:05:28Z","body":"I'm not using Android, but keep in mind that I use all that within a `ListView`.. Its a very weird error."}}
{"actor":{"display_login":"SudoPlz"}}