Comments (5)
@minhtamwebmaster Not supported currently but will definitely be part of a next release.
from react-native-swipeable-parallax-carousel.
@minhtamwebmaster I've found a work around, might help.
Start by adding a global varriable var timer;
Add an interval to the constructor
:
if (this.props.autoPlay) {
timer = setInterval(() => {
this._forceSwipe('left');
}, this.props.playTime);
}
Also need to clearInterval
:
componentWillUnmount() {
clearInterval(timer);
}
Then change _forceSwipe()
to:
_forceSwipe(direction) {
const { autoPlay } = this.props;
let distance = (direction === 'right') ? this.state.screenWidth : -this.state.screenWidth;
// Calculate nextItem
const currentitem = this.state.currentItem;
const totalItems = this.props.data.length;
let newitem = (direction === 'right') ? currentitem - 1 : currentitem + 1;
if (autoPlay && newitem === totalItems) {
distance = this.state.screenWidth * (totalItems - 1);
newitem = 0;
}
this.setState({ nextItem: newitem });
Animated.spring(this.position, {
toValue: { x: distance, y: 0 },
}).start(() => this._onSwipeComplete(newitem));
}
And then you can add the props to the Carousel component like this:
<Carousel
data={dataCarousel}
parentScrollViewRef={this.parentScrollView}
autoPlay={true}
playTime={5000}
navigationType="bars"/>
If you want I can try to commit it.
from react-native-swipeable-parallax-carousel.
from react-native-swipeable-parallax-carousel.
@minhtamwebmaster Since I have no permission to commit anything to this repo, I have created a node is module for this myself.
https://github.com/danielMensah/react-native-smart-carousel
from react-native-swipeable-parallax-carousel.
@davidsamacoits this repo still working?
from react-native-swipeable-parallax-carousel.
Related Issues (10)
- Add preview subfolder to ignore list HOT 1
- [Request] Exclusively lock PanResponder to container
- Issues with wix/react-native-navigation drawer HOT 2
- How to use navigationType ? HOT 4
- How to use autoPlay HOT 1
- a function to swipe one element
- auto play is not working HOT 1
- image styling? HOT 1
- Navigation style HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-swipeable-parallax-carousel.