<commit_before>import React from 'react';
import MapboxGL from '@mapbox/react-native-mapbox-gl';

import BaseExamplePropTypes from './common/BaseExamplePropTypes';
import Page from './common/Page';

import sheet from '../styles/sheet';
import colors from '../styles/colors';

import { SF_OFFICE_COORDINATE } from '../utils';

const layerStyles = MapboxGL.StyleSheet.create({
  background: {
    backgroundColor: colors.primary.blue,
  },
   water: {
    fillColor: MapboxGL.StyleSheet.camera({
        1: colors.secondary.green,
        8: colors.secondary.orange,
        10: colors.secondary.red,
        18: colors.secondary.yellow,
    }, MapboxGL.InterpolationMode.Exponential),
  },
});

class YoYo extends React.Component {
  static propTypes = {
    ...BaseExamplePropTypes,
  };

  constructor (props) {
    super(props);

    this.state = {
      zoomLevel: 12,
    };

    this.onUpdateZoomLevel = this.onUpdateZoomLevel.bind(this);
  }

  componentDidMount () {
    this.map.zoomTo(this.state.zoomLevel, 8000);
  }

  onUpdateZoomLevel () {
    const nextZoomLevel = this.state.zoomLevel === 12 ? 1 : 12;
    this.setState({ zoomLevel: nextZoomLevel });
    this.map.zoomTo(nextZoomLevel, 8000);
  }

  render () {
    return (
      <Page {...this.props}>
        <MapboxGL.MapView
            zoomLevel={2}
            centerCoordinate={SF_OFFICE_COORDINATE}
            onSetCameraComplete={this.onUpdateZoomLevel}
            ref={(ref) => this.map = ref}
            style={sheet.matchParent}
            styleURL={MapboxGL.StyleURL.Dark}>

            <MapboxGL.VectorSource>
              <MapboxGL.BackgroundLayer id='background' style={layerStyles.background} />
              <MapboxGL.FillLayer id='water' style={layerStyles.water} />
            </MapboxGL.VectorSource>
        </MapboxGL.MapView>
      </Page>
    );
  }
}

export default YoYo;<commit_msg>Updated the zoomTo call to use a promise instead of callback<commit_after>import React from 'react';
import MapboxGL from '@mapbox/react-native-mapbox-gl';

import BaseExamplePropTypes from './common/BaseExamplePropTypes';
import Page from './common/Page';

import sheet from '../styles/sheet';
import colors from '../styles/colors';

import { SF_OFFICE_COORDINATE } from '../utils';

const layerStyles = MapboxGL.StyleSheet.create({
  background: {
    backgroundColor: colors.primary.blue,
  },
   water: {
    fillColor: MapboxGL.StyleSheet.camera({
        1: colors.secondary.green,
        8: colors.secondary.orange,
        10: colors.secondary.red,
        18: colors.secondary.yellow,
    }, MapboxGL.InterpolationMode.Exponential),
  },
});

class YoYo extends React.Component {
  static propTypes = {
    ...BaseExamplePropTypes,
  };

  constructor (props) {
    super(props);

    this.state = {
      zoomLevel: 12,
    };
  }

  componentDidMount () {
    this.cameraLoop();
  }

  cameraLoop () {
    requestAnimationFrame(async () => {
      await this.map.zoomTo(this.state.zoomLevel, 8000);
      const nextZoomLevel = this.state.zoomLevel === 12 ? 2 : 12;
      this.setState({ zoomLevel: nextZoomLevel });
      this.cameraLoop();
    });
  }

  render () {
    return (
      <Page {...this.props}>
        <MapboxGL.MapView
            zoomLevel={2}
            centerCoordinate={SF_OFFICE_COORDINATE}
            ref={(ref) => this.map = ref}
            style={sheet.matchParent}
            styleURL={MapboxGL.StyleURL.Dark}>

            <MapboxGL.VectorSource>
              <MapboxGL.BackgroundLayer id='background' style={layerStyles.background} />
              <MapboxGL.FillLayer id='water' style={layerStyles.water} />
            </MapboxGL.VectorSource>
        </MapboxGL.MapView>
      </Page>
    );
  }
}

export default YoYo;
{'fraction_non_alphanumeric': 0.13226666666666667, 'fraction_numerical': 0.010666666666666666, 'mean_word_length': 2.6702544031311155, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 22, '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': '7124867', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1136, 'n_words': 212}