@rn-components-dropdown/dropdown 1.0.14 → 1.0.15

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.
@@ -1,6 +1,4 @@
1
1
  import React from "react";
2
- declare const ArrowDown: ({ size, color }: {
3
- size?: number | undefined;
4
- color?: string | undefined;
5
- }) => React.JSX.Element;
2
+ import { SvgInterface } from "../../interface/svg.interface";
3
+ declare const ArrowDown: ({ size, color }: SvgInterface) => React.JSX.Element;
6
4
  export default ArrowDown;
@@ -1,7 +1,8 @@
1
+ import { ColorValue } from 'react-native';
1
2
  interface Props {
2
3
  size?: number;
3
- radioIconColor?: string;
4
- checkIconColor?: string;
4
+ radioIconColor?: ColorValue;
5
+ checkIconColor?: ColorValue;
5
6
  }
6
7
  export declare const useDropdownStyle: (props: Props) => {
7
8
  styles: {
@@ -97,13 +98,13 @@ export declare const useDropdownStyle: (props: Props) => {
97
98
  alignItems: "center";
98
99
  justifyContent: "center";
99
100
  padding: number;
100
- borderColor: string;
101
+ borderColor: ColorValue;
101
102
  };
102
103
  iconSubContainer: {
103
104
  width: "100%";
104
105
  height: "100%";
105
106
  borderRadius: number;
106
- backgroundColor: string;
107
+ backgroundColor: ColorValue;
107
108
  };
108
109
  styleHorizontal: {
109
110
  width: number | "100%";
@@ -121,7 +122,7 @@ export declare const useDropdownStyle: (props: Props) => {
121
122
  height: number;
122
123
  alignItems: "center";
123
124
  justifyContent: "center";
124
- borderColor: string;
125
+ borderColor: ColorValue;
125
126
  };
126
127
  showMultiSelectContainer: {
127
128
  width: "90%";
@@ -1,8 +1,8 @@
1
1
  import { ColorValue } from "react-native";
2
2
  export interface ChipInterface {
3
3
  label?: string;
4
- onClearPress?: () => void;
5
4
  chipColor?: ColorValue;
6
5
  textColor?: ColorValue;
6
+ onClearPress?: () => void;
7
7
  clearIcon?: React.JSX.Element;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { StyleProp, TextStyle, ViewStyle, TextProps, ImageStyle, FlatListProps } from 'react-native';
2
+ import type { StyleProp, TextStyle, ViewStyle, TextProps, ImageStyle, FlatListProps, ColorValue } from 'react-native';
3
3
  import { ChipInterface } from './ChipInterface';
4
4
  export type IDropdownRef = {
5
5
  open: () => void;
@@ -13,7 +13,6 @@ export type DropdownProps<S, T extends SelectionType> = {
13
13
  disable?: boolean;
14
14
  selectionType?: T;
15
15
  maxHeight?: number;
16
- iconColor?: string;
17
16
  minHeight?: number;
18
17
  inverted?: boolean;
19
18
  fontFamily?: string;
@@ -23,18 +22,19 @@ export type DropdownProps<S, T extends SelectionType> = {
23
22
  placeholder?: string;
24
23
  onFocus?: () => void;
25
24
  autoScroll?: boolean;
26
- activeColor?: string;
27
25
  searchField?: keyof S;
26
+ iconColor?: ColorValue;
28
27
  value?: S[] | undefined;
29
- checkIconColor?: string;
30
- radioIconColor?: string;
28
+ activeColor?: ColorValue;
31
29
  itemTestIDField?: string;
32
- backgroundColor?: string;
33
30
  keyboardAvoiding?: boolean;
34
31
  searchPlaceholder?: string;
35
32
  label?: string | undefined;
33
+ checkIconColor?: ColorValue;
34
+ radioIconColor?: ColorValue;
36
35
  confirmSelectItem?: boolean;
37
36
  accessibilityLabel?: string;
37
+ backgroundColor?: ColorValue;
38
38
  style?: StyleProp<ViewStyle>;
39
39
  selectedTextProps?: TextProps;
40
40
  subfixIcon?: React.JSX.Element;
@@ -14,11 +14,11 @@ const AppDropdownController = (props) => {
14
14
  const { styles } = (0, DropdownControllerStyle_1.useDropdownControllerStyle)();
15
15
  return (<react_hook_form_1.Controller control={control} name={controller} render={({ fieldState: { error }, field: { onBlur, onChange, value }, }) => (<react_native_1.View style={styles.mainContainer}>
16
16
  <Dropdown_1.default data={data} value={value} label={label} onBlur={onBlur} onChange={(selectValue, selectedItem) => {
17
- if (selectionType === 'single') {
18
- return onChange(selectValue);
17
+ if (selectionType === 'multi') {
18
+ return onChange(selectedItem);
19
19
  }
20
- return onChange(selectedItem);
21
- }} labelField={labelField} valueField={valueField} placeholder={placeholder} selectionType={selectionType} containerStyle={containerStyle} labelTextStyle={styles.labelText} itemTextStyle={styles.dropdownText} placeholderStyle={styles.itemContainer} selectedTextStyle={styles.selectionText} style={[styles.dropdownContainer, error && styles.errorWrapper]} {...rest}/>
20
+ return onChange(selectValue);
21
+ }} labelField={labelField} valueField={valueField} placeholder={placeholder} containerStyle={containerStyle} labelTextStyle={styles.labelText} itemTextStyle={styles.dropdownText} placeholderStyle={styles.itemContainer} selectedTextStyle={styles.selectionText} style={[styles.dropdownContainer, error && styles.errorWrapper]} {...rest}/>
22
22
  {error && <AppText_1.default style={styles.error}>{error?.message}</AppText_1.default>}
23
23
  </react_native_1.View>)}/>);
24
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rn-components-dropdown/dropdown",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import Svg, { Path, Mask, Rect, G } from "react-native-svg";
3
+ import { SvgInterface } from "../../interface/svg.interface";
3
4
 
4
- const ArrowDown = ({ size = 16, color = "black" }) => (
5
+ const ArrowDown = ({ size = 16, color = "black" }: SvgInterface) => (
5
6
  <Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
6
7
  <Mask
7
8
  id="mask0_2371_2505"
@@ -5,13 +5,13 @@ import {
5
5
  DEFAULT_COLORS,
6
6
  } from '../../style';
7
7
  import { useMemo } from 'react';
8
- import { I18nManager, StyleSheet } from 'react-native';
8
+ import { ColorValue, I18nManager, StyleSheet } from 'react-native';
9
9
  import { useDeviceOrientation } from './hooks/useOrientation';
10
10
 
11
11
  interface Props {
12
12
  size?: number;
13
- radioIconColor?: string;
14
- checkIconColor?: string;
13
+ radioIconColor?: ColorValue;
14
+ checkIconColor?: ColorValue;
15
15
  }
16
16
 
17
17
  export const useDropdownStyle = (props: Props) => {
@@ -1,10 +1,9 @@
1
1
  import { ColorValue } from "react-native";
2
2
 
3
-
4
3
  export interface ChipInterface {
5
4
  label?: string;
6
- onClearPress?: () => void;
7
5
  chipColor?: ColorValue;
8
6
  textColor?: ColorValue;
7
+ onClearPress?: () => void;
9
8
  clearIcon?: React.JSX.Element;
10
9
  }
@@ -6,6 +6,7 @@ import type {
6
6
  TextProps,
7
7
  ImageStyle,
8
8
  FlatListProps,
9
+ ColorValue,
9
10
  } from 'react-native';
10
11
  import { ChipInterface } from './ChipInterface';
11
12
 
@@ -23,7 +24,6 @@ export type DropdownProps<S, T extends SelectionType> = {
23
24
  disable?: boolean;
24
25
  selectionType?: T;
25
26
  maxHeight?: number;
26
- iconColor?: string;
27
27
  minHeight?: number;
28
28
  inverted?: boolean;
29
29
  fontFamily?: string;
@@ -33,18 +33,19 @@ export type DropdownProps<S, T extends SelectionType> = {
33
33
  placeholder?: string;
34
34
  onFocus?: () => void;
35
35
  autoScroll?: boolean;
36
- activeColor?: string;
37
36
  searchField?: keyof S;
37
+ iconColor?: ColorValue;
38
38
  value?: S[] | undefined;
39
- checkIconColor?: string;
40
- radioIconColor?: string;
39
+ activeColor?: ColorValue;
41
40
  itemTestIDField?: string;
42
- backgroundColor?: string;
43
41
  keyboardAvoiding?: boolean;
44
42
  searchPlaceholder?: string;
45
43
  label?: string | undefined;
44
+ checkIconColor?: ColorValue;
45
+ radioIconColor?: ColorValue;
46
46
  confirmSelectItem?: boolean;
47
47
  accessibilityLabel?: string;
48
+ backgroundColor?: ColorValue;
48
49
  style?: StyleProp<ViewStyle>;
49
50
  selectedTextProps?: TextProps;
50
51
  subfixIcon?: React.JSX.Element;
@@ -54,15 +54,14 @@ const AppDropdownController = <
54
54
  label={label}
55
55
  onBlur={onBlur}
56
56
  onChange={(selectValue: any, selectedItem: any) => {
57
- if (selectionType === 'single') {
58
- return onChange(selectValue);
57
+ if (selectionType === 'multi') {
58
+ return onChange(selectedItem);
59
59
  }
60
- return onChange(selectedItem);
60
+ return onChange(selectValue);
61
61
  }}
62
62
  labelField={labelField}
63
63
  valueField={valueField}
64
64
  placeholder={placeholder}
65
- selectionType={selectionType}
66
65
  containerStyle={containerStyle}
67
66
  labelTextStyle={styles.labelText}
68
67
  itemTextStyle={styles.dropdownText}
@@ -1,7 +1,7 @@
1
1
  export * from './colors';
2
2
  export * from './spacing';
3
3
  export * from './shadow';
4
- import { Dimensions, Platform } from 'react-native';
4
+ import { Dimensions } from 'react-native';
5
5
 
6
6
  export const SCREEN_WIDTH = Dimensions.get('window').width;
7
7
  export const SCREEN_HEIGHT = Dimensions.get('window').height;