esoftplay 0.0.125-s → 0.0.125-u
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/esp.ts +3 -2
- package/modules/user/index.tsx +62 -9
- package/package.json +1 -1
package/esp.ts
CHANGED
|
@@ -28,7 +28,7 @@ console.warn = (...arg) => {
|
|
|
28
28
|
if (arg?.[0]?.startsWith?.(ignoreWarns[i])) return;
|
|
29
29
|
}
|
|
30
30
|
warn(...arg);
|
|
31
|
-
};
|
|
31
|
+
};
|
|
32
32
|
LogBox.ignoreLogs(ignoreWarns);
|
|
33
33
|
|
|
34
34
|
let app = require('../../app.json');
|
|
@@ -216,7 +216,8 @@ const esp = {
|
|
|
216
216
|
out.forEach((x) => {
|
|
217
217
|
if (x != undefined)
|
|
218
218
|
console.log(JSON.stringify(x, undefined, 2), "\x1b[0m");
|
|
219
|
-
|
|
219
|
+
else
|
|
220
|
+
console.log(x, "\x1b[0m")
|
|
220
221
|
})
|
|
221
222
|
}
|
|
222
223
|
},
|
package/modules/user/index.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { esp, useSafeState } from 'esoftplay';
|
|
|
4
4
|
import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
|
|
5
5
|
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
6
6
|
import { LibImage } from 'esoftplay/cache/lib/image/import';
|
|
7
|
+
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
7
8
|
import { LibNet_status } from 'esoftplay/cache/lib/net_status/import';
|
|
8
9
|
import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
9
10
|
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
@@ -20,8 +21,13 @@ import { UserRoutes } from 'esoftplay/cache/user/routes/import';
|
|
|
20
21
|
import useGlobalState from 'esoftplay/global';
|
|
21
22
|
import * as Font from "expo-font";
|
|
22
23
|
import React, { useEffect, useLayoutEffect } from 'react';
|
|
23
|
-
import { Platform, Pressable, View } from
|
|
24
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
24
|
+
import { Platform, Pressable, View } from 'react-native';
|
|
25
|
+
import { GestureHandlerRootView, PanGestureHandler } from 'react-native-gesture-handler';
|
|
26
|
+
import Animated, {
|
|
27
|
+
useAnimatedGestureHandler,
|
|
28
|
+
useAnimatedStyle,
|
|
29
|
+
useSharedValue
|
|
30
|
+
} from 'react-native-reanimated';
|
|
25
31
|
|
|
26
32
|
export interface UserIndexProps {
|
|
27
33
|
|
|
@@ -86,7 +92,20 @@ export default function m(props: UserIndexProps): any {
|
|
|
86
92
|
setLoading(false)
|
|
87
93
|
}
|
|
88
94
|
})
|
|
89
|
-
|
|
95
|
+
|
|
96
|
+
if (esp.config('firebase').hasOwnProperty('apiKey')) {
|
|
97
|
+
try {
|
|
98
|
+
const Firestore = esp.mod('chatting/firestore')
|
|
99
|
+
Firestore()?.init?.()
|
|
100
|
+
if (user) {
|
|
101
|
+
const ChattingLib = esp.mod('chatting/lib')
|
|
102
|
+
ChattingLib().setUser()
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
90
109
|
|
|
91
110
|
LibUpdaterProperty.check()
|
|
92
111
|
}, [])
|
|
@@ -115,12 +134,7 @@ export default function m(props: UserIndexProps): any {
|
|
|
115
134
|
<LibProgress />
|
|
116
135
|
<LibToast />
|
|
117
136
|
<UserHook />
|
|
118
|
-
{
|
|
119
|
-
__DEV__ &&
|
|
120
|
-
<Pressable onPress={() => route.reset()} style={{ position: 'absolute', right: 10, top: LibStyle.height * 0.5, padding: 10, backgroundColor: 'indigo', alignItems: 'center', justifyContent: 'center', borderRadius: 50 }} >
|
|
121
|
-
<LibIcon name='delete-variant' color='white' />
|
|
122
|
-
</Pressable>
|
|
123
|
-
}
|
|
137
|
+
{__DEV__ && <Draggable />}
|
|
124
138
|
</>
|
|
125
139
|
}
|
|
126
140
|
</View>
|
|
@@ -128,3 +142,42 @@ export default function m(props: UserIndexProps): any {
|
|
|
128
142
|
</GestureHandlerRootView>
|
|
129
143
|
)
|
|
130
144
|
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
const Draggable = () => {
|
|
150
|
+
const translateX = useSharedValue(0);
|
|
151
|
+
const translateY = useSharedValue(0);
|
|
152
|
+
const lastOffset = { x: 0, y: 0 };
|
|
153
|
+
const handleGestureEvent = useAnimatedGestureHandler({
|
|
154
|
+
onStart: (_, ctx: any) => {
|
|
155
|
+
ctx.offsetX = translateX.value;
|
|
156
|
+
ctx.offsetY = translateY.value;
|
|
157
|
+
},
|
|
158
|
+
onActive: (event, ctx) => {
|
|
159
|
+
translateX.value = ctx.offsetX + event.translationX;
|
|
160
|
+
translateY.value = ctx.offsetY + event.translationY;
|
|
161
|
+
},
|
|
162
|
+
onEnd: (event) => {
|
|
163
|
+
lastOffset.x += event.translationX;
|
|
164
|
+
lastOffset.y += event.translationY;
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
168
|
+
return {
|
|
169
|
+
transform: [{ translateX: translateX.value }, { translateY: translateY.value }],
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
return (
|
|
173
|
+
<View style={{ position: 'absolute', right: 10 }}>
|
|
174
|
+
<PanGestureHandler onGestureEvent={handleGestureEvent}>
|
|
175
|
+
<Animated.View style={[animatedStyle]} >
|
|
176
|
+
<Pressable onPress={() => { route.reset(); LibNavigation.backToRoot() }} style={{ right: 10, top: LibStyle.height * 0.5, padding: 10, backgroundColor: 'indigo', alignItems: 'center', justifyContent: 'center', borderRadius: 50 }} >
|
|
177
|
+
<LibIcon name='delete-variant' color='white' />
|
|
178
|
+
</Pressable>
|
|
179
|
+
</Animated.View>
|
|
180
|
+
</PanGestureHandler>
|
|
181
|
+
</View>
|
|
182
|
+
);
|
|
183
|
+
};
|