@chem-po/react-native 0.0.52 → 0.0.53

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.
Files changed (98) hide show
  1. package/package.json +5 -20
  2. package/src/components/box/Center.tsx +0 -19
  3. package/src/components/box/CollapseHorizontal.tsx +0 -44
  4. package/src/components/box/ContentBox.tsx +0 -24
  5. package/src/components/box/DropShadow.tsx +0 -28
  6. package/src/components/box/ExpandOnMount.tsx +0 -74
  7. package/src/components/box/Expandable.tsx +0 -143
  8. package/src/components/box/FullSizeContainer.tsx +0 -64
  9. package/src/components/box/index.ts +0 -7
  10. package/src/components/button/ActionButton.tsx +0 -196
  11. package/src/components/button/ButtonText.tsx +0 -60
  12. package/src/components/button/DeleteButton.tsx +0 -288
  13. package/src/components/button/LoadingButton.tsx +0 -41
  14. package/src/components/button/Toggle.tsx +0 -109
  15. package/src/components/button/hooks.ts +0 -66
  16. package/src/components/button/index.ts +0 -5
  17. package/src/components/feed/FeedContentPane.tsx +0 -97
  18. package/src/components/feed/MediaFeed.tsx +0 -199
  19. package/src/components/feed/MediaFeedBackground.tsx +0 -136
  20. package/src/components/feed/MediaFeedRefresh.tsx +0 -113
  21. package/src/components/feed/constants.ts +0 -2
  22. package/src/components/feed/context.tsx +0 -19
  23. package/src/components/feed/hooks.ts +0 -279
  24. package/src/components/feed/index.ts +0 -2
  25. package/src/components/form/Condition.tsx +0 -27
  26. package/src/components/form/Field.tsx +0 -44
  27. package/src/components/form/Form.tsx +0 -452
  28. package/src/components/form/FormFooter.tsx +0 -164
  29. package/src/components/form/UploadProgress/index.tsx +0 -50
  30. package/src/components/form/index.ts +0 -3
  31. package/src/components/form/input/Editable.tsx +0 -206
  32. package/src/components/form/input/InputSlider.tsx +0 -71
  33. package/src/components/form/input/OptionalTag.tsx +0 -43
  34. package/src/components/form/input/StandaloneInput.tsx +0 -49
  35. package/src/components/form/input/boolean/index.tsx +0 -53
  36. package/src/components/form/input/color/index.tsx +0 -145
  37. package/src/components/form/input/common/InputClearButton.tsx +0 -57
  38. package/src/components/form/input/date/index.tsx +0 -125
  39. package/src/components/form/input/datetime/index.tsx +0 -176
  40. package/src/components/form/input/file/index.tsx +0 -310
  41. package/src/components/form/input/hooks/index.ts +0 -2
  42. package/src/components/form/input/hooks/useInputColor.ts +0 -7
  43. package/src/components/form/input/hooks/useInputImperativeHandle.ts +0 -22
  44. package/src/components/form/input/hooks/useInputStyles.ts +0 -114
  45. package/src/components/form/input/index.ts +0 -4
  46. package/src/components/form/input/input.tsx +0 -218
  47. package/src/components/form/input/multipleSelect/index.tsx +0 -221
  48. package/src/components/form/input/number/index.tsx +0 -108
  49. package/src/components/form/input/select/index.tsx +0 -152
  50. package/src/components/form/input/socialMedia/index.tsx +0 -235
  51. package/src/components/form/input/text/AutoResizeTextarea.tsx +0 -41
  52. package/src/components/form/input/text/index.tsx +0 -99
  53. package/src/components/form/input/text/textarea.tsx +0 -32
  54. package/src/components/form/input/text/useWebAutoResize.tsx +0 -73
  55. package/src/components/form/input/time/index.tsx +0 -125
  56. package/src/components/form/types.ts +0 -8
  57. package/src/components/form/view/file.tsx +0 -80
  58. package/src/components/form/view/index.tsx +0 -125
  59. package/src/components/form/view/multipleSelect.tsx +0 -85
  60. package/src/components/form/view/select.tsx +0 -83
  61. package/src/components/form/view/styles.ts +0 -12
  62. package/src/components/icons/index.tsx +0 -28
  63. package/src/components/image/ImageViewModal.tsx +0 -319
  64. package/src/components/image/index.ts +0 -1
  65. package/src/components/index.ts +0 -8
  66. package/src/components/layout/CollapseHorizontal.tsx +0 -92
  67. package/src/components/loading/CircularProgress.tsx +0 -56
  68. package/src/components/loading/Loading.tsx +0 -146
  69. package/src/components/loading/LoadingImage.tsx +0 -163
  70. package/src/components/loading/LoadingOverlay.tsx +0 -74
  71. package/src/components/loading/LoadingSwitch.tsx +0 -110
  72. package/src/components/loading/ProgressBar.tsx +0 -75
  73. package/src/components/loading/index.ts +0 -6
  74. package/src/components/text/AnimatedText.tsx +0 -68
  75. package/src/components/text/Txt.tsx +0 -12
  76. package/src/components/text/index.ts +0 -1
  77. package/src/components/theme/colorMode/DarkModeToggle.tsx +0 -47
  78. package/src/components/theme/colorMode/index.ts +0 -1
  79. package/src/components/theme/index.ts +0 -1
  80. package/src/constants/index.ts +0 -1
  81. package/src/constants/toast.ts +0 -24
  82. package/src/contexts/fonts.tsx +0 -23
  83. package/src/contexts/index.ts +0 -1
  84. package/src/contexts/root.tsx +0 -190
  85. package/src/hooks/index.ts +0 -3
  86. package/src/hooks/useFadeIn.ts +0 -48
  87. package/src/hooks/useFont.ts +0 -25
  88. package/src/hooks/useRefreshFontScale.ts +0 -39
  89. package/src/hooks/useThemeState.ts +0 -43
  90. package/src/index.ts +0 -6
  91. package/src/store/index.ts +0 -2
  92. package/src/store/useFontScale.ts +0 -8
  93. package/src/store/useScreen.ts +0 -25
  94. package/src/styles/fill.ts +0 -19
  95. package/src/types/forms.ts +0 -14
  96. package/src/types/index.ts +0 -1
  97. package/src/utils/downloadFile.ts +0 -61
  98. package/src/utils/downloadFileLegacy.ts +0 -66
@@ -1,206 +0,0 @@
1
- import { InputRef } from '@chem-po/core'
2
- import {
3
- CustomEditableViewProps,
4
- EditableProps,
5
- Field,
6
- useColorModeValue,
7
- useEditable,
8
- useIconColor,
9
- useThemeValue,
10
- } from '@chem-po/react'
11
- import { Ionicons } from '@expo/vector-icons'
12
- import React, { ForwardedRef, useCallback, useEffect } from 'react'
13
- import { StyleSheet, TextStyle, View, ViewStyle } from 'react-native'
14
- import { Pressable } from 'react-native-gesture-handler'
15
- import { useFontScale } from '../../../store/useFontScale'
16
- import { CustomInputProps } from '../../../types/forms'
17
- import { LoadingOverlay } from '../../loading/LoadingOverlay'
18
- import { UploadProgress } from '../UploadProgress'
19
- import { FieldView } from '../view'
20
- import { StandaloneInput } from './StandaloneInput'
21
-
22
- export const Editable = <T extends Field>({
23
- value: initValue,
24
- field,
25
- onSubmit,
26
- storagePath,
27
- style,
28
- onEditClose,
29
- onEditOpen,
30
- containerStyle,
31
- size,
32
- CustomInput,
33
- ref,
34
- CustomView,
35
- inputStyle,
36
- }: EditableProps<ViewStyle, TextStyle, T>) => {
37
- const {
38
- inputRef,
39
- onChange,
40
- isLoading,
41
- uploads,
42
- editHovered,
43
- handleEditOpen,
44
- isEditing,
45
- shouldSubmitOnChange,
46
- handleEditClose,
47
- submit,
48
- value,
49
- setEditHovered,
50
- } = useEditable({
51
- value: initValue,
52
- field,
53
- onSubmit,
54
- storagePath,
55
- onEditOpen,
56
- onEditClose,
57
- ref,
58
- })
59
- const fontScale = useFontScale(s => s.fontScale)
60
-
61
- useEffect(() => {
62
- if (isEditing) {
63
- inputRef.current?.focus()
64
- }
65
- }, [isEditing, inputRef])
66
-
67
- const iconColor = useIconColor()
68
- const submitBackgroundColor = useThemeValue('colors.accent.600')
69
- const editingBorderColor = useColorModeValue('#00000055', '#ffffff55')
70
-
71
- const RenderInput = useCallback(
72
- (props: CustomInputProps<T['defaultValue']>, ref?: ForwardedRef<InputRef | null>) => {
73
- if (CustomInput) {
74
- return <CustomInput {...props} ref={ref} />
75
- }
76
- if (!field) throw new Error('Editable component must have a field OR a CustomInput')
77
- return <StandaloneInput ref={ref} field={field} inputStyle={inputStyle} {...props} />
78
- },
79
- [CustomInput, field, inputStyle],
80
- )
81
-
82
- const RenderView = useCallback(
83
- (props: CustomEditableViewProps<T['defaultValue']>) => {
84
- if (CustomView) {
85
- return <CustomView {...props} />
86
- }
87
- if (!field) throw new Error('Editable component must have a field OR a CustomView')
88
- return <FieldView textStyle={inputStyle} field={field} {...props} />
89
- },
90
- [CustomView, field, inputStyle],
91
- )
92
-
93
- return (
94
- <View style={[styles.container, containerStyle]}>
95
- <View style={styles.contentContainer}>
96
- <View
97
- style={[
98
- styles.inputContainer,
99
- {
100
- opacity: isLoading ? 0 : 1,
101
- borderColor: isEditing || editHovered ? editingBorderColor : 'transparent',
102
- },
103
- ]}>
104
- {isEditing || shouldSubmitOnChange ? (
105
- <RenderInput
106
- onChange={onChange}
107
- ref={inputRef}
108
- value={value}
109
- inEditable
110
- style={style}
111
- size={size}
112
- />
113
- ) : (
114
- <RenderView inEditable noLabel size={size} value={value} />
115
- )}
116
- </View>
117
- {!shouldSubmitOnChange ? (
118
- <View style={styles.buttonsContainer}>
119
- {isEditing ? (
120
- <>
121
- <Pressable
122
- onPress={() => {
123
- handleEditClose()
124
- }}
125
- style={[
126
- styles.submitButton,
127
- {
128
- borderColor: iconColor,
129
- borderWidth: 1,
130
- width: 28 * fontScale,
131
- height: 28 * fontScale,
132
- },
133
- ]}
134
- onPressIn={() => setEditHovered(true)}
135
- onPressOut={() => setEditHovered(false)}>
136
- <Ionicons name="close-outline" size={20 * fontScale} color={iconColor} />
137
- </Pressable>
138
- <Pressable
139
- onPress={() => {
140
- submit()
141
- }}
142
- style={[
143
- styles.submitButton,
144
- {
145
- backgroundColor: submitBackgroundColor,
146
- width: 28 * fontScale,
147
- height: 28 * fontScale,
148
- },
149
- ]}
150
- onPressIn={() => setEditHovered(true)}
151
- onPressOut={() => setEditHovered(false)}>
152
- <Ionicons color="white" name="checkmark-outline" size={20 * fontScale} />
153
- </Pressable>
154
- </>
155
- ) : (
156
- <Pressable
157
- onPress={() => {
158
- handleEditOpen()
159
- }}
160
- style={[styles.submitButton, { width: 28 * fontScale, height: 28 * fontScale }]}
161
- onPressIn={() => setEditHovered(true)}
162
- onPressOut={() => setEditHovered(false)}>
163
- <Ionicons name="create-outline" size={20 * fontScale} color={iconColor} />
164
- </Pressable>
165
- )}
166
- </View>
167
- ) : null}
168
- <LoadingOverlay loading={isLoading} />
169
- </View>
170
- <UploadProgress uploads={uploads} />
171
- </View>
172
- )
173
- }
174
-
175
- const styles = StyleSheet.create({
176
- container: {
177
- borderRadius: 4,
178
- width: '100%',
179
- },
180
- buttonsContainer: {
181
- flexDirection: 'row',
182
- justifyContent: 'center',
183
- paddingTop: 6,
184
- paddingHorizontal: 4,
185
- gap: 10,
186
- },
187
- contentContainer: {
188
- flexDirection: 'row',
189
- gap: 10,
190
- position: 'relative',
191
- width: '100%',
192
- },
193
- inputContainer: {
194
- flex: 1,
195
- minWidth: 0,
196
- borderWidth: 1,
197
- borderStyle: 'dashed',
198
- },
199
- submitButton: {
200
- width: 28,
201
- height: 28,
202
- borderRadius: 4,
203
- alignItems: 'center',
204
- justifyContent: 'center',
205
- },
206
- })
@@ -1,71 +0,0 @@
1
- import { Gradient } from '@chem-po/core'
2
- import Slider from '@react-native-community/slider'
3
- import React from 'react'
4
- import { StyleSheet, Text, View } from 'react-native'
5
-
6
- type SliderProps = React.ComponentProps<typeof Slider>
7
-
8
- export const InputSlider = ({
9
- // label,
10
- gradient,
11
- value,
12
- minimumValue,
13
- maximumValue,
14
- ...props
15
- }: {
16
- label: string
17
- gradient?: Gradient
18
- } & SliderProps) => {
19
- return (
20
- <View style={[styles.container, { opacity: value !== undefined ? 1 : 0.5 }]}>
21
- <View style={styles.sliderContainer}>
22
- {minimumValue !== undefined ? (
23
- <Text style={[styles.label, gradient ? styles.gradientText : null]}>
24
- {typeof minimumValue === 'number'
25
- ? minimumValue.toFixed((props?.step ?? 1) < 1 ? 2 : 0)
26
- : ''}
27
- </Text>
28
- ) : null}
29
-
30
- <Slider
31
- style={styles.slider}
32
- minimumValue={minimumValue}
33
- maximumValue={maximumValue}
34
- step={1}
35
- {...props}
36
- />
37
-
38
- {maximumValue !== undefined ? (
39
- <Text style={[styles.label, gradient ? styles.gradientText : null]}>
40
- {typeof maximumValue === 'number'
41
- ? maximumValue.toFixed((props?.step ?? 1) < 1 ? 2 : 0)
42
- : ''}
43
- </Text>
44
- ) : null}
45
- </View>
46
- </View>
47
- )
48
- }
49
-
50
- const styles = StyleSheet.create({
51
- container: {
52
- width: '100%',
53
- paddingVertical: 8,
54
- },
55
- sliderContainer: {
56
- flexDirection: 'row',
57
- alignItems: 'center',
58
- width: '100%',
59
- },
60
- slider: {
61
- flex: 1,
62
- height: 40,
63
- },
64
- label: {
65
- fontSize: 14,
66
- marginHorizontal: 8,
67
- },
68
- gradientText: {
69
- color: '#007AFF', // iOS blue color, you can customize this
70
- },
71
- })
@@ -1,43 +0,0 @@
1
- import { Field } from '@chem-po/react'
2
- import React, { useMemo } from 'react'
3
- import { StyleSheet, Text, View } from 'react-native'
4
-
5
- export const OptionalTag = <T extends Field>({
6
- value,
7
- field,
8
- }: {
9
- field: T
10
- value: T['defaultValue'] | undefined | null
11
- }) => {
12
- const top = useMemo(() => {
13
- if (value === '' || value === undefined || value === null) return 1
14
- switch (field._type) {
15
- case 'text':
16
- case 'number':
17
- case 'select':
18
- case 'date':
19
- case 'time':
20
- case 'datetime':
21
- return -1
22
- default:
23
- return 1
24
- }
25
- }, [value, field])
26
-
27
- return (
28
- <View style={[styles.container, { top }]}>
29
- <Text style={styles.text}>OPTIONAL</Text>
30
- </View>
31
- )
32
- }
33
-
34
- const styles = StyleSheet.create({
35
- container: {
36
- position: 'absolute',
37
- right: 12,
38
- },
39
- text: {
40
- fontSize: 12,
41
- opacity: 0.6,
42
- },
43
- })
@@ -1,49 +0,0 @@
1
- import { InputRef } from '@chem-po/core'
2
- import { BaseCustomInputProps, Field, useStandaloneInput } from '@chem-po/react'
3
- import React, { ForwardedRef, forwardRef } from 'react'
4
- import { TextStyle, ViewStyle } from 'react-native'
5
- import { Input } from './input'
6
-
7
- interface StandaloneInputProps<
8
- T extends Field,
9
- ContainerStyle extends ViewStyle = ViewStyle,
10
- InputStyle extends TextStyle = TextStyle,
11
- > extends BaseCustomInputProps<T['defaultValue'], ContainerStyle, InputStyle> {
12
- field: T
13
- }
14
-
15
- const StandaloneInputBase = <
16
- T extends Field,
17
- ContainerStyle extends ViewStyle = ViewStyle,
18
- InputStyle extends TextStyle = TextStyle,
19
- >(
20
- {
21
- onChange,
22
- value,
23
- field,
24
- onBlur,
25
- inEditable,
26
- onFocus,
27
- style,
28
- size,
29
- inputStyle,
30
- }: StandaloneInputProps<T, ContainerStyle, InputStyle>,
31
- ref: ForwardedRef<InputRef>,
32
- ) => {
33
- const { inputProps, meta } = useStandaloneInput(field, value, onChange, onFocus, onBlur)
34
-
35
- return (
36
- <Input
37
- ref={ref}
38
- field={field}
39
- inEditable={inEditable}
40
- style={style}
41
- input={inputProps}
42
- inputStyle={inputStyle}
43
- formSize={size}
44
- meta={meta}
45
- />
46
- )
47
- }
48
-
49
- export const StandaloneInput = forwardRef(StandaloneInputBase)
@@ -1,53 +0,0 @@
1
- import { InputRef } from '@chem-po/core'
2
- import { BooleanField, useBooleanFieldText } from '@chem-po/react'
3
- import React, { ForwardedRef, forwardRef, useImperativeHandle } from 'react'
4
- import { Switch, View } from 'react-native'
5
- import { Txt } from '../../../text/Txt'
6
- import { FieldProps } from '../../types'
7
-
8
- const BaseCheckboxComponent = (
9
- { field, input: { onChange, value, ...input } }: FieldProps<BooleanField>,
10
- ref: ForwardedRef<InputRef>,
11
- ) => {
12
- useImperativeHandle(ref, () => ({
13
- focus: () => {},
14
- blur: () => {},
15
- }))
16
- const text = useBooleanFieldText(field, value)
17
- return (
18
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
19
- <Switch value={value} onValueChange={onChange} {...input} />
20
- <Txt style={{ marginLeft: 8, fontWeight: '600', opacity: value ? 0.9 : 0.6 }}>{text}</Txt>
21
- </View>
22
- )
23
- }
24
-
25
- const CheckboxBooleanComponent = forwardRef<InputRef, FieldProps<BooleanField>>(
26
- BaseCheckboxComponent,
27
- )
28
-
29
- const BaseSwitchComponent = (
30
- { field, input: { onChange, value, ...input } }: FieldProps<BooleanField>,
31
- ref: ForwardedRef<InputRef>,
32
- ) => {
33
- useImperativeHandle(ref, () => ({
34
- focus: () => {},
35
- blur: () => {},
36
- }))
37
- const text = useBooleanFieldText(field, value)
38
- return (
39
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
40
- <Switch value={value} onValueChange={onChange} {...input} />
41
- <Txt style={{ marginLeft: 8, fontWeight: '600', opacity: value ? 0.9 : 0.6 }}>{text}</Txt>
42
- </View>
43
- )
44
- }
45
-
46
- const SwitchBooleanComponent = forwardRef<InputRef, FieldProps<BooleanField>>(BaseSwitchComponent)
47
-
48
- const BaseBooleanComponent = (props: FieldProps<BooleanField>, ref: ForwardedRef<InputRef>) => {
49
- if (props.field.type === 'switch') return <SwitchBooleanComponent ref={ref} {...props} />
50
- return <CheckboxBooleanComponent ref={ref} {...props} />
51
- }
52
-
53
- export const BooleanComponent = forwardRef<InputRef, FieldProps<BooleanField>>(BaseBooleanComponent)
@@ -1,145 +0,0 @@
1
- import { colorValueToHex, Gradient, gradients, InputRef } from '@chem-po/core'
2
- import { ColorField } from '@chem-po/react'
3
- import React, { forwardRef, useCallback, useMemo } from 'react'
4
- import { StyleSheet, Text, View } from 'react-native'
5
- import { FieldProps } from '../../types'
6
- import { InputSlider } from '../InputSlider'
7
- import { useInputImperativeHandle } from '../hooks/useInputImperativeHandle'
8
-
9
- const ColorComponentSlider = ({
10
- label,
11
- gradient,
12
- value,
13
- ...props
14
- }: {
15
- label: string
16
- gradient: Gradient
17
- } & React.ComponentProps<typeof InputSlider>) => (
18
- <InputSlider
19
- label={label}
20
- value={value}
21
- minimumValue={0}
22
- maximumValue={255}
23
- step={1}
24
- gradient={gradient}
25
- {...props}
26
- />
27
- )
28
-
29
- export const ColorComponent = forwardRef<InputRef, FieldProps<ColorField>>(
30
- ({ input: { onChange, value }, field, meta }, ref) => {
31
- const { withAlpha, defaultValue } = field
32
- const { active } = meta || {}
33
-
34
- useInputImperativeHandle(ref)
35
-
36
- const handleChange = useCallback(
37
- (key: 'r' | 'g' | 'b' | 'a', val: number) => {
38
- if (withAlpha) {
39
- onChange({
40
- r: 0,
41
- g: 0,
42
- b: 0,
43
- a: 1,
44
- ...value,
45
- [key]: val,
46
- })
47
- } else {
48
- onChange({
49
- r: 0,
50
- g: 0,
51
- b: 0,
52
- ...value,
53
- [key]: val,
54
- })
55
- }
56
- },
57
- [value, onChange, withAlpha],
58
- )
59
-
60
- const withDefault = useMemo(() => ({ ...defaultValue, ...value }), [defaultValue, value])
61
- const asHex = useMemo(() => colorValueToHex(!!withAlpha, withDefault), [withDefault, withAlpha])
62
-
63
- return (
64
- <View style={styles.container}>
65
- <View style={[styles.colorPreview, { backgroundColor: asHex }]}>
66
- <Text style={styles.hexText}>{asHex}</Text>
67
- </View>
68
- <View style={[styles.slidersContainer, active && styles.activeContainer]}>
69
- <ColorComponentSlider
70
- label="R"
71
- gradient={gradients.red}
72
- value={value?.r}
73
- onValueChange={updatedRed => handleChange('r', updatedRed)}
74
- />
75
- <ColorComponentSlider
76
- label="G"
77
- gradient={gradients.green}
78
- value={value?.g}
79
- onValueChange={updatedGreen => handleChange('g', updatedGreen)}
80
- />
81
- <ColorComponentSlider
82
- label="B"
83
- gradient={gradients.blue}
84
- value={value?.b}
85
- onValueChange={updatedBlue => handleChange('b', updatedBlue)}
86
- />
87
- {withAlpha ? (
88
- <ColorComponentSlider
89
- label="A"
90
- gradient={gradients.midnight}
91
- value={value?.a}
92
- onValueChange={updatedAlpha => handleChange('a', updatedAlpha)}
93
- />
94
- ) : null}
95
- </View>
96
- </View>
97
- )
98
- },
99
- )
100
-
101
- const styles = StyleSheet.create({
102
- container: {
103
- width: '100%',
104
- flexDirection: 'row',
105
- alignItems: 'center',
106
- gap: 8,
107
- },
108
- colorPreview: {
109
- width: 80,
110
- height: 80,
111
- borderRadius: 40,
112
- justifyContent: 'center',
113
- alignItems: 'center',
114
- shadowColor: '#000',
115
- shadowOffset: {
116
- width: 0,
117
- height: 2,
118
- },
119
- shadowOpacity: 0.25,
120
- shadowRadius: 3.84,
121
- elevation: 5,
122
- },
123
- hexText: {
124
- fontSize: 16,
125
- color: '#fff',
126
- textShadowColor: 'rgba(0, 0, 0, 0.75)',
127
- textShadowOffset: { width: 0, height: 1 },
128
- textShadowRadius: 2,
129
- },
130
- slidersContainer: {
131
- flex: 1,
132
- padding: 8,
133
- borderRadius: 6,
134
- },
135
- activeContainer: {
136
- shadowColor: '#fff',
137
- shadowOffset: {
138
- width: 0,
139
- height: 0,
140
- },
141
- shadowOpacity: 0.5,
142
- shadowRadius: 5,
143
- elevation: 5,
144
- },
145
- })
@@ -1,57 +0,0 @@
1
- import { useBackgroundColor, useBorderColor, useIconColor } from '@chem-po/react'
2
- import { Ionicons } from '@expo/vector-icons'
3
- import React from 'react'
4
- import { StyleSheet } from 'react-native'
5
- import { Pressable } from 'react-native-gesture-handler'
6
-
7
- export const InputClearButton = ({
8
- onPress,
9
- isActive,
10
- marginRight,
11
- size,
12
- }: {
13
- onPress: () => void
14
- isActive: boolean
15
- marginRight?: number
16
- size: number
17
- }) => {
18
- const iconColor = useIconColor()
19
- const borderColor = useBorderColor()
20
- const backgroundColor = useBackgroundColor(100)
21
- return (
22
- <Pressable
23
- onPress={onPress}
24
- style={[
25
- styles.closeButton,
26
- { opacity: isActive ? 1 : 0, marginRight, borderColor, backgroundColor },
27
- ]}
28
- hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
29
- disabled={!isActive}>
30
- <Ionicons name="close" size={size} color={iconColor} style={{ alignSelf: 'center' }} />
31
- </Pressable>
32
- )
33
- }
34
-
35
- export const DateInputClearButton = ({
36
- onPress,
37
- isActive,
38
- size,
39
- }: {
40
- onPress: () => void
41
- isActive: boolean
42
- size: number
43
- }) => {
44
- return <InputClearButton marginRight={0} onPress={onPress} isActive={isActive} size={size} />
45
- }
46
-
47
- const styles = StyleSheet.create({
48
- closeButton: {
49
- padding: 3,
50
- borderRadius: 100,
51
- display: 'flex',
52
- alignItems: 'center',
53
- justifyContent: 'center',
54
- // backgroundColor: '#e2e8f0',
55
- borderWidth: 1,
56
- },
57
- })