<commit_before>/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 * @flow
 * @providesModule ScrollViewExample
 */
'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {
  Platform,
  ScrollView,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
  Image
} = ReactNative;

exports.displayName = 'ScrollViewExample';
exports.title = '<ScrollView>';
exports.description = 'Component that enables scrolling through child components';
exports.examples = [
{
  title: '<ScrollView>',
  description: 'To make content scrollable, wrap it within a <ScrollView> component',
  render: function() {
    var _scrollView: ScrollView;
    return (
      <View>
        <ScrollView
          /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
           * comment suppresses an error when upgrading Flow's support for
           * React. To see the error delete this comment and run Flow. */
          ref={(scrollView) => { _scrollView = scrollView; }}
          automaticallyAdjustContentInsets={false}
          onScroll={() => { console.log('onScroll!'); }}
          scrollEventThrottle={200}
          style={styles.scrollView}>
          {THUMB_URLS.map(createThumbRow)}
        </ScrollView>
        <TouchableOpacity
          style={styles.button}
          onPress={() => { _scrollView.scrollTo({y: 0}); }}>
          <Text>Scroll to top</Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={styles.button}
          onPress={() => { _scrollView.scrollToEnd({animated: true}); }}>
          <Text>Scroll to bottom</Text>
        </TouchableOpacity>
        { Platform.OS === 'ios' ?
          <TouchableOpacity
            style={styles.button}
            onPress={() => { _scrollView.flashScrollIndicators(); }}>
            <Text>Flash scroll indicators</Text>
          </TouchableOpacity>
          : null }
      </View>
    );
  }
}, {
  title: '<ScrollView> (horizontal = true)',
  description: 'You can display <ScrollView>\'s child components horizontally rather than vertically',
  render: function() {

    function renderScrollView(title: string, addtionalStyles: typeof StyleSheet) {
      var _scrollView: ScrollView;
      return (
        <View style={addtionalStyles}>
          <Text style={styles.text}>{title}</Text>
          <ScrollView
            /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
             * comment suppresses an error when upgrading Flow's support for
             * React. To see the error delete this comment and run Flow. */
            ref={(scrollView) => { _scrollView = scrollView; }}
            automaticallyAdjustContentInsets={false}
            horizontal={true}
            style={[styles.scrollView, styles.horizontalScrollView]}>
            {THUMB_URLS.map(createThumbRow)}
          </ScrollView>
          <TouchableOpacity
            style={styles.button}
            onPress={() => { _scrollView.scrollTo({x: 0}); }}>
            <Text>Scroll to start</Text>
          </TouchableOpacity>
          <TouchableOpacity
            style={styles.button}
            onPress={() => { _scrollView.scrollToEnd({animated: true}); }}>
            <Text>Scroll to end</Text>
          </TouchableOpacity>
          { Platform.OS === 'ios' ?
            <TouchableOpacity
              style={styles.button}
              onPress={() => { _scrollView.flashScrollIndicators(); }}>
              <Text>Flash scroll indicators</Text>
            </TouchableOpacity>
            : null }
        </View>
      );
    }

    return (
      <View>
        {renderScrollView('LTR layout', {direction: 'ltr'})}
        {renderScrollView('RTL layout', {direction: 'rtl'})}
      </View>
    );
  }
}];

class Thumb extends React.Component<$FlowFixMeProps, $FlowFixMeState> {<commit_msg>Enabling `flashScrollIndicators` example for all platforms<commit_after>/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 * @flow
 * @providesModule ScrollViewExample
 */
'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {
  Platform,
  ScrollView,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
  Image
} = ReactNative;

exports.displayName = 'ScrollViewExample';
exports.title = '<ScrollView>';
exports.description = 'Component that enables scrolling through child components';
exports.examples = [
{
  title: '<ScrollView>',
  description: 'To make content scrollable, wrap it within a <ScrollView> component',
  render: function() {
    var _scrollView: ScrollView;
    return (
      <View>
        <ScrollView
          /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
           * comment suppresses an error when upgrading Flow's support for
           * React. To see the error delete this comment and run Flow. */
          ref={(scrollView) => { _scrollView = scrollView; }}
          automaticallyAdjustContentInsets={false}
          onScroll={() => { console.log('onScroll!'); }}
          scrollEventThrottle={200}
          style={styles.scrollView}>
          {THUMB_URLS.map(createThumbRow)}
        </ScrollView>
        <TouchableOpacity
          style={styles.button}
          onPress={() => { _scrollView.scrollTo({y: 0}); }}>
          <Text>Scroll to top</Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={styles.button}
          onPress={() => { _scrollView.scrollToEnd({animated: true}); }}>
          <Text>Scroll to bottom</Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={styles.button}
          onPress={() => { _scrollView.flashScrollIndicators(); }}>
          <Text>Flash scroll indicators</Text>
        </TouchableOpacity>
      </View>
    );
  }
}, {
  title: '<ScrollView> (horizontal = true)',
  description: 'You can display <ScrollView>\'s child components horizontally rather than vertically',
  render: function() {

    function renderScrollView(title: string, addtionalStyles: typeof StyleSheet) {
      var _scrollView: ScrollView;
      return (
        <View style={addtionalStyles}>
          <Text style={styles.text}>{title}</Text>
          <ScrollView
            /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
             * comment suppresses an error when upgrading Flow's support for
             * React. To see the error delete this comment and run Flow. */
            ref={(scrollView) => { _scrollView = scrollView; }}
            automaticallyAdjustContentInsets={false}
            horizontal={true}
            style={[styles.scrollView, styles.horizontalScrollView]}>
            {THUMB_URLS.map(createThumbRow)}
          </ScrollView>
          <TouchableOpacity
            style={styles.button}
            onPress={() => { _scrollView.scrollTo({x: 0}); }}>
            <Text>Scroll to start</Text>
          </TouchableOpacity>
          <TouchableOpacity
            style={styles.button}
            onPress={() => { _scrollView.scrollToEnd({animated: true}); }}>
            <Text>Scroll to end</Text>
          </TouchableOpacity>
          <TouchableOpacity
            style={styles.button}
            onPress={() => { _scrollView.flashScrollIndicators(); }}>
            <Text>Flash scroll indicators</Text>
          </TouchableOpacity>
        </View>
      );
    }

    return (
      <View>
        {renderScrollView('LTR layout', {direction: 'ltr'})}
        {renderScrollView('RTL layout', {direction: 'rtl'})}
      </View>
    );
  }
}];

class Thumb extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
{'fraction_non_alphanumeric': 0.12495360633428182, 'fraction_numerical': 0.004206359025114438, 'mean_word_length': 2.5518453427065024, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6623548', 'n_tokens_mistral': 2289, 'n_tokens_neox': 2242, 'n_words': 549}