dohooo / react-native-reanimated-carousel

🎠 React Native swiper/carousel component, fully implemented using reanimated v2, support to iOS/Android/Web. (Swiper/Carousel)
https://react-native-reanimated-carousel.vercel.app
MIT License
2.82k stars 324 forks source link

the carousel is un working #406

Open HuziG opened 1 year ago

HuziG commented 1 year ago

Describe the bug 插件未生效

To Reproduce Steps to reproduce the behavior: null

Expected behavior null

Screenshots image

Source Code

import * as React from 'react';
import { Dimensions, Text, View } from 'react-native';
import Carousel from 'react-native-reanimated-carousel';

function Index() {
  const width = Dimensions.get('window').width;

  const [data, setData] = React.useState<number[]>([1, 2, 3, 4]);

  return (
    <View style={{ marginBottom: 30 }}>
      <Carousel
        loop
        style={{
          backgroundColor: '#333333',
        }}
        width={width}
        height={width / 2}
        autoPlay={true}
        data={data}
        scrollAnimationDuration={1000}
        onSnapToItem={(index) => console.log('current index:', index)}
        renderItem={({ index }) => (
          <View
            style={{
              flex: 1,
              borderWidth: 1,
              justifyContent: 'center',
            }}
          >
            <Text style={{ textAlign: 'center', fontSize: 30, color: '#ffffff' }}>
              index
            </Text>
          </View>
        )}
      />
    </View>
  );
}

export default Index;

Versions (please complete the following information):

Smartphone (please complete the following information):

Additional context null

luckyGTL commented 1 year ago

I encountered the same problem:

react: v17.0.2 react-native: v0.66.1 react-native-reanimated: v3.1.0 react-native-reanimated-carousel: v3.3.2 react-native-gesture-handler: v1.8.0

solutiontechseries commented 1 year ago

I'm facing the same problem whenever I'm enable the Chrome Debugger in Simulator and Android Device. It's working without debugger.