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

akvo / nmis-mobile / 5385865674

27 Jun 2023 04:46AM UTC coverage: 76.167% (-9.6%) from 85.789%
5385865674

Pull #19

github

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

162 of 231 branches covered (70.13%)

Branch coverage included in aggregate %.

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

311 of 390 relevant lines covered (79.74%)

14.24 hits per line

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

66.67
/app/src/form/fields/TypeMultipleOption.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 { MultiSelect } from 'react-native-element-dropdown';
7

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

13
  return (
2✔
14
    <View style={styles.multipleOptionContainer}>
15
      <FieldLabel keyform={keyform} name={name} />
16
      {isCheckBox ? (
2✔
17
        option.map((opt, opti) => (
18
          <CheckBox
3✔
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
                values?.[id]?.includes(opt.name)
1!
26
                  ? onChange(`${id}.${opti}`, null)
27
                  : onChange(`${id}.${opti}`, opt.name);
28
              }
29
            }}
30
            title={opt.label}
31
          />
32
        ))
33
      ) : (
34
        <MultiSelect
35
          style={[styles.dropdownField]}
36
          selectedStyle={styles.dropdownSelectedList}
37
          data={option.map((opt) => ({ label: opt.label, value: opt.name }))}
4✔
38
          search
39
          maxHeight={300}
40
          labelField="label"
41
          valueField="value"
42
          searchPlaceholder="Search..."
43
          value={values?.[id] || []}
2✔
44
          onChange={(value) => {
45
            if (onChange) {
×
46
              onChange(id, value);
×
47
            }
48
          }}
49
          testID="type-multiple-option-dropdown"
50
        />
51
      )}
52
    </View>
53
  );
54
};
55

56
export default TypeMultipleOption;
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

© 2025 Coveralls, Inc