@ornikar/kitt-universal 25.55.0 → 25.56.1-canary.8bcf3acdd0e34c8b5a41d53835db7f3e890ee212.0
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/CHANGELOG.md +18 -0
- package/dist/definitions/Actions/ActionsItem.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +6 -1
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +6 -1
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-20.10.cjs.js +6 -1
- package/dist/index-node-20.10.cjs.js.map +1 -1
- package/dist/index-node-20.10.cjs.web.js +6 -1
- package/dist/index-node-20.10.cjs.web.js.map +1 -1
- package/dist/index-node-20.10.es.mjs +6 -1
- package/dist/index-node-20.10.es.mjs.map +1 -1
- package/dist/index-node-20.10.es.web.mjs +6 -1
- package/dist/index-node-20.10.es.web.mjs.map +1 -1
- package/dist/index.es.js +15 -10
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +15 -10
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -3604,6 +3604,8 @@ const ActionsItem = /*#__PURE__*/forwardRef(({
|
|
|
3604
3604
|
}, ref) => {
|
|
3605
3605
|
const [isLoading, setIsLoading] = useState(false);
|
|
3606
3606
|
const mountedRef = useRef(false);
|
|
3607
|
+
// securing the loading state with a ref to avoid user action between rerenders
|
|
3608
|
+
const loadingRef = useRef(false);
|
|
3607
3609
|
|
|
3608
3610
|
// effect just for tracking mounted state, as onPress can unmount the ActionButton
|
|
3609
3611
|
useEffect(() => {
|
|
@@ -3621,15 +3623,18 @@ const ActionsItem = /*#__PURE__*/forwardRef(({
|
|
|
3621
3623
|
icon: isLoading ? /*#__PURE__*/jsx(LoaderIcon, {}) : icon,
|
|
3622
3624
|
onPress: e => {
|
|
3623
3625
|
(async () => {
|
|
3624
|
-
if (!onPress) return;
|
|
3626
|
+
if (!onPress || loadingRef.current) return;
|
|
3625
3627
|
setIsLoading(true);
|
|
3628
|
+
loadingRef.current = true;
|
|
3626
3629
|
try {
|
|
3627
3630
|
await onPress(e);
|
|
3628
3631
|
if (mountedRef.current) {
|
|
3629
3632
|
setIsLoading(false);
|
|
3633
|
+
loadingRef.current = false;
|
|
3630
3634
|
}
|
|
3631
3635
|
} catch (error) {
|
|
3632
3636
|
if (mountedRef.current) {
|
|
3637
|
+
loadingRef.current = false;
|
|
3633
3638
|
setIsLoading(false);
|
|
3634
3639
|
}
|
|
3635
3640
|
throw error;
|