@oxyhq/bloom 0.6.3 → 0.6.5
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.
- package/lib/commonjs/avatar/Avatar.js +1 -1
- package/lib/commonjs/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/bottom-sheet/index.js +1 -1
- package/lib/commonjs/bottom-sheet/index.js.map +1 -1
- package/lib/commonjs/button/Button.js +1 -1
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/hooks/useDelayedLoading.js +5 -3
- package/lib/commonjs/hooks/useDelayedLoading.js.map +1 -1
- package/lib/commonjs/loading/Loading.js +26 -85
- package/lib/commonjs/loading/Loading.js.map +1 -1
- package/lib/commonjs/loading/SpinnerIcon.js +20 -27
- package/lib/commonjs/loading/SpinnerIcon.js.map +1 -1
- package/lib/commonjs/portal/index.web.js +1 -1
- package/lib/commonjs/prompt-input/PromptInput.js +1 -1
- package/lib/commonjs/prompt-input/PromptInput.js.map +1 -1
- package/lib/module/avatar/Avatar.js +1 -1
- package/lib/module/avatar/Avatar.js.map +1 -1
- package/lib/module/bottom-sheet/index.js +1 -1
- package/lib/module/bottom-sheet/index.js.map +1 -1
- package/lib/module/button/Button.js +1 -1
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/hooks/useDelayedLoading.js +5 -3
- package/lib/module/hooks/useDelayedLoading.js.map +1 -1
- package/lib/module/loading/Loading.js +15 -74
- package/lib/module/loading/Loading.js.map +1 -1
- package/lib/module/loading/SpinnerIcon.js +15 -22
- package/lib/module/loading/SpinnerIcon.js.map +1 -1
- package/lib/module/portal/index.web.js +1 -1
- package/lib/module/prompt-input/PromptInput.js +1 -1
- package/lib/module/prompt-input/PromptInput.js.map +1 -1
- package/lib/typescript/commonjs/hooks/useDelayedLoading.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/Loading.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/SpinnerIcon.d.ts +2 -2
- package/lib/typescript/commonjs/loading/SpinnerIcon.d.ts.map +1 -1
- package/lib/typescript/module/hooks/useDelayedLoading.d.ts.map +1 -1
- package/lib/typescript/module/loading/Loading.d.ts.map +1 -1
- package/lib/typescript/module/loading/SpinnerIcon.d.ts +2 -2
- package/lib/typescript/module/loading/SpinnerIcon.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/avatar/Avatar.tsx +1 -1
- package/src/bottom-sheet/index.tsx +1 -1
- package/src/button/Button.tsx +1 -1
- package/src/hooks/useDelayedLoading.ts +6 -3
- package/src/loading/Loading.tsx +19 -74
- package/src/loading/SpinnerIcon.tsx +19 -22
- package/src/portal/index.web.tsx +1 -1
- package/src/prompt-input/PromptInput.tsx +1 -1
|
@@ -2,45 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { ActivityIndicator } from 'react-native';
|
|
5
|
+
import Animated, { Easing, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
|
5
6
|
import { lazyRequire } from "../utils/lazy-require.js";
|
|
6
7
|
|
|
7
|
-
//
|
|
8
|
-
//
|
|
8
|
+
// react-native-svg is loaded lazily so the loading module can fall back to
|
|
9
|
+
// ActivityIndicator when the host app doesn't ship SVG support. Reanimated,
|
|
10
|
+
// by contrast, MUST be statically imported: the worklets Babel plugin
|
|
11
|
+
// performs build-time closure analysis (`__closure` metadata) that fails on
|
|
12
|
+
// runtime requires, which would crash the UI thread with
|
|
13
|
+
// "Tried to synchronously call a non-worklet function `addListener`".
|
|
9
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
15
|
const getSvgModule = lazyRequire('react-native-svg');
|
|
11
|
-
const getReanimated = lazyRequire('react-native-reanimated');
|
|
12
16
|
/**
|
|
13
17
|
* Inner component that unconditionally calls Reanimated hooks.
|
|
14
|
-
* Only rendered when
|
|
18
|
+
* Only rendered when react-native-svg is available.
|
|
15
19
|
*/
|
|
16
20
|
const AnimatedSpinner = ({
|
|
17
21
|
color = 'currentColor',
|
|
18
22
|
size = 26,
|
|
19
23
|
className,
|
|
20
24
|
style,
|
|
21
|
-
svg
|
|
22
|
-
reanimated
|
|
25
|
+
svg
|
|
23
26
|
}) => {
|
|
24
27
|
const {
|
|
25
28
|
default: Svg,
|
|
26
29
|
Rect
|
|
27
30
|
} = svg;
|
|
28
|
-
const {
|
|
29
|
-
default: Animated,
|
|
30
|
-
useAnimatedStyle,
|
|
31
|
-
useSharedValue,
|
|
32
|
-
withRepeat,
|
|
33
|
-
withTiming,
|
|
34
|
-
Easing
|
|
35
|
-
} = reanimated;
|
|
36
31
|
const rotation = useSharedValue(0);
|
|
37
32
|
useEffect(() => {
|
|
38
33
|
rotation.value = withRepeat(withTiming(360, {
|
|
39
34
|
duration: 400,
|
|
40
35
|
easing: Easing.linear
|
|
41
36
|
}), -1, false);
|
|
42
|
-
//
|
|
43
|
-
// are module-level
|
|
37
|
+
// rotation is a stable shared value reference; withRepeat/withTiming/Easing
|
|
38
|
+
// are module-level constants from a static import and are stable too.
|
|
44
39
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
40
|
}, []);
|
|
46
41
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
@@ -149,8 +144,8 @@ const AnimatedSpinner = ({
|
|
|
149
144
|
|
|
150
145
|
/**
|
|
151
146
|
* iOS-style SVG spinner with 8 rotating rectangles and an opacity gradient trail.
|
|
152
|
-
* Requires react-native-svg and react-native-reanimated
|
|
153
|
-
* Falls back to ActivityIndicator if
|
|
147
|
+
* Requires react-native-svg (lazy) and react-native-reanimated (static).
|
|
148
|
+
* Falls back to ActivityIndicator if react-native-svg is missing.
|
|
154
149
|
*/
|
|
155
150
|
export const SpinnerIcon = ({
|
|
156
151
|
color = 'currentColor',
|
|
@@ -159,8 +154,7 @@ export const SpinnerIcon = ({
|
|
|
159
154
|
style
|
|
160
155
|
}) => {
|
|
161
156
|
const svg = getSvgModule();
|
|
162
|
-
|
|
163
|
-
if (!svg || !reanimated) {
|
|
157
|
+
if (!svg) {
|
|
164
158
|
return /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
165
159
|
size: size > 30 ? 'large' : 'small',
|
|
166
160
|
color: color
|
|
@@ -171,8 +165,7 @@ export const SpinnerIcon = ({
|
|
|
171
165
|
size: size,
|
|
172
166
|
className: className,
|
|
173
167
|
style: style,
|
|
174
|
-
svg: svg
|
|
175
|
-
reanimated: reanimated
|
|
168
|
+
svg: svg
|
|
176
169
|
});
|
|
177
170
|
};
|
|
178
171
|
SpinnerIcon.displayName = 'SpinnerIcon';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","ActivityIndicator","
|
|
1
|
+
{"version":3,"names":["React","useEffect","ActivityIndicator","Animated","Easing","useAnimatedStyle","useSharedValue","withRepeat","withTiming","lazyRequire","jsx","_jsx","jsxs","_jsxs","getSvgModule","AnimatedSpinner","color","size","className","style","svg","default","Svg","Rect","rotation","value","duration","easing","linear","animatedStyle","transform","rotate","View","width","height","alignItems","justifyContent","children","viewBox","fill","opacity","rx","ry","x","y","SpinnerIcon","displayName"],"sourceRoot":"../../../src","sources":["loading/SpinnerIcon.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,iBAAiB,QAAwB,cAAc;AAChE,OAAOC,QAAQ,IACbC,MAAM,EACNC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAEhC,SAASC,WAAW,QAAQ,0BAAuB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGA,MAAMC,YAAY,GAAGL,WAAW,CAAgB,kBAAkB,CAAC;AAcnE;AACA;AACA;AACA;AACA,MAAMM,eAA+C,GAAGA,CAAC;EACvDC,KAAK,GAAG,cAAc;EACtBC,IAAI,GAAG,EAAE;EACTC,SAAS;EACTC,KAAK;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AG,aAAa","ignoreList":[]}
|
|
@@ -24,7 +24,7 @@ import { createPortal } from 'react-dom';
|
|
|
24
24
|
* The container is positioned `fixed` and stretched edge-to-edge so it
|
|
25
25
|
* fills the viewport. This makes it a valid containing block for any
|
|
26
26
|
* portaled descendant that uses `position: absolute` (e.g. RN's
|
|
27
|
-
* `StyleSheet.
|
|
27
|
+
* `StyleSheet.absoluteFill`) — without it those children anchor to a
|
|
28
28
|
* zero-area block at the end of `<body>` and render off-screen.
|
|
29
29
|
*
|
|
30
30
|
* `pointer-events: none` lets clicks fall through to the underlying app
|
|
@@ -186,7 +186,7 @@ export function PromptInput({
|
|
|
186
186
|
children: inputBox
|
|
187
187
|
}), showFullscreen && /*#__PURE__*/_jsx(Portal, {
|
|
188
188
|
children: /*#__PURE__*/_jsxs(View, {
|
|
189
|
-
style: [StyleSheet.
|
|
189
|
+
style: [StyleSheet.absoluteFill, {
|
|
190
190
|
zIndex: 9998,
|
|
191
191
|
backgroundColor: theme.colors.background,
|
|
192
192
|
// Opt back in from the Portal root's `pointer-events: none`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","View","Pressable","Text","KeyboardAvoidingView","Platform","StyleSheet","useTheme","Portal","PromptInputContext","PromptInputTextarea","PromptInputActions","PromptInputAttachments","PromptInputSubmitButton","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PromptInput","isLoading","maxHeight","value","onValueChange","onSubmit","children","style","disabled","onImagePaste","placeholder","actionsLeft","onStop","emptyAction","attachments","controlledAttachments","onAddAttachment","onRemoveAttachment","onUpdateAttachment","disableKeyboardAvoidance","expandIcon","collapseIcon","testID","internalValue","setInternalValue","currentHeight","setCurrentHeight","showFullscreen","setShowFullscreen","handleCompletionKey","setHandleCompletionKey","textareaRef","theme","internalAttachments","setInternalAttachments","addAttachment","a","prev","removeAttachment","id","filter","updateAttachment","updates","map","handleChange","newValue","handleSubmit","showExpandIcon","isSimpleMode","currentValue","currentSetValue","contextValue","setValue","isFullscreen","content","flexDirection","alignItems","justifyContent","gap","marginTop","marginBottom","paddingHorizontal","inputBox","onPress","current","focus","borderRadius","borderWidth","borderColor","colors","border","backgroundColor","background","overflow","position","opacity","top","right","zIndex","padding","fontSize","color","textSecondary","Wrapper","wrapperProps","behavior","OS","undefined","Provider","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","View","Pressable","Text","KeyboardAvoidingView","Platform","StyleSheet","useTheme","Portal","PromptInputContext","PromptInputTextarea","PromptInputActions","PromptInputAttachments","PromptInputSubmitButton","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PromptInput","isLoading","maxHeight","value","onValueChange","onSubmit","children","style","disabled","onImagePaste","placeholder","actionsLeft","onStop","emptyAction","attachments","controlledAttachments","onAddAttachment","onRemoveAttachment","onUpdateAttachment","disableKeyboardAvoidance","expandIcon","collapseIcon","testID","internalValue","setInternalValue","currentHeight","setCurrentHeight","showFullscreen","setShowFullscreen","handleCompletionKey","setHandleCompletionKey","textareaRef","theme","internalAttachments","setInternalAttachments","addAttachment","a","prev","removeAttachment","id","filter","updateAttachment","updates","map","handleChange","newValue","handleSubmit","showExpandIcon","isSimpleMode","currentValue","currentSetValue","contextValue","setValue","isFullscreen","content","flexDirection","alignItems","justifyContent","gap","marginTop","marginBottom","paddingHorizontal","inputBox","onPress","current","focus","borderRadius","borderWidth","borderColor","colors","border","backgroundColor","background","overflow","position","opacity","top","right","zIndex","padding","fontSize","color","textSecondary","Wrapper","wrapperProps","behavior","OS","undefined","Provider","absoluteFill","pointerEvents","text","flex","displayName"],"sourceRoot":"../../../src","sources":["prompt-input/PromptInput.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChF,SACEC,IAAI,EACJC,SAAS,EACTC,IAAI,EACJC,oBAAoB,EACpBC,QAAQ,EACRC,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P,MAAM;MAAAkB,QAAA,eACLT,KAAA,CAAChB,IAAI;QACH0B,KAAK,EAAE,CACLrB,UAAU,CAACuG,YAAY,EACvB;UACEX,MAAM,EAAE,IAAI;UACZP,eAAe,EAAEvC,KAAK,CAACqC,MAAM,CAACG,UAAU;UACxC;UACA;UACAkB,aAAa,EAAE;QACjB,CAAC,CACD;QAAApF,QAAA,gBAEFX,IAAA,CAACb,SAAS;UACRiF,OAAO,EAAEA,CAAA,KAAMnC,iBAAiB,CAAC,KAAK,CAAE;UACxCrB,KAAK,EAAE;YACLmE,QAAQ,EAAE,UAAU;YACpBE,GAAG,EAAE,EAAE;YACPC,KAAK,EAAE,EAAE;YACTC,MAAM,EAAE,EAAE;YACVC,OAAO,EAAE,CAAC;YACVR,eAAe,EAAEvC,KAAK,CAACqC,MAAM,CAACG,UAAU;YACxCN,YAAY,EAAE;UAChB,CAAE;UAAA5D,QAAA,EAEDe,YAAY,iBACX1B,IAAA,CAACZ,IAAI;YAACwB,KAAK,EAAE;cAAEyE,QAAQ,EAAE,EAAE;cAAEC,KAAK,EAAEjD,KAAK,CAACqC,MAAM,CAACsB;YAAK,CAAE;YAAArF,QAAA,EAAC;UAAC,CAAM;QACjE,CACQ,CAAC,eACZX,IAAA,CAACd,IAAI;UAAC0B,KAAK,EAAE;YAAEqF,IAAI,EAAE;UAAE,CAAE;UAAAtF,QAAA,EAAEgD;QAAO,CAAO,CAAC;MAAA,CACtC;IAAC,CACD,CACT;EAAA,CAC0B,CAAC;AAElC;AACAtD,WAAW,CAAC6F,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDelayedLoading.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDelayedLoading.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,
|
|
1
|
+
{"version":3,"file":"useDelayedLoading.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDelayedLoading.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,WAc5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../../../src/loading/Loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../../../src/loading/Loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAYxD,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,SAAS,CAAC;AA+KjB,eAAO,MAAM,OAAO,0CAAyB,CAAC"}
|
|
@@ -8,8 +8,8 @@ interface SpinnerIconProps {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* iOS-style SVG spinner with 8 rotating rectangles and an opacity gradient trail.
|
|
11
|
-
* Requires react-native-svg and react-native-reanimated
|
|
12
|
-
* Falls back to ActivityIndicator if
|
|
11
|
+
* Requires react-native-svg (lazy) and react-native-reanimated (static).
|
|
12
|
+
* Falls back to ActivityIndicator if react-native-svg is missing.
|
|
13
13
|
*/
|
|
14
14
|
export declare const SpinnerIcon: React.FC<SpinnerIconProps>;
|
|
15
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerIcon.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SpinnerIcon.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAqBjE,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAqED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAqBlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDelayedLoading.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDelayedLoading.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,
|
|
1
|
+
{"version":3,"file":"useDelayedLoading.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDelayedLoading.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,WAc5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../../../src/loading/Loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../../../src/loading/Loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAYxD,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,SAAS,CAAC;AA+KjB,eAAO,MAAM,OAAO,0CAAyB,CAAC"}
|
|
@@ -8,8 +8,8 @@ interface SpinnerIconProps {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* iOS-style SVG spinner with 8 rotating rectangles and an opacity gradient trail.
|
|
11
|
-
* Requires react-native-svg and react-native-reanimated
|
|
12
|
-
* Falls back to ActivityIndicator if
|
|
11
|
+
* Requires react-native-svg (lazy) and react-native-reanimated (static).
|
|
12
|
+
* Falls back to ActivityIndicator if react-native-svg is missing.
|
|
13
13
|
*/
|
|
14
14
|
export declare const SpinnerIcon: React.FC<SpinnerIconProps>;
|
|
15
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerIcon.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SpinnerIcon.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAqBjE,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAqED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAqBlD,CAAC"}
|
package/package.json
CHANGED
package/src/avatar/Avatar.tsx
CHANGED
|
@@ -254,7 +254,7 @@ const AvatarComponent: React.FC<AvatarProps> = ({
|
|
|
254
254
|
source={imageSource}
|
|
255
255
|
onError={() => setErrored(true)}
|
|
256
256
|
resizeMode="cover"
|
|
257
|
-
style={[StyleSheet.
|
|
257
|
+
style={[StyleSheet.absoluteFill, { borderRadius: radius }, imageStyle]}
|
|
258
258
|
/>
|
|
259
259
|
) : (
|
|
260
260
|
<CircleFallback
|
package/src/button/Button.tsx
CHANGED
|
@@ -8,10 +8,13 @@ export function useDelayedLoading(delay: number, initialState: boolean = true) {
|
|
|
8
8
|
const [isLoading, setIsLoading] = useState(initialState);
|
|
9
9
|
|
|
10
10
|
useEffect(() => {
|
|
11
|
-
|
|
12
|
-
if (isLoading) timeout = setTimeout(() => setIsLoading(false), delay);
|
|
11
|
+
if (!isLoading) return;
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
const timeout = setTimeout(() => setIsLoading(false), delay);
|
|
14
|
+
|
|
15
|
+
return () => {
|
|
16
|
+
clearTimeout(timeout);
|
|
17
|
+
};
|
|
15
18
|
}, [isLoading, delay]);
|
|
16
19
|
|
|
17
20
|
return isLoading;
|
package/src/loading/Loading.tsx
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React, { memo, useEffect, useMemo } from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, type DimensionValue } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
Easing,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withTiming,
|
|
8
|
+
} from 'react-native-reanimated';
|
|
3
9
|
|
|
4
10
|
import { useTheme } from '../theme/use-theme';
|
|
5
11
|
import { animation } from '../styles/tokens';
|
|
6
|
-
import { lazyRequire } from '../utils/lazy-require';
|
|
7
12
|
import { SpinnerIcon } from './SpinnerIcon';
|
|
8
13
|
import type {
|
|
9
14
|
LoadingProps,
|
|
@@ -19,10 +24,6 @@ const SIZE_CONFIG = {
|
|
|
19
24
|
large: { spinner: 44, text: 16 },
|
|
20
25
|
} as const;
|
|
21
26
|
|
|
22
|
-
// Lazy-loaded reanimated for the top variant
|
|
23
|
-
type ReanimatedType = typeof import('react-native-reanimated');
|
|
24
|
-
const getReanimated = lazyRequire<ReanimatedType>('react-native-reanimated');
|
|
25
|
-
|
|
26
27
|
const SpinnerLoading: React.FC<SpinnerLoadingProps> = ({
|
|
27
28
|
size = 'medium',
|
|
28
29
|
color,
|
|
@@ -59,33 +60,21 @@ const SpinnerLoading: React.FC<SpinnerLoadingProps> = ({
|
|
|
59
60
|
);
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* satisfying the Rules of Hooks and React Compiler requirements.
|
|
66
|
-
*/
|
|
67
|
-
type AnimatedTopLoadingProps = {
|
|
68
|
-
showLoading: boolean;
|
|
69
|
-
targetHeight: number;
|
|
70
|
-
effectiveIconSize: number;
|
|
71
|
-
spinnerColor: string;
|
|
72
|
-
spinnerIcon: React.ReactNode | undefined;
|
|
73
|
-
style: TopLoadingProps['style'];
|
|
74
|
-
testID: string | undefined;
|
|
75
|
-
reanimated: NonNullable<ReturnType<typeof getReanimated>>;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const AnimatedTopLoading: React.FC<AnimatedTopLoadingProps> = ({
|
|
79
|
-
showLoading,
|
|
80
|
-
targetHeight,
|
|
81
|
-
effectiveIconSize,
|
|
82
|
-
spinnerColor,
|
|
83
|
-
spinnerIcon,
|
|
63
|
+
const TopLoading: React.FC<TopLoadingProps> = ({
|
|
64
|
+
size = 'medium',
|
|
65
|
+
color,
|
|
84
66
|
style,
|
|
67
|
+
showLoading = true,
|
|
68
|
+
iconSize,
|
|
69
|
+
heightOffset = 0,
|
|
70
|
+
spinnerIcon,
|
|
85
71
|
testID,
|
|
86
|
-
reanimated,
|
|
87
72
|
}) => {
|
|
88
|
-
const
|
|
73
|
+
const theme = useTheme();
|
|
74
|
+
const sizeConfig = SIZE_CONFIG[size];
|
|
75
|
+
const effectiveIconSize = iconSize ?? sizeConfig.spinner;
|
|
76
|
+
const targetHeight = Math.max(0, effectiveIconSize + sizeConfig.spinner + heightOffset);
|
|
77
|
+
const spinnerColor = color ?? theme.colors.primary;
|
|
89
78
|
|
|
90
79
|
const height = useSharedValue(showLoading ? targetHeight : 0);
|
|
91
80
|
const opacity = useSharedValue(showLoading ? 1 : 0);
|
|
@@ -96,7 +85,7 @@ const AnimatedTopLoading: React.FC<AnimatedTopLoadingProps> = ({
|
|
|
96
85
|
height.value = withTiming(showLoading ? targetHeight : 0, timingConfig);
|
|
97
86
|
opacity.value = withTiming(showLoading ? 1 : 0, timingConfig);
|
|
98
87
|
translateY.value = withTiming(showLoading ? 0 : -targetHeight, timingConfig);
|
|
99
|
-
// Easing, withTiming: module-level constants from
|
|
88
|
+
// Easing, withTiming: module-level constants from a static import, stable.
|
|
100
89
|
// height/opacity/translateY: shared value objects, stable references.
|
|
101
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
102
91
|
}, [showLoading, targetHeight]);
|
|
@@ -119,50 +108,6 @@ const AnimatedTopLoading: React.FC<AnimatedTopLoadingProps> = ({
|
|
|
119
108
|
);
|
|
120
109
|
};
|
|
121
110
|
|
|
122
|
-
const TopLoading: React.FC<TopLoadingProps> = ({
|
|
123
|
-
size = 'medium',
|
|
124
|
-
color,
|
|
125
|
-
style,
|
|
126
|
-
showLoading = true,
|
|
127
|
-
iconSize,
|
|
128
|
-
heightOffset = 0,
|
|
129
|
-
spinnerIcon,
|
|
130
|
-
testID,
|
|
131
|
-
}) => {
|
|
132
|
-
const theme = useTheme();
|
|
133
|
-
const sizeConfig = SIZE_CONFIG[size];
|
|
134
|
-
const effectiveIconSize = iconSize ?? sizeConfig.spinner;
|
|
135
|
-
const targetHeight = Math.max(0, effectiveIconSize + sizeConfig.spinner + heightOffset);
|
|
136
|
-
const spinnerColor = color ?? theme.colors.primary;
|
|
137
|
-
|
|
138
|
-
const reanimated = getReanimated();
|
|
139
|
-
|
|
140
|
-
if (!reanimated) {
|
|
141
|
-
// Non-animated fallback when reanimated is not available
|
|
142
|
-
if (!showLoading) return null;
|
|
143
|
-
return (
|
|
144
|
-
<View style={[styles.topContainer, { height: targetHeight }, style]} testID={testID}>
|
|
145
|
-
<View style={[styles.topLoadingView, { height: targetHeight }]}>
|
|
146
|
-
{spinnerIcon ?? <SpinnerIcon size={effectiveIconSize} color={spinnerColor} />}
|
|
147
|
-
</View>
|
|
148
|
-
</View>
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<AnimatedTopLoading
|
|
154
|
-
showLoading={showLoading}
|
|
155
|
-
targetHeight={targetHeight}
|
|
156
|
-
effectiveIconSize={effectiveIconSize}
|
|
157
|
-
spinnerColor={spinnerColor}
|
|
158
|
-
spinnerIcon={spinnerIcon}
|
|
159
|
-
style={style}
|
|
160
|
-
testID={testID}
|
|
161
|
-
reanimated={reanimated}
|
|
162
|
-
/>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
111
|
const SkeletonLoading: React.FC<SkeletonLoadingProps> = ({
|
|
167
112
|
lines = 3,
|
|
168
113
|
width = '100%',
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { ActivityIndicator, type ViewStyle } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
Easing,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withRepeat,
|
|
8
|
+
withTiming,
|
|
9
|
+
} from 'react-native-reanimated';
|
|
3
10
|
|
|
4
11
|
import { lazyRequire } from '../utils/lazy-require';
|
|
5
12
|
|
|
6
|
-
//
|
|
7
|
-
//
|
|
13
|
+
// react-native-svg is loaded lazily so the loading module can fall back to
|
|
14
|
+
// ActivityIndicator when the host app doesn't ship SVG support. Reanimated,
|
|
15
|
+
// by contrast, MUST be statically imported: the worklets Babel plugin
|
|
16
|
+
// performs build-time closure analysis (`__closure` metadata) that fails on
|
|
17
|
+
// runtime requires, which would crash the UI thread with
|
|
18
|
+
// "Tried to synchronously call a non-worklet function `addListener`".
|
|
8
19
|
type SvgModuleType = typeof import('react-native-svg');
|
|
9
|
-
type ReanimatedType = typeof import('react-native-reanimated');
|
|
10
20
|
|
|
11
21
|
const getSvgModule = lazyRequire<SvgModuleType>('react-native-svg');
|
|
12
|
-
const getReanimated = lazyRequire<ReanimatedType>('react-native-reanimated');
|
|
13
22
|
|
|
14
23
|
interface SpinnerIconProps {
|
|
15
24
|
size?: number;
|
|
@@ -21,12 +30,11 @@ interface SpinnerIconProps {
|
|
|
21
30
|
type AnimatedSpinnerProps = Omit<SpinnerIconProps, 'className'> & {
|
|
22
31
|
className?: string;
|
|
23
32
|
svg: NonNullable<SvgModuleType>;
|
|
24
|
-
reanimated: NonNullable<ReanimatedType>;
|
|
25
33
|
};
|
|
26
34
|
|
|
27
35
|
/**
|
|
28
36
|
* Inner component that unconditionally calls Reanimated hooks.
|
|
29
|
-
* Only rendered when
|
|
37
|
+
* Only rendered when react-native-svg is available.
|
|
30
38
|
*/
|
|
31
39
|
const AnimatedSpinner: React.FC<AnimatedSpinnerProps> = ({
|
|
32
40
|
color = 'currentColor',
|
|
@@ -34,17 +42,8 @@ const AnimatedSpinner: React.FC<AnimatedSpinnerProps> = ({
|
|
|
34
42
|
className,
|
|
35
43
|
style,
|
|
36
44
|
svg,
|
|
37
|
-
reanimated,
|
|
38
45
|
}) => {
|
|
39
46
|
const { default: Svg, Rect } = svg;
|
|
40
|
-
const {
|
|
41
|
-
default: Animated,
|
|
42
|
-
useAnimatedStyle,
|
|
43
|
-
useSharedValue,
|
|
44
|
-
withRepeat,
|
|
45
|
-
withTiming,
|
|
46
|
-
Easing,
|
|
47
|
-
} = reanimated;
|
|
48
47
|
|
|
49
48
|
const rotation = useSharedValue(0);
|
|
50
49
|
|
|
@@ -54,8 +53,8 @@ const AnimatedSpinner: React.FC<AnimatedSpinnerProps> = ({
|
|
|
54
53
|
-1,
|
|
55
54
|
false,
|
|
56
55
|
);
|
|
57
|
-
//
|
|
58
|
-
// are module-level
|
|
56
|
+
// rotation is a stable shared value reference; withRepeat/withTiming/Easing
|
|
57
|
+
// are module-level constants from a static import and are stable too.
|
|
59
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
59
|
}, []);
|
|
61
60
|
|
|
@@ -97,8 +96,8 @@ const AnimatedSpinner: React.FC<AnimatedSpinnerProps> = ({
|
|
|
97
96
|
|
|
98
97
|
/**
|
|
99
98
|
* iOS-style SVG spinner with 8 rotating rectangles and an opacity gradient trail.
|
|
100
|
-
* Requires react-native-svg and react-native-reanimated
|
|
101
|
-
* Falls back to ActivityIndicator if
|
|
99
|
+
* Requires react-native-svg (lazy) and react-native-reanimated (static).
|
|
100
|
+
* Falls back to ActivityIndicator if react-native-svg is missing.
|
|
102
101
|
*/
|
|
103
102
|
export const SpinnerIcon: React.FC<SpinnerIconProps> = ({
|
|
104
103
|
color = 'currentColor',
|
|
@@ -107,9 +106,8 @@ export const SpinnerIcon: React.FC<SpinnerIconProps> = ({
|
|
|
107
106
|
style,
|
|
108
107
|
}) => {
|
|
109
108
|
const svg = getSvgModule();
|
|
110
|
-
const reanimated = getReanimated();
|
|
111
109
|
|
|
112
|
-
if (!svg
|
|
110
|
+
if (!svg) {
|
|
113
111
|
return <ActivityIndicator size={size > 30 ? 'large' : 'small'} color={color} />;
|
|
114
112
|
}
|
|
115
113
|
|
|
@@ -120,7 +118,6 @@ export const SpinnerIcon: React.FC<SpinnerIconProps> = ({
|
|
|
120
118
|
className={className}
|
|
121
119
|
style={style}
|
|
122
120
|
svg={svg}
|
|
123
|
-
reanimated={reanimated}
|
|
124
121
|
/>
|
|
125
122
|
);
|
|
126
123
|
};
|
package/src/portal/index.web.tsx
CHANGED
|
@@ -22,7 +22,7 @@ import { createPortal } from 'react-dom';
|
|
|
22
22
|
* The container is positioned `fixed` and stretched edge-to-edge so it
|
|
23
23
|
* fills the viewport. This makes it a valid containing block for any
|
|
24
24
|
* portaled descendant that uses `position: absolute` (e.g. RN's
|
|
25
|
-
* `StyleSheet.
|
|
25
|
+
* `StyleSheet.absoluteFill`) — without it those children anchor to a
|
|
26
26
|
* zero-area block at the end of `<body>` and render off-screen.
|
|
27
27
|
*
|
|
28
28
|
* `pointer-events: none` lets clicks fall through to the underlying app
|