<commit_before>// Parallax effect inspired by https://github.com/oblador/react-native-parallax/

import React, { Component } from 'react';
import { View, ViewPropTypes, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
import PropTypes from 'prop-types';
import styles from './ParallaxImage.style';

export default class ParallaxImage extends Component {

    static propTypes = {
        ...Image.propTypes,
        carouselRef: PropTypes.object, // passed from <Carousel />
        itemHeight: PropTypes.number, // passed from <Carousel />
        itemWidth: PropTypes.number, // passed from <Carousel />
        scrollPosition: PropTypes.object, // passed from <Carousel />
        sliderHeight: PropTypes.number, // passed from <Carousel />
        sliderWidth: PropTypes.number, // passed from <Carousel />
        vertical: PropTypes.bool, // passed from <Carousel />
        containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
        dimensions: PropTypes.shape({
            width: PropTypes.number,
            height: PropTypes.number
        }),
        fadeDuration: PropTypes.number,
        parallaxFactor: PropTypes.number,
        showSpinner: PropTypes.bool,
        spinnerColor: PropTypes.string
    };

    static defaultProps = {
        containerStyle: {},
        fadeDuration: 500,
        parallaxFactor: 0.3,
        showSpinner: true,
        spinnerColor: 'rgba(0, 0, 0, 0.4)'
    }

    constructor (props) {
        super(props);
        this.state = {
            offset: 0,
            width: 0,
            height: 0,
            status: 1, // 1 -> loading; 2 -> loaded // 3 -> transition finished; 4 -> error
            animOpacity: new Animated.Value(0)
        };
        this._onLoad = this._onLoad.bind(this);
        this._onError = this._onError.bind(this);
    }

    setNativeProps (nativeProps) {
        this._container.setNativeProps(nativeProps);
    }

    componentDidMount () {
        this._mounted = true;

        setTimeout(() => {
            this._measureLayout();
        }, 0);
    }

    componentWillUnmount () {<commit_msg>Bind this to _measureLayout in ParallaxImage<commit_after>// Parallax effect inspired by https://github.com/oblador/react-native-parallax/

import React, { Component } from 'react';
import { View, ViewPropTypes, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
import PropTypes from 'prop-types';
import styles from './ParallaxImage.style';

export default class ParallaxImage extends Component {

    static propTypes = {
        ...Image.propTypes,
        carouselRef: PropTypes.object, // passed from <Carousel />
        itemHeight: PropTypes.number, // passed from <Carousel />
        itemWidth: PropTypes.number, // passed from <Carousel />
        scrollPosition: PropTypes.object, // passed from <Carousel />
        sliderHeight: PropTypes.number, // passed from <Carousel />
        sliderWidth: PropTypes.number, // passed from <Carousel />
        vertical: PropTypes.bool, // passed from <Carousel />
        containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
        dimensions: PropTypes.shape({
            width: PropTypes.number,
            height: PropTypes.number
        }),
        fadeDuration: PropTypes.number,
        parallaxFactor: PropTypes.number,
        showSpinner: PropTypes.bool,
        spinnerColor: PropTypes.string
    };

    static defaultProps = {
        containerStyle: {},
        fadeDuration: 500,
        parallaxFactor: 0.3,
        showSpinner: true,
        spinnerColor: 'rgba(0, 0, 0, 0.4)'
    }

    constructor (props) {
        super(props);
        this.state = {
            offset: 0,
            width: 0,
            height: 0,
            status: 1, // 1 -> loading; 2 -> loaded // 3 -> transition finished; 4 -> error
            animOpacity: new Animated.Value(0)
        };
        this._onLoad = this._onLoad.bind(this);
        this._onError = this._onError.bind(this);
        this._measureLayout = this._measureLayout.bind(this);
    }

    setNativeProps (nativeProps) {
        this._container.setNativeProps(nativeProps);
    }

    componentDidMount () {
        this._mounted = true;

        setTimeout(() => {
            this._measureLayout();
        }, 0);
    }

    componentWillUnmount () {
{'fraction_non_alphanumeric': 0.11405714285714286, 'fraction_numerical': 0.009142857142857144, 'mean_word_length': 2.2902255639097744, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3204243', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1200, 'n_words': 293}