sanpyaelin / react-native-collapse-view

Collapse component for react native
MIT License
30 stars 16 forks source link

First all Items are open, then they collapse #2

Open xstable opened 6 years ago

xstable commented 6 years ago

If I open the Screen with your component, all Text is visible. Aftter some seconds, each item get collapsed:

20180606_215759

What is the way to prevent showing collapsing at first load... instead only the headlines should appear. Is there a kind of flag or event which is fired, if all items are fully loaded and collapsed?

Here my code:

    _renderIconView = (data) => (collapse) => {
        const answer = <Text style={styles.headerText} >{data.frage}</Text >;
        return (
            <View style={styles.iconView} >
                <View >
                    {
                        collapse ?
                            <Icon name='chevron-down' type='Feather' color={cfg.fontLight} > {answer}</Icon > :
                            <Icon name='chevron-right' type='Feather' color={cfg.fontLight} > {answer}</Icon >
                    }
                </View >
            </View >
        )
    }
    _renderCollapseView = (data) => (collapse) => {
        console.log("collapes",collapse);
        return (
            <View style={styles.content} >
                <HTML html={data.antwort.replace(/\r?\n/g, " ")}
                      baseFontStyle={fontStyles}
                      tagsStyles={tagStyles}
                      onLinkPress={(event, href) => {
                          Linking.openURL(ParseUrl(href)).catch(e => console.log("Fehler beim Aufruf der url: " + href, e));
                      }}
                />
            </View >
        )
    }

    render() {
        console.log("ich render");
        return (
            <View style={styles.faqWrapper} >
                {this.props.faq.map((data, index) => {
                    return <CollapseView
                        key={index}
                                         tension={10}
                                         renderView={this._renderIconView(data)}
                                         renderCollapseView={this._renderCollapseView(data)}
                    />
                })
                }
            </View >
        );
    };
}
xstable commented 6 years ago

I figured out... that slow is it only at debug-build. But on Release-Build you also see a small delay and flickering on startup

johnlaine1 commented 6 years ago

I see the same results. Much less noticeable in production. Lag seems to increase with the number of items on the screen.

aymen1989 commented 5 years ago

yes you are right when i putes countries names as items , it become more slowly and it don't show them all. there any other solution to fix that ?