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

Mixing static and dynamic items

Open lukasreusch opened this issue 9 years ago • 2 comments

Hi,

I saw, that you added support for dynamic items. This is working well. Using multiple static items is working well too. But if I have one static item and multiple dynamic items the swiper only shows the static + one of the dynamic. So I always get two "pages".

Any ideas how to solve this?

lukasreusch avatar Sep 15 '17 21:09 lukasreusch

I dont know if this will help you but I had a similar problem and I solved it with something like this. Making a new array containing the dynamic and static items using ES6 spread seems to fix it.

render(){
    const generatedArray = something.map(thing => somethingToReturn);
    return(
        {
        [
          // previously defined array which will get updated at some point
        ...generatedArray,
        // static slide
        <View style={styles.slide} key={uuid.v4()}>
          <Button
            title="end quiz"
            action={() => console.log("ended")}
          />
        </View>,
        ]
        }
    )
}

VanceLongwill avatar Sep 16 '17 10:09 VanceLongwill

Your workaround works fine ! Thanks !

thomrick avatar Jun 26 '18 09:06 thomrick