@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,163 +0,0 @@
1
- import { useMounted } from '@chem-po/react'
2
- import { Ionicons } from '@expo/vector-icons'
3
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
4
- import { DimensionValue, Image, StyleSheet, View, ViewStyle } from 'react-native'
5
- import { Pressable } from 'react-native-gesture-handler'
6
- import { ImageViewModal } from '../image/ImageViewModal'
7
- import { LoadingLogo } from './Loading'
8
-
9
- export interface LoadingImageProps {
10
- src?: string | null
11
- loadingOverride?: boolean
12
- onLoad?: (dims: { width: number; height: number }) => void
13
- filename?: string
14
- fileType?: string
15
- withFullView?: boolean
16
- buttonFullView?: boolean
17
- style?: ViewStyle
18
- width?: DimensionValue
19
- height?: DimensionValue
20
- withDownload?: boolean
21
- }
22
-
23
- const emptyPng =
24
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII='
25
-
26
- export const LoadingImage = ({
27
- src,
28
- loadingOverride,
29
- onLoad,
30
- filename,
31
- fileType,
32
- width,
33
- height,
34
- withFullView,
35
- buttonFullView,
36
- withDownload,
37
- style,
38
- }: LoadingImageProps) => {
39
- const [imageLoading, setImageLoading] = useState(!!src)
40
- const imageRef = useRef<Image>(null)
41
-
42
- const [viewing, setViewing] = useState(false)
43
- const mounted = useMounted(100)
44
-
45
- const handleImageLoad = useCallback(() => {
46
- if (onLoad && src) {
47
- Image.getSize(src, (width, height) => {
48
- onLoad({ width, height })
49
- })
50
- }
51
- }, [onLoad, src])
52
-
53
- const [prevSrc, setPrevSrc] = useState(src)
54
- useEffect(() => {
55
- if (src) setPrevSrc(src)
56
- }, [src, prevSrc])
57
-
58
- const loading = useMemo(() => imageLoading || !!loadingOverride, [imageLoading, loadingOverride])
59
-
60
- const ImageComponent = (
61
- <Image
62
- ref={imageRef}
63
- source={{ uri: src ?? emptyPng }}
64
- style={[
65
- styles.image,
66
- {
67
- opacity: src && !loading ? 1 : 0,
68
- },
69
- ]}
70
- onLoadEnd={() => setImageLoading(false)}
71
- onLoad={handleImageLoad}
72
- resizeMode={src ? 'cover' : 'contain'}
73
- />
74
- )
75
-
76
- return (
77
- <View
78
- style={[
79
- styles.container,
80
- {
81
- width: width ?? '100%',
82
- height: height ?? '100%',
83
- opacity: mounted ? 1 : 0,
84
- },
85
- style,
86
- ]}>
87
- {!withFullView || buttonFullView ? (
88
- ImageComponent
89
- ) : (
90
- <Pressable
91
- onPress={() => setViewing(true)}
92
- style={{
93
- position: 'absolute',
94
- top: 0,
95
- left: 0,
96
- right: 0,
97
- bottom: 0,
98
- }}>
99
- {ImageComponent}
100
- </Pressable>
101
- )}
102
- {buttonFullView && (
103
- <Pressable style={styles.fullViewButton} onPress={() => setViewing(true)}>
104
- <Ionicons name="expand" size={20} color="white" style={styles.fullViewIcon} />
105
- </Pressable>
106
- )}
107
- <View
108
- style={[
109
- styles.loadingContainer,
110
- {
111
- opacity: loading ? 1 : 0,
112
- pointerEvents: loading ? 'auto' : 'none',
113
- },
114
- ]}>
115
- <LoadingLogo isLoading={loading} size={10} />
116
- </View>
117
- {viewing ? (
118
- <ImageViewModal
119
- withDownload={withDownload}
120
- filename={filename}
121
- fileType={fileType}
122
- isOpen
123
- src={src ?? emptyPng}
124
- onClose={() => setViewing(false)}
125
- />
126
- ) : null}
127
- </View>
128
- )
129
- }
130
-
131
- const styles = StyleSheet.create({
132
- container: {
133
- overflow: 'hidden',
134
- position: 'relative',
135
- },
136
- imageContainer: {
137
- width: '100%',
138
- height: '100%',
139
- },
140
- image: {
141
- width: '100%',
142
- height: '100%',
143
- },
144
- loadingContainer: {
145
- ...StyleSheet.absoluteFillObject,
146
- justifyContent: 'center',
147
- alignItems: 'center',
148
- },
149
- fullViewButton: {
150
- position: 'absolute',
151
- top: 8,
152
- right: 8,
153
- width: 28,
154
- height: 28,
155
- borderRadius: 14,
156
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
157
- justifyContent: 'center',
158
- alignItems: 'center',
159
- },
160
- fullViewIcon: {
161
- opacity: 0.8,
162
- },
163
- })
@@ -1,74 +0,0 @@
1
- import React, { useMemo } from 'react'
2
- import { Animated, StyleProp, StyleSheet, ViewStyle } from 'react-native'
3
- import { FadeInOptions, useFadeIn } from '../../hooks/useFadeIn'
4
- import { useFontScale } from '../../store/useFontScale'
5
- import { CircularProgress, CircularProgressProps } from './CircularProgress'
6
- const loadingFadeInProps: FadeInOptions = {
7
- activeOpacity: 0.8,
8
- duration: 100,
9
- }
10
- interface LoadingOverlayProps {
11
- loading: boolean
12
- fadeOptions?: FadeInOptions
13
- style?: StyleProp<ViewStyle>
14
- indicatorProps?: CircularProgressProps
15
- }
16
- export const LoadingOverlay = ({
17
- loading,
18
- fadeOptions,
19
- style,
20
- indicatorProps,
21
- }: LoadingOverlayProps) => {
22
- const opts = useMemo(() => ({ ...loadingFadeInProps, ...fadeOptions }), [fadeOptions])
23
- const opacity = useFadeIn(loading, opts)
24
-
25
- const fontScale = useFontScale(s => s.fontScale)
26
- return (
27
- <Animated.View
28
- style={[styles.overlay, style, { opacity, pointerEvents: loading ? 'auto' : 'none' }]}>
29
- <CircularProgress size={indicatorProps?.size ?? 20 * fontScale} {...indicatorProps} />
30
- </Animated.View>
31
- )
32
- }
33
-
34
- const withOverlayLoadingFadeIn: FadeInOptions = {
35
- enterDelay: 250,
36
- }
37
- export const WithLoadingOverlay = ({
38
- loading,
39
- children,
40
- style,
41
- overlayStyle,
42
- indicatorProps,
43
- }: {
44
- loading: boolean
45
- children: React.ReactNode
46
- style?: StyleProp<ViewStyle>
47
- overlayStyle?: StyleProp<ViewStyle>
48
- indicatorProps?: CircularProgressProps
49
- }) => {
50
- const bodyOpacity = useFadeIn(!loading, withOverlayLoadingFadeIn)
51
- return (
52
- <>
53
- <Animated.View style={[style, { opacity: bodyOpacity }]}>{children}</Animated.View>
54
- <LoadingOverlay
55
- fadeOptions={withOverlayLoadingFadeIn}
56
- loading={loading}
57
- style={overlayStyle}
58
- indicatorProps={indicatorProps}
59
- />
60
- </>
61
- )
62
- }
63
-
64
- const styles = StyleSheet.create({
65
- overlay: {
66
- position: 'absolute',
67
- justifyContent: 'center',
68
- alignItems: 'center',
69
- left: 0,
70
- right: 0,
71
- top: 0,
72
- bottom: 0,
73
- },
74
- })
@@ -1,110 +0,0 @@
1
- import React, { useCallback, useState } from 'react'
2
- import { Animated, StyleSheet, Switch, Text, View } from 'react-native'
3
- import { Loading } from './Loading'
4
-
5
- export const LoadingSwitch = ({
6
- value,
7
- label,
8
- onChange,
9
- }: {
10
- value: boolean
11
- label: string
12
- onChange: (updated: boolean) => Promise<void>
13
- }) => {
14
- const [isLoading, setIsLoading] = useState(false)
15
- const opacity = useState(new Animated.Value(1))[0]
16
-
17
- const reportComplete = useCallback(
18
- (fetchedOn: number) => {
19
- const buffer = Math.max(0, 1000 - (Date.now() - fetchedOn))
20
- setTimeout(() => {
21
- setIsLoading(false)
22
- Animated.timing(opacity, {
23
- toValue: 1,
24
- duration: 300,
25
- useNativeDriver: true,
26
- }).start()
27
- }, buffer)
28
- },
29
- [opacity],
30
- )
31
-
32
- const handleChange = (newValue: boolean) => {
33
- setIsLoading(true)
34
- Animated.timing(opacity, {
35
- toValue: 0,
36
- duration: 300,
37
- useNativeDriver: true,
38
- }).start()
39
-
40
- const fetchedOn = Date.now()
41
- onChange(newValue).catch(err => {
42
- console.error(err)
43
- // Note: You might want to implement a toast notification system for React Native
44
- // For now, we'll just log the error
45
- })
46
-
47
- reportComplete(fetchedOn)
48
- }
49
-
50
- return (
51
- <View style={styles.container}>
52
- <Animated.View
53
- style={[
54
- styles.content,
55
- {
56
- opacity,
57
- },
58
- ]}>
59
- <Text style={styles.label}>{label}</Text>
60
- <Switch value={value} onValueChange={handleChange} />
61
- </Animated.View>
62
- {isLoading && (
63
- <View style={styles.loadingContainer}>
64
- <Loading />
65
- </View>
66
- )}
67
- </View>
68
- )
69
- }
70
-
71
- const styles = StyleSheet.create({
72
- container: {
73
- paddingVertical: 4,
74
- paddingHorizontal: 12,
75
- backgroundColor: '#2D3748', // gray.700 equivalent
76
- borderRadius: 12,
77
- shadowColor: '#000',
78
- shadowOffset: {
79
- width: 0,
80
- height: 0,
81
- },
82
- shadowOpacity: 0.25,
83
- shadowRadius: 4,
84
- elevation: 5,
85
- position: 'relative',
86
- flexDirection: 'row',
87
- alignItems: 'center',
88
- },
89
- content: {
90
- flexDirection: 'row',
91
- alignItems: 'center',
92
- gap: 8,
93
- },
94
- label: {
95
- fontSize: 20,
96
- height: 24,
97
- color: '#FFFFFF',
98
- },
99
- loadingContainer: {
100
- position: 'absolute',
101
- top: '-10%',
102
- left: '-10%',
103
- width: '120%',
104
- height: '120%',
105
- borderRadius: 8,
106
- padding: 4,
107
- justifyContent: 'center',
108
- alignItems: 'center',
109
- },
110
- })
@@ -1,75 +0,0 @@
1
- import { useColorModeValue, useThemeValue } from '@chem-po/react'
2
- import React, { useEffect, useRef } from 'react'
3
- import { Animated, StyleSheet, Text, View } from 'react-native'
4
-
5
- export const ProgressBar = ({
6
- progress,
7
- label,
8
- height = 26,
9
- }: {
10
- progress: number
11
- label?: string
12
- height?: number
13
- }) => {
14
- const accentColor = useThemeValue('colors.accent.300')
15
- const animatedWidth = useRef(new Animated.Value(0)).current
16
- const backgroundColor = useColorModeValue('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.2)')
17
-
18
- useEffect(() => {
19
- Animated.timing(animatedWidth, {
20
- toValue: progress,
21
- duration: 300,
22
- useNativeDriver: false, // width animations require layout driver
23
- }).start()
24
- }, [progress, animatedWidth])
25
-
26
- return (
27
- <View style={[styles.progressContainer, { height, backgroundColor }]}>
28
- <View style={styles.progressBar}>
29
- <Animated.View
30
- style={[
31
- styles.progressFill,
32
- {
33
- width: animatedWidth.interpolate({
34
- inputRange: [0, 1],
35
- outputRange: ['0%', '100%'],
36
- extrapolate: 'clamp',
37
- }),
38
- backgroundColor: accentColor,
39
- },
40
- ]}
41
- />
42
- </View>
43
- <Text style={styles.label}>{label}</Text>
44
- </View>
45
- )
46
- }
47
-
48
- const styles = StyleSheet.create({
49
- progressContainer: {
50
- width: '100%',
51
- justifyContent: 'center',
52
- alignItems: 'center',
53
- borderRadius: 20,
54
- padding: 3,
55
- },
56
- progressBar: {
57
- height: '100%',
58
- width: '100%',
59
- borderRadius: 20,
60
- overflow: 'hidden',
61
- },
62
- progressFill: {
63
- height: '100%',
64
- },
65
- label: {
66
- position: 'absolute',
67
- color: 'white',
68
- fontSize: 12,
69
- fontWeight: '500',
70
- textTransform: 'uppercase',
71
- textShadowColor: 'rgba(0, 0, 0, 0.67)',
72
- textShadowOffset: { width: 1, height: 1 },
73
- textShadowRadius: 3,
74
- },
75
- })
@@ -1,6 +0,0 @@
1
- export * from './CircularProgress'
2
- export * from './Loading'
3
- export * from './LoadingImage'
4
- export * from './LoadingOverlay'
5
- export * from './LoadingSwitch'
6
- export * from './ProgressBar'
@@ -1,68 +0,0 @@
1
- import React, { PropsWithChildren, useEffect, useMemo, useRef } from 'react'
2
- import { Animated, StyleProp, TextStyle } from 'react-native'
3
- import { useFontScale } from '../../store/useFontScale'
4
-
5
- export interface AnimatedTextProps {
6
- show: boolean
7
- color: string
8
- height: number
9
- marginBottom: number
10
- style?: StyleProp<TextStyle>
11
- }
12
- const useAnimatedText = (show: boolean, color: string, height: number, marginBottom: number) => {
13
- const placeholderAnim = useRef(new Animated.Value(0)).current
14
- const fontScale = useFontScale(s => s.fontScale)
15
-
16
- useEffect(() => {
17
- Animated.timing(placeholderAnim, {
18
- toValue: show ? 1 : 0,
19
- duration: 200,
20
- useNativeDriver: false,
21
- }).start()
22
- }, [show, placeholderAnim])
23
-
24
- return useMemo(
25
- () => ({
26
- opacity: placeholderAnim,
27
- color,
28
- transform: [
29
- {
30
- scale: placeholderAnim.interpolate({
31
- inputRange: [0, 1],
32
- outputRange: [0.8, 1],
33
- }),
34
- },
35
- ],
36
- height: placeholderAnim.interpolate({
37
- inputRange: [0, 1],
38
- outputRange: [0, height * fontScale],
39
- }),
40
- marginBottom: placeholderAnim.interpolate({
41
- inputRange: [0, 1],
42
- outputRange: [0, marginBottom * fontScale],
43
- }),
44
- }),
45
- [color, height, marginBottom, placeholderAnim, fontScale],
46
- )
47
- }
48
-
49
- export const AnimatedText = ({
50
- show,
51
- color: colorProp,
52
- height: heightProp,
53
- marginBottom: marginBottomProp,
54
- style,
55
- children,
56
- }: PropsWithChildren<AnimatedTextProps>) => {
57
- const { opacity, color, transform, height, marginBottom } = useAnimatedText(
58
- show,
59
- colorProp,
60
- heightProp,
61
- marginBottomProp,
62
- )
63
- return (
64
- <Animated.Text style={[style, { opacity, color, transform, height, marginBottom }]}>
65
- {children}
66
- </Animated.Text>
67
- )
68
- }
@@ -1,12 +0,0 @@
1
- import { useTextColor } from '@chem-po/react'
2
- import React from 'react'
3
- import { Text, TextProps } from 'react-native'
4
-
5
- export const Txt = ({ children, ...props }: TextProps) => {
6
- const color = useTextColor()
7
- return (
8
- <Text {...props} style={[{ color }, props.style]}>
9
- {children}
10
- </Text>
11
- )
12
- }
@@ -1 +0,0 @@
1
- export * from './Txt'
@@ -1,47 +0,0 @@
1
- import { useBackgroundColor, useIconColor, useTheme } from '@chem-po/react'
2
- import { Ionicons } from '@expo/vector-icons'
3
- import React from 'react'
4
- import { StyleSheet, View } from 'react-native'
5
- import { Pressable } from 'react-native-gesture-handler'
6
-
7
- export const DarkModeToggle = () => {
8
- const { colorMode, toggleColorMode } = useTheme()
9
- const isDark = colorMode === 'dark'
10
-
11
- const iconColor = useIconColor()
12
- const iconName = isDark ? 'moon' : 'sunny'
13
- const bg = useBackgroundColor(100)
14
- return (
15
- <Pressable
16
- onPress={toggleColorMode}
17
- style={[
18
- styles.button,
19
- {
20
- backgroundColor: bg,
21
- },
22
- ]}>
23
- <Ionicons name={iconName} size={16} color={iconColor} />
24
- </Pressable>
25
- )
26
- }
27
-
28
- export const AbsoluteDarkModeToggle = () => (
29
- <View style={styles.container}>
30
- <DarkModeToggle />
31
- </View>
32
- )
33
-
34
- const styles = StyleSheet.create({
35
- container: {
36
- position: 'absolute',
37
- bottom: 12,
38
- right: 12,
39
- },
40
- button: {
41
- width: 32,
42
- height: 32,
43
- borderRadius: 16,
44
- justifyContent: 'center',
45
- alignItems: 'center',
46
- },
47
- })
@@ -1 +0,0 @@
1
- export * from './DarkModeToggle'
@@ -1 +0,0 @@
1
- export * from './colorMode'
@@ -1 +0,0 @@
1
- export * from './toast'
@@ -1,24 +0,0 @@
1
- import { ToastProviderProps } from '@chem-po/react'
2
- import { ComponentProps } from 'react'
3
- import { Notifier, NotifierComponents } from 'react-native-notifier'
4
-
5
- // react-native toast messages
6
- export const nativeToast: ToastProviderProps = {
7
- closeMessage: () => Notifier.hideNotification(),
8
- showMessage: ({ title, type, duration, message }) => {
9
- const Component = type === 'info' ? NotifierComponents.Notification : NotifierComponents.Alert
10
- const componentProps = {
11
- alertType: type === 'error' ? 'error' : 'success',
12
- } as
13
- | ComponentProps<typeof NotifierComponents.Notification>
14
- | ComponentProps<typeof NotifierComponents.Alert>
15
- Notifier.showNotification({
16
- title,
17
- description: message,
18
- duration,
19
- Component,
20
- componentProps,
21
- })
22
- return 'root'
23
- },
24
- }
@@ -1,23 +0,0 @@
1
- import React, { createContext, PropsWithChildren, useContext } from 'react'
2
- import { MD3Typescale } from 'react-native-paper/lib/typescript/types'
3
-
4
- export interface ChempoFontsProviderProps {
5
- fonts: MD3Typescale
6
- }
7
-
8
- export const ChempoFontsContext = createContext<ChempoFontsProviderProps | null>(null)
9
-
10
- export const ChempoFontsProvider = ({
11
- children,
12
- fonts,
13
- }: PropsWithChildren<ChempoFontsProviderProps>) => {
14
- return <ChempoFontsContext.Provider value={{ fonts }}>{children}</ChempoFontsContext.Provider>
15
- }
16
-
17
- export const useChempoFonts = () => {
18
- const context = useContext(ChempoFontsContext)
19
- if (!context) {
20
- throw new Error('useChempoFonts must be used within a ChempoFontsProvider')
21
- }
22
- return context
23
- }
@@ -1 +0,0 @@
1
- export * from './root'