# react-native-3dcube-navigation

> 3D cube navigation JS

Latest version **1.0.5** (published 2022-05-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-3dcube-navigation
pnpm add react-native-3dcube-navigation
yarn add react-native-3dcube-navigation
bun add react-native-3dcube-navigation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-05-03 |
| First published | 2017-10-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 287 |
| Author | Zeh Fernandes |
| Maintainers | zehfernandes |
| Keywords | react-component, react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-3dcube-navigation
- Repository: https://github.com/zehfernandes/react-native-3dcube-navigation
- Homepage: https://github.com/zehfernandes/react-native-3dcube-navigation#readme
- Issues: https://github.com/zehfernandes/react-native-3dcube-navigation/issues
- npm.io page: https://npm.io/package/react-native-3dcube-navigation

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.5.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2022-05-03
- 1.0.4 — 2018-06-08
- 1.0.3 — 2018-04-26
- 1.0.2 — 2017-12-05
- 1.0.1 — 2017-10-06
- 1.0.0 — 2017-10-06

## README

<img src="imgs/logo.png" width="150px" />

# react-native-3dcube-navigation

### Installation

##### With Yarn

```bash
$ yarn add react-native-3dcube-navigation
```

##### With NPM

```bash
$ npm i react-native-3dcube-navigation --save
```

### Demo

<img src="imgs/demo.gif"  />

### Basic Usage

##### Horizontal
```js
import { CubeNavigationHorizontal } from 'react-native-3dcube-navigation'

<View style={styles.father} >
  <CubeNavigationHorizontal ref={view => { this.cube = view; }}>
    <View style={[styles.container, { backgroundColor: '#5CDB8B' }]}>
      <Text style={styles.text}>Horizontal Page 1</Text>
    </View>
    <View style={[styles.container, { backgroundColor: '#A3F989' }]}>
      <Text style={styles.text}>Horizontal Page 2</Text>
    </View>
    <View style={[styles.container, { backgroundColor: '#CBF941' }]}>
      <Text style={styles.text}>Horizontal Page 3</Text>
    </View>
  </CubeNavigationHorizontal>
</View >
```

##### Vertical
```js
import { CubeNavigationVertical } from 'react-native-3dcube-navigation'

<View style={styles.father} >
  <CubeNavigationVertical ref={view => { this.cube = view; }}>
    <View style={[styles.container, { backgroundColor: '#5CDB8B' }]}>
      <Text style={styles.text}>Vertical Page 1</Text>
    </View>
    <View style={[styles.container, { backgroundColor: '#A3F989' }]}>
      <Text style={styles.text}>Vertical Page 2</Text>
    </View>
    <View style={[styles.container, { backgroundColor: '#CBF941' }]}>
      <Text style={styles.text}>Vertical Page 3</Text>
    </View>
  </CubeNavigationVertical>
</View >
```

### Properties

| Prop  | Default  | Type | Description |
| :------------ |:---------------:| :---------------:| :-----|
| expandView | false | `bool` | If `true`, the view expands not showing the background |
| loop | false | `bool` | If `true`, the last face will be allowed to scroll to the first |
| scrollLockPage | null | `number` | Lock swipe to the next pages, referring the index number of the page |
| responderCaptureDx | 60 | `number` | The increment at which the responder captures the touch |
| callBackAfterSwipe | null | `function` | Callback function after release |
| callbackOnSwipe | null | `function` | Callback function on start swipe & release, callback's first argument `started` defines if it's the start of the swipe or the release  |

### Events

#### callBackAfterSwipe

| Name  | Type     | Description |
| :---- | :------: | :--- |
| position | `number`   | Position of the view. |
| index | `number`   | Index of the view |

```js
callBackAfterSwipe = (position, index){
  
}

render(){
  return (
    <CubeNavigationHorizontal callBackAfterSwipe={this.callBackAfterSwipe}>
    </CubeNavigationHorizontal>
  );
}
```

### Methods

#### scrollTo(index, animated)

| Name  | Type     | default | Description |
| :---- | :------: | :------: | :--- |
| index | `number`   | `undefined` | Scroll to the page, start in 0. |
| animated | `bool`   | `true` |  |

### Examples

```bash
$ cd examples
$ npm i
$ react-native run-ios
```

<br/>

> Inspired by [tlackemann](https://github.com/tlackemann/react-native-cube-transition) but implemented only with react-native libs.

---
_Source: https://npm.io/package/react-native-3dcube-navigation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
