@admin-layout/gluestack-ui-mobile 6.5.1-alpha.0 → 6.5.1-alpha.1
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 +4 -0
- package/lib/components/with-interactions-managed.d.ts +1 -1
- package/lib/components/with-interactions-managed.js +69 -8
- package/lib/components/with-interactions-managed.js.map +1 -1
- package/lib/hooks/use-after-interactions.d.ts +3 -2
- package/lib/hooks/use-after-interactions.js +34 -12
- package/lib/hooks/use-after-interactions.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -5
- package/lib/index.js.map +1 -1
- package/package.json +3 -6
- package/src/components/with-interactions-managed.tsx +84 -16
- package/src/hooks/use-after-interactions.ts +35 -12
- package/src/index.ts +4 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.5.1-alpha.1](https://github.com/CDEBase/admin-layout/compare/v6.5.1-alpha.0...v6.5.1-alpha.1) (2024-05-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @admin-layout/gluestack-ui-mobile
|
|
9
|
+
|
|
6
10
|
## [6.5.1-alpha.0](https://github.com/cdmbase/admin-layout/compare/v3.0.0-alpha.50...v6.5.1-alpha.0) (2024-04-27)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @admin-layout/gluestack-ui-mobile
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
|
-
export declare function withInteractionsManaged<Props>(Component: ComponentType<Props>, Placeholder?: ComponentType | null): (props: Props) => React.JSX.Element;
|
|
2
|
+
export declare function withInteractionsManaged<Props>(Component: ComponentType<Props>, Placeholder?: ComponentType | null, interationTime?: number): (props: Props) => React.JSX.Element;
|
|
@@ -1,18 +1,79 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Transition, Transitioning } from 'react-native-reanimated';
|
|
2
|
+
// import { Transition, Transitioning } from 'react-native-reanimated';
|
|
3
|
+
import Animated from 'react-native-reanimated';
|
|
3
4
|
import { useAfterInteractions } from '../hooks/use-after-interactions';
|
|
4
|
-
import {
|
|
5
|
+
import { Spinner, Center } from '@gluestack-ui/themed';
|
|
5
6
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
6
|
-
export function withInteractionsManaged(Component, Placeholder = null) {
|
|
7
|
+
export function withInteractionsManaged(Component, Placeholder = null, interationTime) {
|
|
7
8
|
const Wrapped = (props) => {
|
|
8
|
-
const {
|
|
9
|
-
|
|
9
|
+
const { interactionsComplete, opacity, setInteractionsTimeOut } = useAfterInteractions();
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (interationTime)
|
|
12
|
+
setInteractionsTimeOut(interationTime);
|
|
13
|
+
}, [interationTime]);
|
|
14
|
+
const LoadingComponent = () => (
|
|
15
|
+
// <SafeAreaView flex={1}>
|
|
16
|
+
React.createElement(Center, { flex: 1, justifyContent: 'center', alignItems: 'center' }, React.createElement(Spinner, { color: '$blue500' }))
|
|
17
|
+
// </SafeAreaView>
|
|
18
|
+
);
|
|
10
19
|
console.log('interactionsComplete', interactionsComplete);
|
|
11
|
-
return (React.createElement(
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
return (React.createElement(React.Fragment, null, interactionsComplete ? (React.createElement(Component, Object.assign({}, props))) : (React.createElement(Animated.View, { style: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
opacity: opacity.value,
|
|
23
|
+
transform: [{ scale: opacity.value }],
|
|
24
|
+
} }, Placeholder ? React.createElement(Placeholder, null) : React.createElement(LoadingComponent, null)))));
|
|
14
25
|
};
|
|
15
26
|
hoistNonReactStatics(Wrapped, Component);
|
|
16
27
|
return Wrapped;
|
|
17
28
|
}
|
|
29
|
+
// export function withInteractionsManaged<Props>(
|
|
30
|
+
// Component: ComponentType<Props>,
|
|
31
|
+
// Placeholder: ComponentType | null = null,
|
|
32
|
+
// ) {
|
|
33
|
+
// const Wrapped = (props: Props) => {
|
|
34
|
+
// const { transitionRef, interactionsComplete,opacity } = useAfterInteractions();
|
|
35
|
+
// const LoadingComponent = () => <SafeAreaView><Box flex={1}>{<Spinner color={'blue.500'} />}</Box></SafeAreaView>;
|
|
36
|
+
// console.log('interactionsComplete', interactionsComplete);
|
|
37
|
+
// return (
|
|
38
|
+
// <Animated.View
|
|
39
|
+
// ref={transitionRef}
|
|
40
|
+
// style={{
|
|
41
|
+
// flex: 1,
|
|
42
|
+
// opacity: opacity.value,
|
|
43
|
+
// transform: [{ scale: opacity.value }],
|
|
44
|
+
// }}
|
|
45
|
+
// >
|
|
46
|
+
// {interactionsComplete ? <Component {...props} /> : Placeholder ? <Placeholder /> : <LoadingComponent />}
|
|
47
|
+
// </Animated.View>
|
|
48
|
+
// );
|
|
49
|
+
// };
|
|
50
|
+
// hoistNonReactStatics(Wrapped, Component);
|
|
51
|
+
// return Wrapped;
|
|
52
|
+
// }
|
|
53
|
+
// export function withInteractionsManaged<Props>(
|
|
54
|
+
// Component: ComponentType<Props>,
|
|
55
|
+
// Placeholder: ComponentType | null = null,
|
|
56
|
+
// ) {
|
|
57
|
+
// const Wrapped = (props: Props) => {
|
|
58
|
+
// const { transitionRef, interactionsComplete } = useAfterInteractions();
|
|
59
|
+
// const LoadingComponent = () => <Box flex={1}>{<Spinner color={'blue.500'} />}</Box>;
|
|
60
|
+
// console.log('interactionsComplete', interactionsComplete);
|
|
61
|
+
// return (
|
|
62
|
+
// <Transitioning.View
|
|
63
|
+
// transition={
|
|
64
|
+
// <Transition.Together>
|
|
65
|
+
// <Transition.Change interpolation="easeInOut" />
|
|
66
|
+
// <Transition.In type="fade" />
|
|
67
|
+
// </Transition.Together>
|
|
68
|
+
// }
|
|
69
|
+
// style={{ flex: 1 }}
|
|
70
|
+
// ref={transitionRef}
|
|
71
|
+
// >
|
|
72
|
+
// {interactionsComplete ? <Component {...props} /> : Placeholder ? <Placeholder /> : <LoadingComponent />}
|
|
73
|
+
// </Transitioning.View>
|
|
74
|
+
// );
|
|
75
|
+
// };
|
|
76
|
+
// hoistNonReactStatics(Wrapped, Component);
|
|
77
|
+
// return Wrapped;
|
|
78
|
+
// }
|
|
18
79
|
//# sourceMappingURL=with-interactions-managed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-interactions-managed.js","sourceRoot":"","sources":["../../src/components/with-interactions-managed.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"with-interactions-managed.js","sourceRoot":"","sources":["../../src/components/with-interactions-managed.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,uEAAuE;AACvE,OAAO,QAAwC,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAO,OAAO,EAAgB,MAAM,EAAC,MAAM,sBAAsB,CAAC;AACzE,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,MAAM,UAAU,uBAAuB,CACnC,SAA+B,EAC/B,cAAoC,IAAI,EACxC,cAAsB;IAEtB,MAAM,OAAO,GAAG,CAAC,KAAY,EAAE,EAAE;QAC7B,MAAM,EAAC,oBAAoB,EAAE,OAAO,EAAC,sBAAsB,EAAE,GAAG,oBAAoB,EAAE,CAAC;QAEvF,KAAK,CAAC,SAAS,CAAC,GAAE,EAAE;YAClB,IAAG,cAAc;gBAAE,sBAAsB,CAAC,cAAc,CAAC,CAAA;QAC3D,CAAC,EAAC,CAAC,cAAc,CAAC,CAAC,CAAA;QAEnB,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC;QAC3B,0BAA0B;QACtB,oBAAC,MAAM,IAAC,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,QA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;AAC1E,wDAAwD;AACxD,6CAA6C;AAC7C,oBAAoB;AACpB,sCAAsC;AACtC,sCAAsC;AACtC,gBAAgB;AAChB,2HAA2H;AAC3H,oCAAoC;AACpC,aAAa;AACb,SAAS;AAET,gDAAgD;AAChD,sBAAsB;AACtB,IAAI"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="react-native-reanimated" />
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { TransitioningView } from 'react-native-reanimated';
|
|
3
3
|
export declare const useAfterInteractions: () => {
|
|
4
4
|
interactionsComplete: boolean;
|
|
5
|
-
|
|
5
|
+
opacity: import("react-native-reanimated").SharedValue<number>;
|
|
6
|
+
setInteractionsTimeOut: React.Dispatch<any>;
|
|
6
7
|
};
|
|
@@ -1,29 +1,51 @@
|
|
|
1
|
-
import React, { useState
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { InteractionManager } from 'react-native';
|
|
3
|
+
// import { TransitioningView } from 'react-native-reanimated';
|
|
4
|
+
import { useSharedValue, withTiming } from 'react-native-reanimated';
|
|
3
5
|
import { useFocusEffect } from '@react-navigation/native';
|
|
4
6
|
export const useAfterInteractions = () => {
|
|
5
7
|
const [interactionsComplete, setInteractionsComplete] = useState(false);
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
+
const [interactionTimeout, setInteractionsTimeOut] = useState(200);
|
|
9
|
+
const opacity = useSharedValue(0);
|
|
10
|
+
// const subscriptionRef = useRef(null);
|
|
11
|
+
// const transitionRef = useRef<any>(null);
|
|
8
12
|
useFocusEffect(React.useCallback(() => {
|
|
9
13
|
// Do something when the screen is focused
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const interactionPromise = InteractionManager.runAfterInteractions(() => {
|
|
15
|
+
// Simulate some asynchronous task
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
// Start the animation
|
|
18
|
+
opacity.value = withTiming(1, { duration: 500 });
|
|
19
|
+
setInteractionsComplete(true);
|
|
20
|
+
}, interactionTimeout);
|
|
15
21
|
});
|
|
16
22
|
return () => {
|
|
17
|
-
var _a;
|
|
18
23
|
// Do something when the screen is unfocused
|
|
19
24
|
// Useful for cleanup functions
|
|
25
|
+
interactionPromise === null || interactionPromise === void 0 ? void 0 : interactionPromise.cancel();
|
|
20
26
|
setInteractionsComplete(false);
|
|
21
|
-
(_a = subscriptionRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
22
27
|
};
|
|
23
|
-
}, []));
|
|
28
|
+
}, [interactionTimeout]));
|
|
29
|
+
// useFocusEffect(
|
|
30
|
+
// React.useCallback(() => {
|
|
31
|
+
// // Do something when the screen is focused
|
|
32
|
+
// subscriptionRef.current = InteractionManager.runAfterInteractions(() => {
|
|
33
|
+
// transitionRef.current?.animateNextTransition();
|
|
34
|
+
// setInteractionsComplete(true);
|
|
35
|
+
// subscriptionRef.current = null;
|
|
36
|
+
// });
|
|
37
|
+
// return () => {
|
|
38
|
+
// // Do something when the screen is unfocused
|
|
39
|
+
// // Useful for cleanup functions
|
|
40
|
+
// setInteractionsComplete(false);
|
|
41
|
+
// subscriptionRef.current?.cancel();
|
|
42
|
+
// };
|
|
43
|
+
// }, []),
|
|
44
|
+
// );
|
|
24
45
|
return {
|
|
25
46
|
interactionsComplete,
|
|
26
|
-
|
|
47
|
+
opacity,
|
|
48
|
+
setInteractionsTimeOut,
|
|
27
49
|
};
|
|
28
50
|
};
|
|
29
51
|
//# sourceMappingURL=use-after-interactions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-after-interactions.js","sourceRoot":"","sources":["../../src/hooks/use-after-interactions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"use-after-interactions.js","sourceRoot":"","sources":["../../src/hooks/use-after-interactions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EA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IAC7C,8CAA8C;IAC9C,cAAc;IAEd,yBAAyB;IACzB,2DAA2D;IAC3D,8CAA8C;IAC9C,8CAA8C;IAC9C,iDAAiD;IACjD,aAAa;IACb,cAAc;IACd,KAAK;IAEL,OAAO;QACH,oBAAoB;QACpB,OAAO;QACP,sBAAsB;KACzB,CAAC;AACN,CAAC,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { useLayoutSetting, LayoutSettingProps } from './hooks/useLayoutSetting';
|
|
|
7
7
|
export * from '@gluestack-ui/themed';
|
|
8
8
|
export * from '@gluestack-ui/config';
|
|
9
9
|
export * from '@gluestack-style/react';
|
|
10
|
-
export * from './containers/layout/Lifecycle';
|
|
11
10
|
export * from './components';
|
|
11
|
+
export * from './containers/layout/Lifecycle';
|
|
12
12
|
export { useLayoutSetting, LayoutSettingProps, routeConfigKeyReplace, LayoutFeature, ProLayout, AppFeatures, AppLayout, useAfterInteractions, useIsReady, };
|
|
13
13
|
declare const _default: Feature;
|
|
14
14
|
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -5,17 +5,15 @@ import { settingsReducer } from './redux/settings';
|
|
|
5
5
|
import { useAfterInteractions } from './hooks/use-after-interactions';
|
|
6
6
|
import useIsReady from './hooks/useIsReady';
|
|
7
7
|
import routeConfigKeyReplace from './utils/routeConfigKeyReplace';
|
|
8
|
-
//changed
|
|
9
8
|
import LayoutFeature, { ProLayout, AppFeatures, AppLayout } from './containers/layout/module';
|
|
10
9
|
import { useLayoutSetting } from './hooks/useLayoutSetting';
|
|
11
|
-
//...........................
|
|
10
|
+
//...........................glustack-ui library....///
|
|
12
11
|
export * from '@gluestack-ui/themed';
|
|
13
12
|
export * from '@gluestack-ui/config';
|
|
14
13
|
export * from '@gluestack-style/react';
|
|
15
|
-
|
|
16
|
-
//............................No change....///
|
|
17
|
-
//changed
|
|
14
|
+
//............................gluestack-ui....///
|
|
18
15
|
export * from './components';
|
|
16
|
+
export * from './containers/layout/Lifecycle';
|
|
19
17
|
export { useLayoutSetting, routeConfigKeyReplace, LayoutFeature, ProLayout, AppFeatures, AppLayout, useAfterInteractions, useIsReady, };
|
|
20
18
|
export default new Feature({
|
|
21
19
|
reducer: { settings: settingsReducer, applicationErrors },
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAClE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAClE,OAAO,aAAa,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAsB,MAAM,0BAA0B,CAAC;AAEhF,uDAAuD;AACvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,iDAAiD;AAGjD,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAG9C,OAAO,EACH,gBAAgB,EAEhB,qBAAqB,EACrB,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,UAAU,GACb,CAAC;AAEF,eAAe,IAAI,OAAO,CAAC;IACvB,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE;IACzD,iBAAiB,EAAE;QACf,YAAY,EAAE,CAAC,cAAc,CAAC;KACjC;CACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/gluestack-ui-mobile",
|
|
3
|
-
"version": "6.5.1-alpha.
|
|
3
|
+
"version": "6.5.1-alpha.1",
|
|
4
4
|
"description": "Glustack-ui for mobile component layout",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,10 +24,7 @@
|
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@admin-layout/client": "6.5.1-alpha.0",
|
|
27
|
-
"@common-stack/remix-router-redux": "^4.0.1-alpha.
|
|
28
|
-
"@gluestack-style/react": "^1.0.53",
|
|
29
|
-
"@gluestack-ui/config": "^1.1.18",
|
|
30
|
-
"@gluestack-ui/themed": "^1.1.22",
|
|
27
|
+
"@common-stack/remix-router-redux": "^4.0.1-alpha.3",
|
|
31
28
|
"hoist-non-react-statics": "^3.3.2",
|
|
32
29
|
"react-native-svg": "^15.1.0",
|
|
33
30
|
"react-native-toast-message": "^2.1.5"
|
|
@@ -36,5 +33,5 @@
|
|
|
36
33
|
"typescript": {
|
|
37
34
|
"definition": "lib/index.d.ts"
|
|
38
35
|
},
|
|
39
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "d5bb921c9018ea34562b88351f0cf782334db26d"
|
|
40
37
|
}
|
|
@@ -1,33 +1,101 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
|
-
import { Transition, Transitioning } from 'react-native-reanimated';
|
|
2
|
+
// import { Transition, Transitioning } from 'react-native-reanimated';
|
|
3
|
+
import Animated, { useSharedValue, withTiming } from 'react-native-reanimated';
|
|
3
4
|
import { useAfterInteractions } from '../hooks/use-after-interactions';
|
|
4
|
-
import { Box, Spinner,
|
|
5
|
+
import { Box, Spinner, SafeAreaView ,Center} from '@gluestack-ui/themed';
|
|
5
6
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
6
7
|
|
|
7
8
|
export function withInteractionsManaged<Props>(
|
|
8
9
|
Component: ComponentType<Props>,
|
|
9
10
|
Placeholder: ComponentType | null = null,
|
|
11
|
+
interationTime?:number,
|
|
10
12
|
) {
|
|
11
13
|
const Wrapped = (props: Props) => {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
+
const {interactionsComplete, opacity,setInteractionsTimeOut } = useAfterInteractions();
|
|
15
|
+
|
|
16
|
+
React.useEffect(()=>{
|
|
17
|
+
if(interationTime) setInteractionsTimeOut(interationTime)
|
|
18
|
+
},[interationTime])
|
|
19
|
+
|
|
20
|
+
const LoadingComponent = () => (
|
|
21
|
+
// <SafeAreaView flex={1}>
|
|
22
|
+
<Center flex={1} justifyContent={'center'} alignItems={'center'}>{<Spinner color={'$blue500'} />}</Center>
|
|
23
|
+
// </SafeAreaView>
|
|
24
|
+
);
|
|
14
25
|
console.log('interactionsComplete', interactionsComplete);
|
|
15
26
|
return (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
<>
|
|
28
|
+
{interactionsComplete ? (
|
|
29
|
+
<Component {...props} />
|
|
30
|
+
) : (
|
|
31
|
+
<Animated.View
|
|
32
|
+
style={{
|
|
33
|
+
flex: 1,
|
|
34
|
+
opacity: opacity.value,
|
|
35
|
+
transform: [{ scale: opacity.value }],
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{Placeholder ? <Placeholder /> : <LoadingComponent />}
|
|
39
|
+
</Animated.View>
|
|
40
|
+
)}
|
|
41
|
+
</>
|
|
28
42
|
);
|
|
29
43
|
};
|
|
30
44
|
|
|
31
45
|
hoistNonReactStatics(Wrapped, Component);
|
|
32
46
|
return Wrapped;
|
|
33
47
|
}
|
|
48
|
+
|
|
49
|
+
// export function withInteractionsManaged<Props>(
|
|
50
|
+
// Component: ComponentType<Props>,
|
|
51
|
+
// Placeholder: ComponentType | null = null,
|
|
52
|
+
// ) {
|
|
53
|
+
// const Wrapped = (props: Props) => {
|
|
54
|
+
// const { transitionRef, interactionsComplete,opacity } = useAfterInteractions();
|
|
55
|
+
// const LoadingComponent = () => <SafeAreaView><Box flex={1}>{<Spinner color={'blue.500'} />}</Box></SafeAreaView>;
|
|
56
|
+
// console.log('interactionsComplete', interactionsComplete);
|
|
57
|
+
// return (
|
|
58
|
+
// <Animated.View
|
|
59
|
+
// ref={transitionRef}
|
|
60
|
+
// style={{
|
|
61
|
+
// flex: 1,
|
|
62
|
+
// opacity: opacity.value,
|
|
63
|
+
// transform: [{ scale: opacity.value }],
|
|
64
|
+
// }}
|
|
65
|
+
// >
|
|
66
|
+
// {interactionsComplete ? <Component {...props} /> : Placeholder ? <Placeholder /> : <LoadingComponent />}
|
|
67
|
+
// </Animated.View>
|
|
68
|
+
// );
|
|
69
|
+
// };
|
|
70
|
+
|
|
71
|
+
// hoistNonReactStatics(Wrapped, Component);
|
|
72
|
+
// return Wrapped;
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
// export function withInteractionsManaged<Props>(
|
|
76
|
+
// Component: ComponentType<Props>,
|
|
77
|
+
// Placeholder: ComponentType | null = null,
|
|
78
|
+
// ) {
|
|
79
|
+
// const Wrapped = (props: Props) => {
|
|
80
|
+
// const { transitionRef, interactionsComplete } = useAfterInteractions();
|
|
81
|
+
// const LoadingComponent = () => <Box flex={1}>{<Spinner color={'blue.500'} />}</Box>;
|
|
82
|
+
// console.log('interactionsComplete', interactionsComplete);
|
|
83
|
+
// return (
|
|
84
|
+
// <Transitioning.View
|
|
85
|
+
// transition={
|
|
86
|
+
// <Transition.Together>
|
|
87
|
+
// <Transition.Change interpolation="easeInOut" />
|
|
88
|
+
// <Transition.In type="fade" />
|
|
89
|
+
// </Transition.Together>
|
|
90
|
+
// }
|
|
91
|
+
// style={{ flex: 1 }}
|
|
92
|
+
// ref={transitionRef}
|
|
93
|
+
// >
|
|
94
|
+
// {interactionsComplete ? <Component {...props} /> : Placeholder ? <Placeholder /> : <LoadingComponent />}
|
|
95
|
+
// </Transitioning.View>
|
|
96
|
+
// );
|
|
97
|
+
// };
|
|
98
|
+
|
|
99
|
+
// hoistNonReactStatics(Wrapped, Component);
|
|
100
|
+
// return Wrapped;
|
|
101
|
+
// }
|
|
@@ -1,35 +1,58 @@
|
|
|
1
1
|
import React, { useState, useRef } from 'react';
|
|
2
2
|
import { InteractionManager } from 'react-native';
|
|
3
|
-
import { TransitioningView } from 'react-native-reanimated';
|
|
3
|
+
// import { TransitioningView } from 'react-native-reanimated';
|
|
4
|
+
import { useSharedValue, withTiming } from 'react-native-reanimated';
|
|
4
5
|
import { useFocusEffect } from '@react-navigation/native';
|
|
5
6
|
|
|
6
7
|
export const useAfterInteractions = () => {
|
|
7
8
|
const [interactionsComplete, setInteractionsComplete] = useState(false);
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const transitionRef = useRef<
|
|
9
|
+
const [interactionTimeout, setInteractionsTimeOut] = useState<any>(200);
|
|
10
|
+
const opacity = useSharedValue(0);
|
|
11
|
+
// const subscriptionRef = useRef(null);
|
|
12
|
+
// const transitionRef = useRef<any>(null);
|
|
12
13
|
|
|
13
14
|
useFocusEffect(
|
|
14
15
|
React.useCallback(() => {
|
|
15
16
|
// Do something when the screen is focused
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const interactionPromise = InteractionManager.runAfterInteractions(() => {
|
|
18
|
+
// Simulate some asynchronous task
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
// Start the animation
|
|
21
|
+
opacity.value = withTiming(1, { duration: 500 });
|
|
22
|
+
setInteractionsComplete(true);
|
|
23
|
+
}, interactionTimeout);
|
|
20
24
|
});
|
|
21
25
|
|
|
22
26
|
return () => {
|
|
23
27
|
// Do something when the screen is unfocused
|
|
24
28
|
// Useful for cleanup functions
|
|
29
|
+
interactionPromise?.cancel();
|
|
25
30
|
setInteractionsComplete(false);
|
|
26
|
-
subscriptionRef.current?.cancel();
|
|
27
31
|
};
|
|
28
|
-
}, []),
|
|
32
|
+
}, [interactionTimeout]),
|
|
29
33
|
);
|
|
30
34
|
|
|
35
|
+
// useFocusEffect(
|
|
36
|
+
// React.useCallback(() => {
|
|
37
|
+
// // Do something when the screen is focused
|
|
38
|
+
// subscriptionRef.current = InteractionManager.runAfterInteractions(() => {
|
|
39
|
+
// transitionRef.current?.animateNextTransition();
|
|
40
|
+
// setInteractionsComplete(true);
|
|
41
|
+
// subscriptionRef.current = null;
|
|
42
|
+
// });
|
|
43
|
+
|
|
44
|
+
// return () => {
|
|
45
|
+
// // Do something when the screen is unfocused
|
|
46
|
+
// // Useful for cleanup functions
|
|
47
|
+
// setInteractionsComplete(false);
|
|
48
|
+
// subscriptionRef.current?.cancel();
|
|
49
|
+
// };
|
|
50
|
+
// }, []),
|
|
51
|
+
// );
|
|
52
|
+
|
|
31
53
|
return {
|
|
32
54
|
interactionsComplete,
|
|
33
|
-
|
|
55
|
+
opacity,
|
|
56
|
+
setInteractionsTimeOut,
|
|
34
57
|
};
|
|
35
58
|
};
|
package/src/index.ts
CHANGED
|
@@ -5,20 +5,18 @@ import { settingsReducer } from './redux/settings';
|
|
|
5
5
|
import { useAfterInteractions } from './hooks/use-after-interactions';
|
|
6
6
|
import useIsReady from './hooks/useIsReady';
|
|
7
7
|
import routeConfigKeyReplace from './utils/routeConfigKeyReplace';
|
|
8
|
-
//changed
|
|
9
8
|
import LayoutFeature, { ProLayout, AppFeatures, AppLayout } from './containers/layout/module';
|
|
10
9
|
import { useLayoutSetting, LayoutSettingProps } from './hooks/useLayoutSetting';
|
|
11
10
|
|
|
12
|
-
//...........................
|
|
11
|
+
//...........................glustack-ui library....///
|
|
13
12
|
export * from '@gluestack-ui/themed';
|
|
14
13
|
export * from '@gluestack-ui/config';
|
|
15
14
|
export * from '@gluestack-style/react';
|
|
16
|
-
|
|
17
|
-
//............................No change....///
|
|
15
|
+
//............................gluestack-ui....///
|
|
18
16
|
|
|
19
|
-
//changed
|
|
20
|
-
export * from './components';
|
|
21
17
|
|
|
18
|
+
export * from './components';
|
|
19
|
+
export * from './containers/layout/Lifecycle';
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
export {
|