Comments (4)
@jonathandion I'll reproduce my answer to this issue :)
My guess is that you're trying to render the carousel while it has no child at all. Am I right? Indeed, this would fail since the component depends on children's length. We need to improve component's state management in order to handle this kind of usage.
For now, I would recommend you to render the carousel conditionally. Something along those lines:
get loader () {
return (
<ActivityIndicator size={'small'} />
);
}
get carousel () {
const { entries } = this.state;
return (
<Carousel>
{ entries }
</Carousel>
);
}
render () {
const { products } = this.state;
return !products.length ? this.loader : this.carousel;
}
Does this do the trick for you?
from react-native-snap-carousel.
@jonathandion Hi,
This is probably the same issue as #35. There must be something wrong with component's state management. I'll look into it as soon as possible.
from react-native-snap-carousel.
@bd-arc Hey Benoit,
Thanks sorry for the misunderstood. When I mean dynamic" I mean using data from my server using Ajax. When I use this.state.products
I have that error.
this is working {this.renderProducts([{ title : "test"}, { title : "test" }])}
not {this.renderProducts(this.state.products)}
I fetch my products inside componentDidMount
and set the state after receiving the data. The default state is this.state({ products: []})
.
We really need to have data ?
from react-native-snap-carousel.
@bd-arc thanks it's working 👍
from react-native-snap-carousel.
Related Issues (20)
- how to detect slide animation end??
- snap carousel
- ViewPropTypes will be removed from React native HOT 1
- Fix ViewPropTypes usage for deprecated prop types HOT 2
- !!!! DEPRECATED !!!! react-native-snap-carousel
- Cannot read property 'array' of undefined HOT 3
- Upgrade this to new react-native version 0.71
- viewproptypes will be removed from react native issue, fixed. HOT 4
- The loop simply stops while swiping right when it reaches the 3rd index HOT 5
- ViewPropTypes will be removed from React Native, along with all other PropTypes HOT 1
- Align carousel items to the left. HOT 1
- accessing touch gesture handler or control from carousel component
- error while updating property 'transform' of a view managed by rctview
- ViewPropTypes is deprecated HOT 6
- custom carousel with centered image and 2 images in each side
- ViewPropTypes needs to be exported from 'deprecated-react-native-prop-types' package instead 'react-native' HOT 4
- sub Element cannot response click event when scrollView is scrolling. HOT 1
- Dynamic Height Content in Carousel
- when i set startAutoplay to true, it cannot auto play, i do not know wht
- white space is coming if I disabled the infinite scroll 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-snap-carousel.