ikualo-ui-kit-mobile 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,9 @@ export const stylesSelect = StyleSheet.create({
10
10
  'select-container-disabled': {
11
11
  backgroundColor: theme.colors.disabled,
12
12
  },
13
+ 'select-placeholder-readonly': {
14
+ color: theme.colors.grayText,
15
+ },
13
16
  'select-content': {
14
17
  borderBottomWidth: 1,
15
18
  borderBottomColor: theme.colors.primary,
@@ -32,4 +35,4 @@ export const stylesSelect = StyleSheet.create({
32
35
  borderBlockColor: theme.colors.lightPrimary,
33
36
  padding: 16,
34
37
  },
35
- });
38
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ikualo-ui-kit-mobile",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "main": "src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -1,9 +1,11 @@
1
- import { TouchableNativeFeedback, View, Image } from 'react-native';
1
+ import { TouchableNativeFeedback, View, Image, Touchable } from 'react-native';
2
2
  import { Text } from 'react-native-paper';
3
3
  import { ReactElement, useState } from 'react';
4
4
  import { icons } from '../../../assets/icons/_icons';
5
5
  import { SelectList } from '../../';
6
6
  import { stylesSelect } from '../../../assets/styles/elements/select';
7
+ import SimpleLineIcons from '@expo/vector-icons/SimpleLineIcons';
8
+ import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
7
9
 
8
10
  interface IFSelect {
9
11
  label: string;
@@ -12,31 +14,39 @@ interface IFSelect {
12
14
  options: { value: string; label: ReactElement }[];
13
15
  onSelect: (value: string) => void;
14
16
  value?: string;
15
- showInLabel?: "placeholder" | "label"
17
+ showInLabel?: "placeholder" | "label",
18
+ isReadOnly?: boolean;
16
19
  }
17
20
  export const Select = (props: IFSelect) => {
18
- const { placeholder, options, onSelect, label, isDisabled, value, showInLabel } = props;
21
+ const { placeholder, options, onSelect, label, isDisabled, value, showInLabel, isReadOnly } = props;
19
22
  const [showList, setShowList] = useState(false);
20
23
  const [selected, setSelected] = useState<ReactElement | null>(
21
24
  options?.find((option) => option.value === value)?.label ?? null
22
25
  );
23
26
  return (
24
27
  <>
25
- <TouchableNativeFeedback
28
+ <TouchableWithoutFeedback
26
29
  onPress={() => {
27
- !isDisabled && setShowList(true);
30
+ (!isDisabled && !isReadOnly) && setShowList(true);
28
31
  }}
29
32
  >
30
33
  <View
31
- style={[stylesSelect['select-container'], isDisabled && stylesSelect['select-container-disabled']]}
34
+ style={[
35
+ stylesSelect['select-container'],
36
+ isDisabled && stylesSelect['select-container-disabled'],
37
+ ]}
32
38
  >
33
39
  <Text style={stylesSelect['select-label']}>{selected && label}</Text>
34
- <View style={stylesSelect['select-content']}>
35
- <Text style={stylesSelect['select-placeholder']}>{selected ?? placeholder}</Text>
36
- <Image source={icons.arrowDown} />
40
+ <View style={[stylesSelect['select-content'],
41
+ ]}>
42
+ <Text style={[
43
+ stylesSelect['select-placeholder'],
44
+ isReadOnly && stylesSelect['select-placeholder-readonly'],
45
+ ]}>{selected ?? placeholder}</Text>
46
+ {!isReadOnly && <SimpleLineIcons name={showList ? "arrow-up" : "arrow-down"} size={10} color="black" />}
37
47
  </View>
38
48
  </View>
39
- </TouchableNativeFeedback>
49
+ </TouchableWithoutFeedback>
40
50
  <SelectList
41
51
  children={options}
42
52
  label={showInLabel === "label" ? label : placeholder}
@@ -25,7 +25,7 @@ export const SelectList = (props: IFSelectList) => {
25
25
  >
26
26
  <TouchableWithoutFeedback>
27
27
  <View style={stylesDialog.modalBackground}>
28
- <View style={[stylesDialog['dialog-down'], stylesDialog['dialog-bottom']]}>
28
+ <View style={[stylesDialog['dialog-down'], stylesDialog['dialog-bottom'], { maxHeight: '90%' }]}>
29
29
 
30
30
  <TouchableHighlight onPress={onDismiss} underlayColor={theme.colors.lightPrimary} style={stylesDialog['dialog-down-select-close']}>
31
31
  <Icon
@@ -35,7 +35,7 @@ export const SelectList = (props: IFSelectList) => {
35
35
  />
36
36
  </TouchableHighlight>
37
37
  <Text style={[stylesDialog['dialog-select-title']]}>{label}</Text>
38
- <ScrollView style={{ maxHeight: 400 }}>
38
+ <ScrollView>
39
39
  {children?.map((child, index) => {
40
40
  return (
41
41
  <TouchableNativeFeedback