oblador / react-native-parallax

Parallax effects for React Native using Animated API
MIT License
585 stars 78 forks source link

Height of image start to change after adding onScroll #11

Closed trane294 closed 8 years ago

trane294 commented 8 years ago

Doesn't matter what Im function im adding into <Parallax.ScrollView onScroll={() => {}}> with every row image height becoming less and less

<Parallax.ScrollView
    style={styles.scrollView}
    onScroll={() => console.log(123)}
>
          {DATA.map((story, i) => (
            <Parallax.Image
              onPress={() => this.goToArticle(story)}
              key={i}
              style={styles.image}
              overlayStyle={styles.overlay}
              source={{ uri: IMAGE_URI_PREFIX }}
              parallaxFactor={PARALLAX_FACTOR}
            >
              <Text style={styles.title}>{story.title}</Text>
            </Parallax.Image>
          ))}
          </Parallax.ScrollView>
var IMAGE_WIDTH = Dimensions.get('window').width;
var IMAGE_HEIGHT = IMAGE_WIDTH / 2;

But if Im removing onScroll everything becoming perfect

screen shot 2015-12-10 at 10 58 31 pm screen shot 2015-12-10 at 10 58 38 pm screen shot 2015-12-10 at 10 58 45 pm

oblador commented 8 years ago

Hi, the Parallax.ScrollView needs the onScroll callback to animate the images. When you override it the images wont get animated :-/

I can add support for bubbling the event upwards but that would remove support for future optimizations of Animated to be run in a native prioritized thread.