Search code examples
reactjsreact-nativeswipereact-native-swiper

When swiping react native app - screens shows twice


Live example https://snack.expo.dev/su1-U5DZc

If I swipe screens with buttons - everything okay, but if I swipe with gesture - screens shows twice. Why so? Does this setWtf(state.index);

const onTouchStart = (e, state, context) => {
        console.log('onTouchStart: ' + state.index);
        setWtf(state.index);
    };

make index stored somewhere by reference and then get updated?


Solution

  • Yes it was due to setWtf(state.index);. There is a reported bug of render issue when updating state in their official git page.

    They are saying to downgrade react-native-swiper to version 1.5.5 or you could follow other solutions mentioned here : Update the state breaks the slides