• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

akvo / nmis-mobile / 5385783612

27 Jun 2023 04:31AM UTC coverage: 69.565% (-16.2%) from 85.789%
5385783612

Pull #19

github

web-flow
Merge 7f4a3ae4c into 13b679e8c
Pull Request #19: Feature/13 initial formik implementation

146 of 231 branches covered (63.2%)

Branch coverage included in aggregate %.

265 of 265 new or added lines in 18 files covered. (100.0%)

286 of 390 relevant lines covered (73.33%)

10.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.42
/app/src/form/fields/TypeOption.js
1
import React from 'react';
2
import { View } from 'react-native';
3
import { FieldLabel } from '../support';
4
import { styles } from '../styles';
5
import { CheckBox } from '@rneui/themed';
6
import { Dropdown } from 'react-native-element-dropdown';
7

8
const TypeOption = ({ onChange, values, keyform, id, name, option = [] }) => {
15!
9
  const isRadioGroup = React.useMemo(() => {
25✔
10
    return option.length <= 3;
7✔
11
  }, [option]);
12

13
  return (
25✔
14
    <View style={styles.optionContainer}>
15
      <FieldLabel keyform={keyform} name={name} />
16
      {isRadioGroup ? (
25✔
17
        option.map((opt, opti) => (
18
          <CheckBox
28✔
19
            key={opti}
20
            containerStyle={styles.radioFieldContainer}
21
            textStyle={styles.radioFieldText}
22
            checked={values?.[id]?.includes(opt.name)}
23
            onPress={() => {
24
              if (onChange) {
1!
25
                onChange(id, [opt.name]);
1✔
26
              }
27
            }}
28
            title={opt.label}
29
            checkedIcon="dot-circle-o"
30
            uncheckedIcon="circle-o"
31
          />
32
        ))
33
      ) : (
34
        <Dropdown
35
          style={[styles.dropdownField]}
36
          data={option.map((opt) => ({ label: opt.label, value: opt.name }))}
67✔
37
          search
38
          maxHeight={300}
39
          labelField="label"
40
          valueField="value"
41
          searchPlaceholder="Search..."
42
          value={values?.[id]?.[0] || []}
16✔
43
          onChange={({ value }) => {
44
            if (onChange) {
×
45
              onChange(id, [value]);
×
46
            }
47
          }}
48
          testID="type-option-dropdown"
49
        />
50
      )}
51
    </View>
52
  );
53
};
54

55
export default TypeOption;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc