@codeleap/mobile 5.8.3 → 5.8.4

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,4 +1,4 @@
1
- import React, { forwardRef, useState } from 'react';
1
+ import React, { forwardRef, useCallback, useState } from 'react';
2
2
  import { TextInput } from '../TextInput';
3
3
  import { TypeGuards } from '@codeleap/types';
4
4
  export const SearchInput = forwardRef((props, ref) => {
@@ -8,7 +8,8 @@ export const SearchInput = forwardRef((props, ref) => {
8
8
  };
9
9
  const [search, setSearch] = !TypeGuards.isNil(value) && !!onValueChange ? [value, onValueChange] : useState('');
10
10
  const setSearchTimeout = React.useRef(null);
11
- const handleChangeSearch = (value) => {
11
+ const handleChangeSearch = useCallback((value) => {
12
+ onTypingChange?.(true);
12
13
  setSearch(value);
13
14
  if (TypeGuards.isNil(debounce)) {
14
15
  onSearchChange?.(value);
@@ -16,22 +17,20 @@ export const SearchInput = forwardRef((props, ref) => {
16
17
  else {
17
18
  if (setSearchTimeout.current) {
18
19
  clearTimeout(setSearchTimeout.current);
20
+ setSearchTimeout.current = null;
19
21
  }
20
22
  setSearchTimeout.current = setTimeout(() => {
21
23
  onSearchChange(value);
22
24
  onTypingChange?.(false);
23
25
  }, debounce ?? 0);
24
26
  }
25
- };
26
- const handleClear = () => {
27
+ }, [onSearchChange, onTypingChange]);
28
+ const handleClear = useCallback(() => {
27
29
  setSearch('');
28
30
  onSearchChange?.('');
29
31
  onClear?.();
30
- };
31
- return (<TextInput value={search} onValueChange={(value) => {
32
- onTypingChange?.(true);
33
- handleChangeSearch(value);
34
- }} placeholder={placeholder} debugName={`Search ${debugName}`} rightIcon={(showClear?.(search) ?? true) && {
32
+ }, []);
33
+ return (<TextInput value={search} onValueChange={handleChangeSearch} placeholder={placeholder} debugName={`Search ${debugName}`} rightIcon={(showClear?.(search) ?? true) && {
35
34
  name: clearIcon,
36
35
  onPress: handleClear,
37
36
  }} leftIcon={{
@@ -39,7 +38,7 @@ export const SearchInput = forwardRef((props, ref) => {
39
38
  }} ref={ref} {...others}/>);
40
39
  });
41
40
  SearchInput.defaultProps = {
42
- debounce: null,
41
+ debounce: 500,
43
42
  clearIcon: 'x',
44
43
  searchIcon: 'search',
45
44
  showClear: (s) => !!s?.trim?.()
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SearchInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGnD,OAAO,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAgB5C,MAAM,CAAC,MAAM,WAAW,GAAuE,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACvH,MAAM,EACJ,SAAS,EACT,OAAO,EACP,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,QAAQ,EACR,WAAW,EACX,KAAK,EACL,aAAa,EACb,SAAS,EACT,GAAG,MAAM,EACV,GAAG;QACF,GAAG,WAAW,CAAC,YAAY;QAC3B,GAAG,KAAK;KACT,CAAA;IAED,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAE/G,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAsB,IAAI,CAAC,CAAA;IAEhE,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;QAC3C,SAAS,CAAC,KAAK,CAAC,CAAA;QAEhB,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;YAC9B,cAAc,EAAE,CAAC,KAAK,CAAC,CAAA;SACxB;aAAM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?: (w: number, h: number) => void;
112
112
  onScroll?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
113
113
  scrollEnabled?: boolean;
114
- keyExtractor?: (item: any, index: number) => string;
115
114
  contentContainerStyle?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
115
+ keyExtractor?: (item: any, index: number) => string;
116
116
  onMomentumScrollEnd?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
117
117
  decelerationRate?: number | "normal" | "fast";
118
118
  horizontal?: boolean;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export * from './hooks';
4
4
  export * from './modules';
5
5
  export * from './deprecated';
6
6
  export { Linking } from 'react-native';
7
+ export { MobileStyleRegistry } from './Registry';
7
8
  import uuid from 'react-native-uuid';
8
9
  export { uuid };
9
- export { MobileStyleRegistry } from './Registry';
10
10
  import './modules/formConfig';
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ export * from './hooks';
4
4
  export * from './modules';
5
5
  export * from './deprecated';
6
6
  export { Linking } from 'react-native';
7
+ export { MobileStyleRegistry } from './Registry';
7
8
  import uuid from 'react-native-uuid';
8
9
  export { uuid };
9
- export { MobileStyleRegistry } from './Registry';
10
10
  import './modules/formConfig';
11
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,IAAI,MAAM,mBAAmB,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,CAAA;AACf,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,IAAI,MAAM,mBAAmB,CAAA;AAEpC,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,OAAO,sBAAsB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { uuid } from '..';
1
+ import uuid from 'react-native-uuid';
2
2
  const throttleTimerId = {};
3
3
  export function throttle(func, ref, delay = 200) {
4
4
  if (!ref) {
@@ -1 +1 @@
1
- {"version":3,"file":"backgroundTimer.js","sourceRoot":"","sources":["../../src/modules/backgroundTimer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAEzB,MAAM,eAAe,GAAG,EAAE,CAAA;AAE1B,MAAM,UAAU,QAAQ,CAAC,IAAiB,EAAE,GAAY,EAAE,KAAK,GAAG,GAAG;IACnE,IAAI,CAAC,GAAG,EAAE;QACR,GAAG,GAAG,IAAI,CAAC,EAAE,EAAY,CAAA;KAC1B;IACD,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;QACxB,OAAM;KACP;IACD,eAAe,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;QAChC,IAAI,EAAE,CAAA;QACN,eAAe,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;IAClC,CAAC,EAAE,KAAK,CAAC,CAAA;IAET,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,eAAe,GAAG,EAAE,CAAA;AAE1B,MAAM,UAAU,QAAQ,CAAC,IAAiB,EAAE,GAAY,EAAE,KAAK,GAAG,GAAG;IACnE,IAAI,CAA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AC,GAAG,CAAC,GAAG,UAAU,CAAC;QAChC,IAAI,EAAE,CAAA;QACN,eAAe,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;IAClC,CAAC,EAAE,KAAK,CAAC,CAAA;IAET,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1,10 +1,8 @@
1
1
  import { AnyFunction } from '@codeleap/types';
2
- import { UseListEffect } from '@codeleap/query';
3
- type useQueryListRefresh = (listQuery: Parameters<UseListEffect>[0], options?: {
2
+ import { QueryManagerOptions } from '@codeleap/query';
3
+ type useQueryListRefresh = (listQuery: Parameters<QueryManagerOptions<any, any>['useListEffect']>[0], options?: {
4
4
  staleTime?: number;
5
- silentRefresh?: boolean;
6
5
  initialStale?: boolean;
7
- cancelQueryEnabled?: boolean;
8
6
  refreshQueryEnabled?: boolean;
9
7
  onFocus?: AnyFunction;
10
8
  onBlur?: AnyFunction;
@@ -2,19 +2,17 @@ import React from 'react';
2
2
  import { useFocusEffect } from '@react-navigation/native';
3
3
  import { TypeGuards } from '@codeleap/types';
4
4
  export const useQueryListRefresh = (listQuery, options = {}) => {
5
- const { staleTime = 5000, initialStale = listQuery?.query?.isStale, cancelQueryEnabled = true, refreshQueryEnabled = true, silentRefresh = false, onFocus, onBlur, } = options;
5
+ const { staleTime = 5000, initialStale = listQuery?.isStale, refreshQueryEnabled = true, onFocus, onBlur, } = options;
6
6
  const staleRefetch = React.useRef(initialStale);
7
7
  const staleTimeout = React.useRef(null);
8
8
  useFocusEffect(React.useCallback(() => {
9
9
  if (staleRefetch.current && refreshQueryEnabled) {
10
- listQuery?.refreshQuery(silentRefresh);
10
+ listQuery?.refetch();
11
11
  }
12
12
  if (TypeGuards.isFunction(onFocus)) {
13
13
  onFocus?.();
14
14
  }
15
15
  return () => {
16
- if (cancelQueryEnabled)
17
- listQuery?.cancelQuery?.();
18
16
  staleRefetch.current = false;
19
17
  if (staleTimeout.current == null) {
20
18
  staleTimeout.current = setTimeout(() => {
@@ -1 +1 @@
1
- {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G,EAAE;oBACrC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;oBAC3B,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;oBAClC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;gBAC7B,CAAC,EAAE,SAAS,CAAC,CAAA;aACd;YAED,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;gBACjC,MAAM,EAAE,EAAE,CAAA;aACX;QACH,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CACP,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "5.8.3",
3
+ "version": "5.8.4",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -9,28 +9,28 @@
9
9
  "directory": "packages/mobile"
10
10
  },
11
11
  "devDependencies": {
12
- "@codeleap/types": "5.8.3",
13
- "@codeleap/utils": "5.8.3",
14
- "@codeleap/hooks": "5.8.3",
15
- "@codeleap/form": "5.8.3",
16
- "@codeleap/query": "5.8.3",
17
- "@codeleap/logger": "5.8.3",
18
- "@codeleap/config": "5.8.3",
19
- "@codeleap/modals": "5.8.3"
12
+ "@codeleap/types": "5.8.4",
13
+ "@codeleap/utils": "5.8.4",
14
+ "@codeleap/hooks": "5.8.4",
15
+ "@codeleap/form": "5.8.4",
16
+ "@codeleap/query": "5.8.4",
17
+ "@codeleap/logger": "5.8.4",
18
+ "@codeleap/config": "5.8.4",
19
+ "@codeleap/modals": "5.8.4"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tsc --build",
23
23
  "lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\""
24
24
  },
25
25
  "peerDependencies": {
26
- "@codeleap/types": "5.8.3",
27
- "@codeleap/utils": "5.8.3",
28
- "@codeleap/hooks": "5.8.3",
29
- "@codeleap/form": "5.8.3",
30
- "@codeleap/query": "5.8.3",
31
- "@codeleap/logger": "5.8.3",
32
- "@codeleap/styles": "5.8.3",
33
- "@codeleap/modals": "5.8.3",
26
+ "@codeleap/types": "5.8.4",
27
+ "@codeleap/utils": "5.8.4",
28
+ "@codeleap/hooks": "5.8.4",
29
+ "@codeleap/form": "5.8.4",
30
+ "@codeleap/query": "5.8.4",
31
+ "@codeleap/logger": "5.8.4",
32
+ "@codeleap/styles": "5.8.4",
33
+ "@codeleap/modals": "5.8.4",
34
34
  "@d11/react-native-fast-image": "8.9.2",
35
35
  "@react-native-firebase/messaging": "21.12.0",
36
36
  "@react-navigation/bottom-tabs": "7.3.10",
@@ -56,6 +56,6 @@
56
56
  "react-native-masked-text": "1.13.0",
57
57
  "react-native-reanimated-carousel": "4.0.2",
58
58
  "react-native-sortables": "1.1.1",
59
- "react-native-uuid": "2.0.1"
59
+ "react-native-uuid": "2.0.3"
60
60
  }
61
61
  }
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "5.8.3",
3
+ "version": "5.8.4",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -56,6 +56,6 @@
56
56
  "react-native-masked-text": "1.13.0",
57
57
  "react-native-reanimated-carousel": "4.0.2",
58
58
  "react-native-sortables": "1.1.1",
59
- "react-native-uuid": "2.0.1"
59
+ "react-native-uuid": "2.0.3"
60
60
  }
61
61
  }
@@ -1,9 +1,9 @@
1
- import React, { forwardRef, useState } from 'react'
1
+ import React, { forwardRef, useCallback, useState } from 'react'
2
2
  import { AppIcon } from '@codeleap/styles'
3
- import { ComponentWithDefaultProps, ForwardRefComponentWithDefaultProps } from '../../types'
3
+ import { ForwardRefComponentWithDefaultProps } from '../../types'
4
4
  import { TextInputProps, TextInput } from '../TextInput'
5
5
  import { TypeGuards } from '@codeleap/types'
6
- import { TextInput as RNTextInput } from 'react-native'
6
+ import { TextInput as RNTextInput } from 'react-native'
7
7
 
8
8
  export type SearchInputProps = {
9
9
  onTypingChange: (isTyping: boolean) => void
@@ -41,7 +41,9 @@ export const SearchInput: ForwardRefComponentWithDefaultProps<SearchInputProps,
41
41
 
42
42
  const setSearchTimeout = React.useRef<NodeJS.Timer | null>(null)
43
43
 
44
- const handleChangeSearch = (value: string) => {
44
+ const handleChangeSearch = useCallback((value: string) => {
45
+ onTypingChange?.(true)
46
+
45
47
  setSearch(value)
46
48
 
47
49
  if (TypeGuards.isNil(debounce)) {
@@ -49,29 +51,26 @@ export const SearchInput: ForwardRefComponentWithDefaultProps<SearchInputProps,
49
51
  } else {
50
52
  if (setSearchTimeout.current) {
51
53
  clearTimeout(setSearchTimeout.current)
54
+ setSearchTimeout.current = null
52
55
  }
53
56
 
54
57
  setSearchTimeout.current = setTimeout(() => {
55
-
56
58
  onSearchChange(value)
57
59
  onTypingChange?.(false)
58
60
  }, debounce ?? 0)
59
61
  }
60
- }
62
+ }, [onSearchChange, onTypingChange])
61
63
 
62
- const handleClear = () => {
64
+ const handleClear = useCallback(() => {
63
65
  setSearch('')
64
66
  onSearchChange?.('')
65
67
  onClear?.()
66
- }
68
+ }, [])
67
69
 
68
70
  return (
69
71
  <TextInput
70
72
  value={search}
71
- onValueChange={(value) => {
72
- onTypingChange?.(true)
73
- handleChangeSearch(value)
74
- }}
73
+ onValueChange={handleChangeSearch}
75
74
  placeholder={placeholder}
76
75
  debugName={`Search ${debugName}`}
77
76
  rightIcon={(showClear?.(search) ?? true) && {
@@ -88,7 +87,7 @@ export const SearchInput: ForwardRefComponentWithDefaultProps<SearchInputProps,
88
87
  })
89
88
 
90
89
  SearchInput.defaultProps = {
91
- debounce: null,
90
+ debounce: 500,
92
91
  clearIcon: 'x' as AppIcon,
93
92
  searchIcon: 'search' as AppIcon,
94
93
  showClear: (s) => !!s?.trim?.()
package/src/index.ts CHANGED
@@ -5,8 +5,10 @@ export * from './modules'
5
5
  export * from './deprecated'
6
6
 
7
7
  export { Linking } from 'react-native'
8
+ export { MobileStyleRegistry } from './Registry'
9
+
8
10
  import uuid from 'react-native-uuid'
11
+
9
12
  export { uuid }
10
- export { MobileStyleRegistry } from './Registry'
11
13
 
12
14
  import './modules/formConfig'
@@ -1,5 +1,5 @@
1
1
  import { AnyFunction } from '@codeleap/types'
2
- import { uuid } from '..'
2
+ import uuid from 'react-native-uuid'
3
3
 
4
4
  const throttleTimerId = {}
5
5
 
@@ -1,15 +1,13 @@
1
1
  import React from 'react'
2
2
  import { useFocusEffect } from '@react-navigation/native'
3
3
  import { AnyFunction, TypeGuards } from '@codeleap/types'
4
- import { UseListEffect } from '@codeleap/query'
4
+ import { QueryManagerOptions } from '@codeleap/query'
5
5
 
6
6
  type useQueryListRefresh = (
7
- listQuery: Parameters<UseListEffect>[0],
7
+ listQuery: Parameters<QueryManagerOptions<any, any>['useListEffect']>[0],
8
8
  options?: {
9
9
  staleTime?: number
10
- silentRefresh?: boolean
11
10
  initialStale?: boolean
12
- cancelQueryEnabled?: boolean
13
11
  refreshQueryEnabled?: boolean
14
12
  onFocus?: AnyFunction
15
13
  onBlur?: AnyFunction
@@ -19,10 +17,8 @@ type useQueryListRefresh = (
19
17
  export const useQueryListRefresh: useQueryListRefresh = (listQuery, options = {}) => {
20
18
  const {
21
19
  staleTime = 5000,
22
- initialStale = listQuery?.query?.isStale,
23
- cancelQueryEnabled = true,
20
+ initialStale = listQuery?.isStale,
24
21
  refreshQueryEnabled = true,
25
- silentRefresh = false,
26
22
  onFocus,
27
23
  onBlur,
28
24
  } = options
@@ -33,7 +29,7 @@ export const useQueryListRefresh: useQueryListRefresh = (listQuery, options = {}
33
29
  useFocusEffect(
34
30
  React.useCallback(() => {
35
31
  if (staleRefetch.current && refreshQueryEnabled) {
36
- listQuery?.refreshQuery(silentRefresh)
32
+ listQuery?.refetch()
37
33
  }
38
34
 
39
35
  if (TypeGuards.isFunction(onFocus)) {
@@ -41,7 +37,6 @@ export const useQueryListRefresh: useQueryListRefresh = (listQuery, options = {}
41
37
  }
42
38
 
43
39
  return () => {
44
- if (cancelQueryEnabled) listQuery?.cancelQuery?.()
45
40
  staleRefetch.current = false
46
41
 
47
42
  if (staleTimeout.current == null) {