GithubHelp home page GithubHelp logo

Comments (2)

thanhtunguet avatar thanhtunguet commented on June 8, 2024

I am trying to build a slide depending on a condition, for this reason, I have my JSX that look like following:

        <RNWSwiper
          from={0}
          minDistanceForAction={0.1}
        >
          {photoList.length > 0 ? photoList.map(({ filename }) => (
            <View
              key={filename}
              style={{
                flex: 1,
                alignItems: 'center',
                justifyContent: 'center',
                backgroundColor: 'transparent',
              }}
            >
              <Image
                style={{ minHeight: '100%', minWidth: '100%' }}
                source={{ uri: `${urls.dataApi}/resources/${id}/lg/${filename}` }}
              />
            </View>
          )) : (
            <>
              <View
                style={{
                  flex: 1,
                  alignItems: 'center',
                  justifyContent: 'center',
                  backgroundColor: 'rgba(20,20,200,0.3)',
                }}
              >
                <Text>Slide 1</Text>
              </View>
              <View
                style={{
                  flex: 1,
                  alignItems: 'center',
                  justifyContent: 'center',
                  backgroundColor: 'rgba(20,200,20,0.3)',
                }}
              >
                <Text>Slide 2</Text>
              </View>
              <View
                style={{
                  flex: 1,
                  alignItems: 'center',
                  justifyContent: 'center',
                  backgroundColor: 'rgba(200,20,20,0.3)',
                }}
              >
                <Text>Slide 3</Text>
              </View>
            </>
          )}
        </RNWSwiper>

This cause the 3 views to be stacked on top of each other and have only one page of slide.

While I was expecting to have 3 slides.

Any tought about this and the possible fix?

Do not wrap your slides in a Fragment element. As I see in the code, each child element will be treated as a slide.

from react-native-web-swiper.

jarvisluong avatar jarvisluong commented on June 8, 2024

Instead of using Fragment in this case, you can wrap the Slides in an array

from react-native-web-swiper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.