react-native-molecules 0.5.0-beta.13 → 0.5.0-beta.14

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.
@@ -27,15 +27,15 @@ export type Props = Omit<TextInputProps, OmitProp> &
27
27
  /**
28
28
  * Default value for uncontrolled usage
29
29
  */
30
- defaultValue?: DocumentResult | DocumentResult[];
30
+ defaultValue?: DocumentResult[];
31
31
  /**
32
32
  * To Control the value
33
33
  */
34
- value?: DocumentResult | DocumentResult[];
34
+ value?: DocumentResult[];
35
35
  /**
36
36
  * The Callback function to return the selected files as an array or object
37
37
  */
38
- onChange?: (result: DocumentResult | DocumentResult[] | undefined) => any;
38
+ onChange?: (result: DocumentResult[] | undefined) => any;
39
39
  };
40
40
 
41
41
  const FilePicker = ({
@@ -53,9 +53,7 @@ const FilePicker = ({
53
53
  children,
54
54
  ...rest
55
55
  }: Props) => {
56
- const [value, onValueChange] = useControlledValue<
57
- DocumentResult | DocumentResult[] | undefined
58
- >({
56
+ const [value, onValueChange] = useControlledValue<DocumentResult[] | undefined>({
59
57
  value: valueProp,
60
58
  defaultValue,
61
59
  onChange,
@@ -74,14 +72,10 @@ const FilePicker = ({
74
72
  const displayText = useMemo(() => {
75
73
  if (!value) return '';
76
74
 
77
- if (Array.isArray(value)) {
78
- if (value.length > 1) {
79
- return `${value.length} files`;
80
- }
81
- return value[0]?.name || '';
75
+ if (value.length > 1) {
76
+ return `${value.length} files`;
82
77
  }
83
-
84
- return value.name || '';
78
+ return value[0]?.name || '';
85
79
  }, [value]);
86
80
 
87
81
  const onPress = useCallback(() => {
@@ -30,14 +30,6 @@ const TooltipTrigger = memo(({ children }: { children: ReactElement }) => {
30
30
  () => triggerRef?.current,
31
31
  );
32
32
 
33
- const onPress = useCallback(
34
- (e: unknown) => {
35
- // @ts-ignore
36
- children?.props?.onPress?.(e);
37
- },
38
- [children?.props],
39
- );
40
-
41
33
  const onLongPress = useCallback(
42
34
  (e: unknown) => {
43
35
  // @ts-ignore
@@ -93,9 +85,8 @@ const TooltipTrigger = memo(({ children }: { children: ReactElement }) => {
93
85
  ref: actionsRef,
94
86
  onLongPress,
95
87
  onPressOut,
96
- onPress,
97
88
  }),
98
- [children, onLongPress, onPress, onPressOut, actionsRef],
89
+ [children, onLongPress, onPressOut, actionsRef],
99
90
  );
100
91
  });
101
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-molecules",
3
- "version": "0.5.0-beta.13",
3
+ "version": "0.5.0-beta.14",
4
4
  "author": "Thet Aung <thetaung.dev@gmail.com>",
5
5
  "license": "MIT",
6
6
  "main": "index.ts",