leecade / leecade/react-native-swiper
onIndexChanged does not fire on android
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Which OS ?
Android 11
Version
Which versions are you using:
- react-native-swiper v ^1.6.0
- react-native v https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz
- expo v ^39.0.0
Expected behaviour
onIndexChanged should fire with the correct Index
index in renderPagination should render with correct index
Actual behaviour
onIndexChanged is not fired at all.
renderPagination is always fired with index equals Zero
How to reproduce it>
This is the component Used
const swiper = ()=>
( <Swiper
onIndexChanged={onImageIndexChange}
renderPagination={(index, total, context) => {
console.log(index, total, context);
return (
<View>
<Text >
{index}/{total}
</Text>
</View>
);
}}
>
{images.map(renderImage)}
</Swiper>);`
const onImageIndexChange = (index) => {
console.log(index);
// this.setState({currentImageIndex:index})
};
const renderImage = (image, index) => {
const uri = `${imagePath}${image}`;
return (
<Image
key={index}
resizeMode={"stretch"}
source={{ uri }}
/>
);
};
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied reproduction on Android 11 using react-native-swiper v1.6.0, React Native SDK 39.0.3, and Expo 39. Check whether swiping updates the pagination index and invokes onIndexChanged. Done means the callback receives the current index and renderPagination no longer always receives zero.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100