leecade / leecade/react-native-swiper

onIndexChanged does not fire on android

Open
#1,248 3 comments 0 reactions 0 assignees View on GitHub

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:

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.