catalinmiron / react-native-movie-2.0-carousel

react-native-movie-2.0-carousel
173 stars 58 forks source link

Backdrop doesn't work in Android #1

Open j-rayhan opened 4 years ago

j-rayhan commented 4 years ago

Please test this code on android. It's doesn't work in android phone


const Backdrop = ({ movies, scrollX }) => {
  return (
    <View style={{ position: 'absolute', width, height: BACKDROP_HEIGHT }}>
      <FlatList
        data={movies}
        keyExtractor={(item) => item.key}
        renderItem={({ item, index }) => {
          if (!item.backdrop) {
            return null;
          }

          const inputRange = [(index - 2) * ITEM_SIZE, (index - 1) * ITEM_SIZE];

          const translateX = scrollX.interpolate({
            inputRange,
            outputRange: [-width, 0],
          });
          return (
            <MaskedView
              style={{ position: 'absolute' }}
              maskElement={
                <AnimatedSvg
                  width={width}
                  height={height}
                  viewBox={`0 0 ${width} ${height}`}
                  style={{ transform: [{ translateX }] }}
                >
                  <Rect x='0' y='0' width={width} height={height} fill='red' />
                </AnimatedSvg>
              }
            >
              <Image
                source={{ uri: item.backdrop }}
                style={{
                  width,
                  height: BACKDROP_HEIGHT,
                  resizeMode: 'cover',
                }}
              />
            </MaskedView>
          );
        }}
      />
      <LinearGradient
        colors={['transparent', 'white']}
        style={{
          width,
          height: BACKDROP_HEIGHT,
          position: 'absolute',
          bottom: 0,
        }}
      />
    </View>
  );
};
ihsanrawi commented 4 years ago

Do you know how to fix this? @j-rayhan

MyNameIsNero commented 3 years ago

@ihsanrawi @ihsanrawi Please check current code in this project. Already overwrite for support on android