<commit_before>const Option = require('./option');
const OptionList = require('./optionList');
import _ from 'underscore';

import React, { Component } from 'react';
import {
  Dimensions,
  StyleSheet,
  TouchableWithoutFeedback,
  View,
  Text
} from 'react-native';

import SvgIcon from 'react-native-svg-icon';
import svgs from './svgs';

const window = Dimensions.get('window');

const SELECT = 'SELECT';

const styles = StyleSheet.create({
  container: {
    alignSelf: 'flex-start',
    justifyContent : "center",
    alignItems: 'flex-start',
  },
  optionContainer: {
    alignSelf: 'flex-start',
    justifyContent : "center",
    alignItems : "center"
  }
});

class Select extends Component {
  constructor(props) {
    super(props);

    this.pageX = 0;
    this.pageY = 0;

    let defaultValue = props.defaultValue;

    if (!defaultValue) {
      if (Array.isArray(props.children)) {
        defaultValue = props.children[0].props.children;
      } else {
        defaultValue = props.children.props.children;
      }
    }

    this.state = {
      value: defaultValue,
      opened: false,
      checkedItems:{}
    }

    this._renderIcon = this._renderIcon.bind(this);
    this._onToggle = this._onToggle.bind(this);
  }

  componentDidMount() {

    const { children, onSelect, width, height, checkable, viewCount, defaultValue } = this.props;

    this.refs['OPTIONLIST']._init(children, this.pageX, this.pageY, width, height, checkable, viewCount, (item, value=item, checked) => {

      if (item) {
        onSelect(item);

        var val = item;
        if( checkable ){

          const { onSelect } = this.props;

          var checkedItems = this.state.checkedItems;
          checkedItems[item]=checked;

          var checkedKeys = [];
          for( var key in checkedItems ){
            if( checkedItems[key] ){
              checkedKeys.push( key );
            }
          }

          val = checkedKeys.join(",");
          if( val == "" ) val = defaultValue;
        } else {
          this.setState({
            opened: false
          });
        }

        this.setState({
          value: val
        });
      }
    });<commit_msg>add value<commit_after>const Option = require('./option');
const OptionList = require('./optionList');
import _ from 'underscore';

import React, { Component } from 'react';
import {
  Dimensions,
  StyleSheet,
  TouchableWithoutFeedback,
  View,
  Text
} from 'react-native';

import SvgIcon from 'react-native-svg-icon';
import svgs from './svgs';

const window = Dimensions.get('window');

const SELECT = 'SELECT';

const styles = StyleSheet.create({
  container: {
    alignSelf: 'flex-start',
    justifyContent : "center",
    alignItems: 'flex-start',
  },
  optionContainer: {
    alignSelf: 'flex-start',
    justifyContent : "center",
    alignItems : "center"
  }
});

class Select extends Component {
  constructor(props) {
    super(props);

    this.pageX = 0;
    this.pageY = 0;

    let defaultValue = props.defaultValue;

    if (!defaultValue) {
      if (Array.isArray(props.children)) {
        defaultValue = props.children[0].props.children;
      } else {
        defaultValue = props.children.props.children;
      }
    }

    this.state = {
      value: defaultValue,
      opened: false,
      checkedItems:{}
    }

    this._renderIcon = this._renderIcon.bind(this);
    this._onToggle = this._onToggle.bind(this);
  }

  componentDidMount() {

    const { children, onSelect, width, height, checkable, viewCount, defaultValue } = this.props;

    this.refs['OPTIONLIST']._init(children, this.pageX, this.pageY, width, height, checkable, viewCount, (item, value=item, checked) => {

      if (item) {
        onSelect(item, value);

        var val = item;
        if( checkable ){

          const { onSelect } = this.props;

          var checkedItems = this.state.checkedItems;
          checkedItems[item]=checked;

          var checkedKeys = [];
          for( var key in checkedItems ){
            if( checkedItems[key] ){
              checkedKeys.push( key );
            }
          }

          val = checkedKeys.join(",");
          if( val == "" ) val = defaultValue;
        } else {
          this.setState({
            opened: false
          });
        }

        this.setState({
          value: val
        });
      }
    });
{'fraction_non_alphanumeric': 0.13163335630599587, 'fraction_numerical': 0.0013783597518952446, 'mean_word_length': 2.3009855951478393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7078066', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1277, 'n_words': 290}