<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import {Text, View} from 'react-native';
import {Row, Col, Grid, CheckBox} from 'react-native-elements';

import QuestionText from './QuestionText';
import styles from './styles';

const handleChange = (value, callback, question) => callback({target: {name: question.name, value}});

const renderRow = (section, options, parentQuestionName, question, onChange) => {
    const questionName = parentQuestionName + question.name;
    const answer = section[questionName];
    // TODO add key attribute to Row component for better loop render.
    return (
        <Row>
            <Col size={4}>
                <Text style={{paddingTop: 15}}>{question.text}</Text>
            </Col>
            {options.map(option => (
                <Col>
                    <CheckBox
                        key={option.value}
                        containerStyle={{borderWidth: 0, backgroundColor: null}}
                        checkedIcon="dot-circle-o"
                        onPress={() => handleChange(option.value, onChange, question)}
                        uncheckedIcon="circle-o"
                        checked={answer === option.value}
                    />
                </Col>)
            )}
        </Row>
    );
};

const RadioTable = ({section, question, onChange}) => (
    <View style={styles.rowContainer}>
        <QuestionText question={question}/>
        <Grid>
            <Row>
                <Col size={4}/>
                {question.options.map(option => (
                    <Col>
                        <Text><commit_msg>fix(app): radio table fix (#13)<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import {Text, View} from 'react-native';
import {Row, Col, Grid, CheckBox} from 'react-native-elements';

import QuestionText from './QuestionText';
import styles from './styles';

const handleChange = (value, callback, questionName) => callback({target: {name: questionName, value}});

const renderRow = (section, options, parentQuestionName, question, onChange) => {
    const questionName = parentQuestionName + question.name;
    const answer = section[questionName];
    // TODO add key attribute to Row component for better loop render.
    return (
        <Row>
            <Col size={4}>
                <Text style={{paddingTop: 15}}>{question.text}</Text>
            </Col>
            {options.map(option => (
                <Col>
                    <CheckBox
                        key={option.value}
                        containerStyle={{borderWidth: 0, backgroundColor: null}}
                        checkedIcon="dot-circle-o"
                        onPress={() => handleChange(option.value, onChange, questionName)}
                        uncheckedIcon="circle-o"
                        checked={answer === option.value}
                    />
                </Col>
            ))}
        </Row>
    );
};

const RadioTable = ({section, question, onChange}) => (
    <View style={styles.rowContainer}>
        <QuestionText question={question}/>
        <Grid>
            <Row>
                <Col size={4}/>
                {question.options.map(option => (
                    <Col>
                        <Text>
{'fraction_non_alphanumeric': 0.12823636917453549, 'fraction_numerical': 0.003655193420651843, 'mean_word_length': 1.797274275979557, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 47, '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': '6617198', 'n_tokens_mistral': 830, 'n_tokens_neox': 803, 'n_words': 211}