1.0.6 • Published 4 years ago

rn-karuselli v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

React native karuselli

gif

Swipeable component with paging.

Installation

npm install rn-karuselli

yarn add rn-karuselli

Usage

Karuselli works as horizontal FlatList. You can use it as it is or as modal

Add a "key" props for each view

<Karuselli
  views={[<Landing key={0} />, <SignIn key={1} />, <Next key={2} />]}
  colors={colors}
  dotColor={"#d3d3d3"}
/>

As modal:

function App() {
  const [visible, setVisible] = useState(true)
  const handleModalClose = () => {
    setVisible(!visible)
  }

  const Landing = () => {
    return (
      <View>
        <Text>Landing</Text>
      </View>
    )
  }

  const Info = () => {
    return (
      <View>
        <Text>Info</Text>
      </View>
    )
  }

  const Next = () => {
    return (
      <View>
        <Text>Next</Text>
        <TouchableHighlight onPress={() => handleModalClose()}>
          <Text>Close modal</Text>
        </TouchableHighlight>
      </View>
    )
  }

  return (
    <View style={{ flex: 1 }}>
      <Karuselli
        views={[<Landing key={0} />, <SignIn key={1} />, <Next key={2} />]}
        dotColor={"#c51c51"}
        colors={["red", "white", "gold"]}
        visible={visible}
        handleModalClose={handleModalClose}
      />
    </View>
  )
}

Properties

PropTypeDescription
viewsarrayAdd an array of views
colorsarrayList of colors, that works as backgroundcolors. Each page has its own backgroundcolor, that will interpolate to the next pages backgroundcolor. example: const colors = 'red', 'blue', 'yellow'
visiblebooleanYou can use Karuselli as Modal, pass the state of the modals visibility as props
dotColorstringDot color for the pagination, default is '#000000'

Contact

Email: joonas.aaltonen16@gmail.com

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago