<commit_before>import React from 'react';
import {StyleSheet, View, ScrollView, Image, Text, TouchableOpacity, Animated, Platform} from 'react-native';
import {NavigationBackAndroid, SharedElement} from 'navigation-react-native';
import ZoomShared from './ZoomShared';

export default class Detail extends React.Component {
  constructor(props, context) {
    super(props, context);
    const {url} = props.stateNavigator.stateContext;
    this.url = url;
    this.state = {
      contentAnimation: new Animated.Value(0),
      navbarAnimation: new Animated.Value(0),
    };
  }
  shouldComponentUpdate(props) {
    return this.url === props.stateNavigator.stateContext.url;
  }
  componentDidMount() {
    this._animate(false);
  }
  _animate(inverse) {
    Animated.timing(this.state.contentAnimation, {
      toValue: inverse ? 0 : 1,
      duration: 500,
      useNativeDriver: true,
    }).start(); 
    setTimeout(() => {
      Animated.timing(this.state.navbarAnimation, {
        toValue: inverse ? 0 : 1,
        duration: inverse ? 50 : 300,
        useNativeDriver: true,
      }).start();      
    }, inverse ? 0 : 500);   
  }
  _goBack = () => {
    const {stateNavigator} = this.props;
    if (this.url === stateNavigator.stateContext.url) {
      stateNavigator.navigateBack(1);
      this._animate(true);
    }
  };  
  render() {
    const {place, rowId, stateNavigator} = this.props;
    const contentTranslateY = this.state.contentAnimation.interpolate({
      inputRange: [0, 1],
      outputRange: [200, 0],
    });
      return (
      <View style={{ flex: 1 }}>
        <ZoomShared stateNavigator={stateNavigator} />
        <NavigationBackAndroid stateNavigator={stateNavigator} />
        <ScrollView style={{ flex: 1 }}>
          <View style={styles.imageContainer}>
            <SharedElement
              name={`image${rowId}`}
              data={{image: place.image}}
              stateNavigator={stateNavigator}>
              <View style={styles.image}>
                <Image
                  source={place.image}
                  style={{ flex: 1 }}<commit_msg>Animated on navigate instead of on back<commit_after>import React from 'react';
import {StyleSheet, View, ScrollView, Image, Text, TouchableOpacity, Animated, Platform} from 'react-native';
import {NavigationBackAndroid, SharedElement} from 'navigation-react-native';
import ZoomShared from './ZoomShared';

export default class Detail extends React.Component {
  constructor(props, context) {
    super(props, context);
    const {url} = props.stateNavigator.stateContext;
    this._onNavigate = this._onNavigate.bind(this);
    this.url = url;
    this.state = {
      contentAnimation: new Animated.Value(0),
      navbarAnimation: new Animated.Value(0),
    };
  }
  shouldComponentUpdate(props) {
    return this.url === props.stateNavigator.stateContext.url;
  }
  componentDidMount() {
    this._animate(false);
    this.props.stateNavigator.onNavigate(this._onNavigate);
  }
  componentWillUnmount() {
    this.props.stateNavigator.offNavigate(this._onNavigate);
  }
  _onNavigate() {
      this._animate(true);
  }
  _animate(inverse) {
    Animated.timing(this.state.contentAnimation, {
      toValue: inverse ? 0 : 1,
      duration: 500,
      useNativeDriver: true,
    }).start(); 
    setTimeout(() => {
      Animated.timing(this.state.navbarAnimation, {
        toValue: inverse ? 0 : 1,
        duration: inverse ? 50 : 300,
        useNativeDriver: true,
      }).start();      
    }, inverse ? 0 : 500);   
  }
  _goBack = () => {
    const {stateNavigator} = this.props;
    if (this.url === stateNavigator.stateContext.url) {
      stateNavigator.navigateBack(1);
    }
  };  
  render() {
    const {place, rowId, stateNavigator} = this.props;
    const contentTranslateY = this.state.contentAnimation.interpolate({
      inputRange: [0, 1],
      outputRange: [200, 0],
    });
      return (
      <View style={{ flex: 1 }}>
        <ZoomShared stateNavigator={stateNavigator} />
        <NavigationBackAndroid stateNavigator={stateNavigator} />
        <ScrollView style={{ flex: 1 }}>
          <View style={styles.imageContainer}>
            <SharedElement
              name={`image${rowId}`}
              data={{image: place.image}}
              stateNavigator={stateNavigator}>
              <View style={styles.image}>
                <Image
                  source={place.image}
                  style={{ flex: 1 }}
{'fraction_non_alphanumeric': 0.13083482944344704, 'fraction_numerical': 0.012567324955116697, 'mean_word_length': 2.711074104912573, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, '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': '2129895', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1303, 'n_words': 272}