react-native-inapp-inspector 1.0.15 → 1.0.16
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/dist/commonjs/components/AnimatedEntrance.d.ts +12 -0
- package/dist/commonjs/components/AnimatedEntrance.js +72 -0
- package/dist/commonjs/components/ConsoleLogCard.js +114 -29
- package/dist/commonjs/components/EmptyState.js +56 -5
- package/dist/commonjs/components/ReduxTreeView.js +96 -27
- package/dist/commonjs/components/TouchableScale.js +18 -2
- package/dist/commonjs/index.js +100 -34
- package/dist/esm/components/AnimatedEntrance.d.ts +12 -0
- package/dist/esm/components/AnimatedEntrance.js +37 -0
- package/dist/esm/components/ConsoleLogCard.js +116 -31
- package/dist/esm/components/EmptyState.js +24 -6
- package/dist/esm/components/ReduxTreeView.js +95 -29
- package/dist/esm/components/TouchableScale.js +18 -2
- package/dist/esm/index.js +101 -35
- package/package.json +3 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
interface AnimatedEntranceProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
delay?: number;
|
|
6
|
+
distance?: number;
|
|
7
|
+
duration?: number;
|
|
8
|
+
index?: number;
|
|
9
|
+
style?: ViewStyle | ViewStyle[];
|
|
10
|
+
}
|
|
11
|
+
declare const AnimatedEntrance: ({ children, delay, distance, duration, index, style, }: AnimatedEntranceProps) => React.JSX.Element;
|
|
12
|
+
export default AnimatedEntrance;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const react_1 = __importStar(require("react"));
|
|
37
|
+
const react_native_1 = require("react-native");
|
|
38
|
+
const AnimatedEntrance = ({ children, delay = 0, distance = 10, duration = 220, index = 0, style, }) => {
|
|
39
|
+
const progress = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
40
|
+
(0, react_1.useEffect)(() => {
|
|
41
|
+
progress.setValue(0);
|
|
42
|
+
react_native_1.Animated.timing(progress, {
|
|
43
|
+
toValue: 1,
|
|
44
|
+
duration,
|
|
45
|
+
delay: delay + Math.min(index, 12) * 18,
|
|
46
|
+
useNativeDriver: true,
|
|
47
|
+
}).start();
|
|
48
|
+
}, [delay, duration, index, progress]);
|
|
49
|
+
return (<react_native_1.Animated.View style={[
|
|
50
|
+
style,
|
|
51
|
+
{
|
|
52
|
+
opacity: progress,
|
|
53
|
+
transform: [
|
|
54
|
+
{
|
|
55
|
+
translateY: progress.interpolate({
|
|
56
|
+
inputRange: [0, 1],
|
|
57
|
+
outputRange: [distance, 0],
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
scale: progress.interpolate({
|
|
62
|
+
inputRange: [0, 1],
|
|
63
|
+
outputRange: [0.985, 1],
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
]}>
|
|
69
|
+
{children}
|
|
70
|
+
</react_native_1.Animated.View>);
|
|
71
|
+
};
|
|
72
|
+
exports.default = AnimatedEntrance;
|
|
@@ -109,7 +109,10 @@ const getLogMessageWithBadges = (message, searchStr, textStyle, highlightStyle,
|
|
|
109
109
|
const remainingText = message.substring(fullPrefix.length);
|
|
110
110
|
const tags = fullPrefix.match(/\[[^\]]+\]/g) || [];
|
|
111
111
|
const getTagColor = (tag) => {
|
|
112
|
-
const cleanTag = tag
|
|
112
|
+
const cleanTag = tag
|
|
113
|
+
.replace(/[\[\]]/g, '')
|
|
114
|
+
.trim()
|
|
115
|
+
.toUpperCase();
|
|
113
116
|
if (cleanTag === 'API')
|
|
114
117
|
return '#0284C7';
|
|
115
118
|
if (cleanTag === 'TEST')
|
|
@@ -126,7 +129,14 @@ const getLogMessageWithBadges = (message, searchStr, textStyle, highlightStyle,
|
|
|
126
129
|
for (let i = 0; i < cleanTag.length; i++) {
|
|
127
130
|
hash = cleanTag.charCodeAt(i) + ((hash << 5) - hash);
|
|
128
131
|
}
|
|
129
|
-
const colors = [
|
|
132
|
+
const colors = [
|
|
133
|
+
'#0891B2',
|
|
134
|
+
'#0D9488',
|
|
135
|
+
'#2563EB',
|
|
136
|
+
'#D97706',
|
|
137
|
+
'#E11D48',
|
|
138
|
+
'#8B5CF6',
|
|
139
|
+
];
|
|
130
140
|
return colors[Math.abs(hash) % colors.length];
|
|
131
141
|
};
|
|
132
142
|
return (<react_native_1.Text style={textStyle} numberOfLines={numberOfLines}>
|
|
@@ -147,6 +157,7 @@ const getLogMessageWithBadges = (message, searchStr, textStyle, highlightStyle,
|
|
|
147
157
|
};
|
|
148
158
|
exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, searchStr = '', isWebView = false, }) {
|
|
149
159
|
const [expanded, setExpanded] = (0, react_1.useState)(false);
|
|
160
|
+
const chevronAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
150
161
|
const jsonContent = getJsonContent(item.message);
|
|
151
162
|
const isAnalyticsError = item.message
|
|
152
163
|
.toLowerCase()
|
|
@@ -230,6 +241,26 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
230
241
|
}
|
|
231
242
|
};
|
|
232
243
|
const colors = getLogColors();
|
|
244
|
+
(0, react_1.useEffect)(() => {
|
|
245
|
+
if (react_native_1.Platform.OS === 'android') {
|
|
246
|
+
react_native_1.UIManager.setLayoutAnimationEnabledExperimental?.(true);
|
|
247
|
+
}
|
|
248
|
+
}, []);
|
|
249
|
+
(0, react_1.useEffect)(() => {
|
|
250
|
+
react_native_1.Animated.timing(chevronAnim, {
|
|
251
|
+
toValue: expanded ? 1 : 0,
|
|
252
|
+
duration: 180,
|
|
253
|
+
useNativeDriver: true,
|
|
254
|
+
}).start();
|
|
255
|
+
}, [chevronAnim, expanded]);
|
|
256
|
+
const toggleExpanded = () => {
|
|
257
|
+
react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
|
|
258
|
+
setExpanded(prev => !prev);
|
|
259
|
+
};
|
|
260
|
+
const chevronRotate = chevronAnim.interpolate({
|
|
261
|
+
inputRange: [0, 1],
|
|
262
|
+
outputRange: ['0deg', '180deg'],
|
|
263
|
+
});
|
|
233
264
|
// Show limited lines unless expanded
|
|
234
265
|
const numLines = expanded ? undefined : 5;
|
|
235
266
|
const hasLongMessage = jsonContent
|
|
@@ -250,10 +281,8 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
250
281
|
paddingRight: 4,
|
|
251
282
|
},
|
|
252
283
|
]}>
|
|
253
|
-
|
|
254
284
|
{/* Left Content Area */}
|
|
255
|
-
<react_native_1.Pressable onPress={
|
|
256
|
-
|
|
285
|
+
<react_native_1.Pressable onPress={toggleExpanded} style={{ flex: 1, paddingRight: 6 }}>
|
|
257
286
|
<react_native_1.View style={styles.cardHeader}>
|
|
258
287
|
<react_native_1.View style={styles.headerLeft}>
|
|
259
288
|
<CopyButton_1.default value={item.message} label="Log message"/>
|
|
@@ -271,7 +300,10 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
271
300
|
},
|
|
272
301
|
]}>
|
|
273
302
|
<react_native_1.Text style={[styles.badgeText, { color: '#6B4EFF' }]}>
|
|
274
|
-
console.
|
|
303
|
+
console.
|
|
304
|
+
{('sourceMethod' in item ? item.sourceMethod : undefined) ||
|
|
305
|
+
item.type ||
|
|
306
|
+
'log'}
|
|
275
307
|
</react_native_1.Text>
|
|
276
308
|
</react_native_1.View>
|
|
277
309
|
{jsonContent && (<react_native_1.View style={[
|
|
@@ -283,7 +315,9 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
283
315
|
},
|
|
284
316
|
]}>
|
|
285
317
|
<react_native_1.Text style={[styles.badgeText, { color: '#0D9488' }]}>
|
|
286
|
-
{Array.isArray(jsonContent.data)
|
|
318
|
+
{Array.isArray(jsonContent.data)
|
|
319
|
+
? `Array[${jsonContent.data.length}]`
|
|
320
|
+
: `Object{${Object.keys(jsonContent.data).length}}`}
|
|
287
321
|
</react_native_1.Text>
|
|
288
322
|
</react_native_1.View>)}
|
|
289
323
|
{isAnalyticsError && (<react_native_1.View style={[
|
|
@@ -302,7 +336,10 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
302
336
|
borderWidth: 1,
|
|
303
337
|
},
|
|
304
338
|
]}>
|
|
305
|
-
<react_native_1.Text style={[
|
|
339
|
+
<react_native_1.Text style={[
|
|
340
|
+
styles.badgeText,
|
|
341
|
+
{ color: AppColors_1.AppColors.grayTextStrong },
|
|
342
|
+
]}>
|
|
306
343
|
user-log
|
|
307
344
|
</react_native_1.Text>
|
|
308
345
|
</react_native_1.View>)}
|
|
@@ -318,43 +355,92 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
318
355
|
webview
|
|
319
356
|
</react_native_1.Text>
|
|
320
357
|
</react_native_1.View>)}
|
|
321
|
-
<react_native_1.Text style={[styles.serialNumber, { color: AppColors_1.AppColors.grayTextWeak }]}
|
|
322
|
-
|
|
358
|
+
<react_native_1.Text style={[styles.serialNumber, { color: AppColors_1.AppColors.grayTextWeak }]}>
|
|
359
|
+
#{item.id + 1}
|
|
360
|
+
</react_native_1.Text>
|
|
361
|
+
<react_native_1.Text style={[styles.timestamp, { color: AppColors_1.AppColors.grayTextWeak }]}>
|
|
362
|
+
{formatTime(item.timestamp)}
|
|
363
|
+
</react_native_1.Text>
|
|
323
364
|
</react_native_1.View>
|
|
324
|
-
|
|
325
|
-
{caller && caller !== 'Unknown' && (<react_native_1.Text style={[
|
|
365
|
+
|
|
366
|
+
{caller && caller !== 'Unknown' && (<react_native_1.Text style={[
|
|
367
|
+
styles.callerText,
|
|
368
|
+
{ color: AppColors_1.AppColors.grayTextWeak, marginRight: 4 },
|
|
369
|
+
]} numberOfLines={1} ellipsizeMode="middle">
|
|
326
370
|
{caller.split('/').pop() || caller}
|
|
327
371
|
</react_native_1.Text>)}
|
|
328
372
|
</react_native_1.View>
|
|
329
373
|
|
|
330
|
-
<react_native_1.View style={[
|
|
374
|
+
<react_native_1.View style={[
|
|
375
|
+
styles.cardBody,
|
|
376
|
+
{
|
|
377
|
+
backgroundColor: AppColors_1.AppColors.primaryLight,
|
|
378
|
+
borderColor: AppColors_1.AppColors.dividerColor,
|
|
379
|
+
},
|
|
380
|
+
]}>
|
|
331
381
|
{jsonContent ? (<>
|
|
332
|
-
{jsonContent.header ? (<react_native_1.Pressable onPress={
|
|
382
|
+
{jsonContent.header ? (<react_native_1.Pressable onPress={toggleExpanded}>
|
|
333
383
|
{getLogMessageWithBadges(jsonContent.header, searchStr, [styles.messageText, { color: AppColors_1.AppColors.primaryBlack }], styles.highlight, numLines)}
|
|
334
384
|
</react_native_1.Pressable>) : null}
|
|
335
|
-
{expanded ? (<react_native_1.View style={[
|
|
385
|
+
{expanded ? (<react_native_1.View style={[
|
|
386
|
+
styles.jsonContainer,
|
|
387
|
+
{
|
|
388
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
389
|
+
borderColor: AppColors_1.AppColors.dividerColor,
|
|
390
|
+
},
|
|
391
|
+
]}>
|
|
336
392
|
<JsonViewer_1.default data={jsonContent.data} search={searchStr} forceOpen={expanded}/>
|
|
337
|
-
</react_native_1.View>) : (<react_native_1.Pressable onPress={
|
|
338
|
-
|
|
393
|
+
</react_native_1.View>) : (<react_native_1.Pressable onPress={toggleExpanded} style={[
|
|
394
|
+
styles.jsonPreviewContainer,
|
|
395
|
+
{
|
|
396
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
397
|
+
borderColor: AppColors_1.AppColors.dividerColor,
|
|
398
|
+
},
|
|
399
|
+
]}>
|
|
400
|
+
<HighlightText_1.default text={getJsonPreviewText(jsonContent.data).text} search={searchStr} style={[
|
|
401
|
+
styles.jsonPreviewText,
|
|
402
|
+
{ color: AppColors_1.AppColors.primaryBlack },
|
|
403
|
+
]} highlightStyle={styles.highlight} detectLinks={true}/>
|
|
339
404
|
</react_native_1.Pressable>)}
|
|
340
|
-
</>) : (<react_native_1.Pressable onPress={
|
|
405
|
+
</>) : (<react_native_1.Pressable onPress={toggleExpanded}>
|
|
341
406
|
{getLogMessageWithBadges(item.message, searchStr, [styles.messageText, { color: AppColors_1.AppColors.primaryBlack }], styles.highlight, numLines)}
|
|
342
407
|
</react_native_1.Pressable>)}
|
|
343
|
-
{hasLongMessage && (<react_native_1.Pressable onPress={
|
|
408
|
+
{hasLongMessage && (<react_native_1.Pressable onPress={toggleExpanded} style={styles.seeMoreBtn} hitSlop={8}>
|
|
344
409
|
<react_native_1.Text style={styles.seeMoreText}>
|
|
345
410
|
{expanded ? 'See Less' : 'See More'}
|
|
346
411
|
</react_native_1.Text>
|
|
347
412
|
</react_native_1.Pressable>)}
|
|
348
413
|
</react_native_1.View>
|
|
349
414
|
|
|
350
|
-
{expanded && (<react_native_1.View style={[
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
415
|
+
{expanded && (<react_native_1.View style={[
|
|
416
|
+
styles.cardFooter,
|
|
417
|
+
{ borderTopColor: AppColors_1.AppColors.dividerColor, gap: 6 },
|
|
418
|
+
]}>
|
|
419
|
+
<react_native_1.View style={{
|
|
420
|
+
flexDirection: 'row',
|
|
421
|
+
justifyContent: 'space-between',
|
|
422
|
+
alignItems: 'center',
|
|
423
|
+
}}>
|
|
424
|
+
<react_native_1.Text style={{
|
|
425
|
+
fontFamily: AppFonts_1.AppFonts.interRegular,
|
|
426
|
+
fontSize: 10.5,
|
|
427
|
+
color: AppColors_1.AppColors.grayTextWeak,
|
|
428
|
+
}}>
|
|
429
|
+
Length: {item.message.length} chars • Size:{' '}
|
|
430
|
+
{encodeURIComponent(item.message).replace(/%[0-9A-F]{2}/g, 'a').length}{' '}
|
|
431
|
+
bytes
|
|
354
432
|
</react_native_1.Text>
|
|
355
433
|
</react_native_1.View>
|
|
356
|
-
{caller && caller !== 'Unknown' && (<react_native_1.View style={{
|
|
357
|
-
|
|
434
|
+
{caller && caller !== 'Unknown' && (<react_native_1.View style={{
|
|
435
|
+
flexDirection: 'row',
|
|
436
|
+
alignItems: 'center',
|
|
437
|
+
justifyContent: 'space-between',
|
|
438
|
+
marginTop: 4,
|
|
439
|
+
}}>
|
|
440
|
+
<react_native_1.Text style={[
|
|
441
|
+
styles.fullCallerText,
|
|
442
|
+
{ color: AppColors_1.AppColors.grayText, flex: 1, marginRight: 8 },
|
|
443
|
+
]} numberOfLines={2}>
|
|
358
444
|
Caller: {caller}
|
|
359
445
|
</react_native_1.Text>
|
|
360
446
|
<CopyButton_1.default value={caller} label="Caller stack frame"/>
|
|
@@ -363,7 +449,7 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
363
449
|
</react_native_1.Pressable>
|
|
364
450
|
|
|
365
451
|
{/* Right Isolated Chevron Area */}
|
|
366
|
-
<react_native_1.Pressable onPress={
|
|
452
|
+
<react_native_1.Pressable onPress={toggleExpanded} style={{
|
|
367
453
|
width: 28,
|
|
368
454
|
alignItems: 'center',
|
|
369
455
|
justifyContent: 'center',
|
|
@@ -371,11 +457,10 @@ exports.ConsoleLogCard = react_1.default.memo(function ConsoleLogCard({ item, se
|
|
|
371
457
|
marginTop: expanded ? 8 : 0,
|
|
372
458
|
height: expanded ? 32 : undefined,
|
|
373
459
|
}} hitSlop={12}>
|
|
374
|
-
<react_native_1.View style={{ transform: [{ rotate:
|
|
460
|
+
<react_native_1.Animated.View style={{ transform: [{ rotate: chevronRotate }] }}>
|
|
375
461
|
<NetworkIcons_1.ChevronIcon size={16} color={AppColors_1.AppColors.grayTextWeak}/>
|
|
376
|
-
</react_native_1.View>
|
|
462
|
+
</react_native_1.Animated.View>
|
|
377
463
|
</react_native_1.Pressable>
|
|
378
|
-
|
|
379
464
|
</react_native_1.View>
|
|
380
465
|
</react_native_1.View>);
|
|
381
466
|
});
|
|
@@ -1,18 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 =
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
7
40
|
const react_native_1 = require("react-native");
|
|
8
41
|
// Components
|
|
9
42
|
const TouchableScale_1 = __importDefault(require("./TouchableScale"));
|
|
43
|
+
const AnimatedEntrance_1 = __importDefault(require("./AnimatedEntrance"));
|
|
10
44
|
// Assets
|
|
11
45
|
const NetworkIcons_1 = require("./NetworkIcons");
|
|
12
46
|
// Stylesheet
|
|
13
47
|
const AppColors_1 = require("../styles/AppColors");
|
|
14
48
|
const styles_1 = __importDefault(require("../styles"));
|
|
15
49
|
const EmptyState = ({ isSearch }) => {
|
|
50
|
+
const iconPulse = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
52
|
+
const loop = react_native_1.Animated.loop(react_native_1.Animated.sequence([
|
|
53
|
+
react_native_1.Animated.timing(iconPulse, {
|
|
54
|
+
toValue: 1.06,
|
|
55
|
+
duration: 900,
|
|
56
|
+
useNativeDriver: true,
|
|
57
|
+
}),
|
|
58
|
+
react_native_1.Animated.timing(iconPulse, {
|
|
59
|
+
toValue: 1,
|
|
60
|
+
duration: 900,
|
|
61
|
+
useNativeDriver: true,
|
|
62
|
+
}),
|
|
63
|
+
]));
|
|
64
|
+
loop.start();
|
|
65
|
+
return () => loop.stop();
|
|
66
|
+
}, [iconPulse]);
|
|
16
67
|
const handleReload = () => {
|
|
17
68
|
if (__DEV__ && react_native_1.DevSettings && react_native_1.DevSettings.reload) {
|
|
18
69
|
react_native_1.DevSettings.reload();
|
|
@@ -20,10 +71,10 @@ const EmptyState = ({ isSearch }) => {
|
|
|
20
71
|
}
|
|
21
72
|
react_native_1.Alert.alert('Reload', 'App reload is typically only available in development mode.');
|
|
22
73
|
};
|
|
23
|
-
return (<
|
|
24
|
-
<react_native_1.View style={styles_1.default.emptyIconWrap}>
|
|
74
|
+
return (<AnimatedEntrance_1.default style={styles_1.default.emptyContainer} distance={14}>
|
|
75
|
+
<react_native_1.Animated.View style={[styles_1.default.emptyIconWrap, { transform: [{ scale: iconPulse }] }]}>
|
|
25
76
|
<NetworkIcons_1.EmptyRadarIcon color={AppColors_1.AppColors.purple} size={32}/>
|
|
26
|
-
</react_native_1.View>
|
|
77
|
+
</react_native_1.Animated.View>
|
|
27
78
|
<react_native_1.Text style={styles_1.default.emptyTitle}>
|
|
28
79
|
{isSearch ? 'No matching APIs' : 'No network activity'}
|
|
29
80
|
</react_native_1.Text>
|
|
@@ -35,6 +86,6 @@ const EmptyState = ({ isSearch }) => {
|
|
|
35
86
|
{!isSearch && (<TouchableScale_1.default style={styles_1.default.reloadBtn} onPress={handleReload}>
|
|
36
87
|
<react_native_1.Text style={styles_1.default.reloadBtnText}>Reload App</react_native_1.Text>
|
|
37
88
|
</TouchableScale_1.default>)}
|
|
38
|
-
</
|
|
89
|
+
</AnimatedEntrance_1.default>);
|
|
39
90
|
};
|
|
40
91
|
exports.default = EmptyState;
|