react-native-inapp-inspector 2.3.18 → 2.3.20
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/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +57 -0
- package/dist/commonjs/analytics.js +1 -24
- package/dist/commonjs/bundle.js +1 -16
- package/dist/commonjs/capture.d.ts +2 -0
- package/dist/commonjs/capture.js +1 -32
- package/dist/commonjs/components/AnalyticsDetail.js +92 -623
- package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
- package/dist/commonjs/components/AnalyticsGraph.js +70 -370
- package/dist/commonjs/components/AnimatedEntrance.js +1 -11
- package/dist/commonjs/components/AppHeaderLogo.js +7 -134
- package/dist/commonjs/components/BrandCircleIcon.js +73 -118
- package/dist/commonjs/components/BrandSquareIcon.js +63 -108
- package/dist/commonjs/components/CodeSnippet.js +48 -623
- package/dist/commonjs/components/ConsoleLogCard.js +63 -537
- package/dist/commonjs/components/CopyButton.js +3 -89
- package/dist/commonjs/components/DiffViewer.js +19 -83
- package/dist/commonjs/components/DomainHeader.js +27 -127
- package/dist/commonjs/components/EmptyState.d.ts +1 -0
- package/dist/commonjs/components/EmptyState.js +10 -87
- package/dist/commonjs/components/EndOfListFooter.js +7 -81
- package/dist/commonjs/components/ErrorBoundary.js +72 -566
- package/dist/commonjs/components/HeadersSection.js +31 -110
- package/dist/commonjs/components/HighlightText.js +17 -58
- package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/commonjs/components/Inspector/AboutModal.js +351 -0
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
- package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
- package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
- package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
- package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
- package/dist/commonjs/components/Inspector/DebuggingTab.js +64 -871
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
- package/dist/commonjs/components/Inspector/FabLauncher.js +85 -54
- package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
- package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +9 -0
- package/dist/commonjs/components/Inspector/FeedbackModal.js +167 -521
- package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
- package/dist/commonjs/components/Inspector/InspectorHeader.js +219 -1093
- package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
- package/dist/commonjs/components/Inspector/MainScreen.js +60 -332
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +136 -278
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +134 -361
- package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
- package/dist/commonjs/components/Inspector/NetworkDetail.js +96 -432
- package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
- package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
- package/dist/commonjs/components/Inspector/NpmStarPrompt.js +17 -433
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
- package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
- package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
- package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
- package/dist/commonjs/components/Inspector/SettingsPanel.js +431 -3431
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
- package/dist/commonjs/components/Inspector/TabBar.js +47 -183
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +34 -408
- package/dist/commonjs/components/JsonViewer.js +168 -380
- package/dist/commonjs/components/LogCard.js +57 -567
- package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
- package/dist/commonjs/components/MetaAccordion.js +69 -238
- package/dist/commonjs/components/MiniBarChart.js +3 -56
- package/dist/commonjs/components/MiniLineChart.js +3 -58
- package/dist/commonjs/components/NetworkIcons.d.ts +7 -0
- package/dist/commonjs/components/NetworkIcons.js +479 -997
- package/dist/commonjs/components/QRCodeView.js +5 -79
- package/dist/commonjs/components/SectionHeader.js +15 -37
- package/dist/commonjs/components/SegmentedTabs.js +7 -61
- package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Slider.js +15 -243
- package/dist/commonjs/components/SourcePageCard.js +30 -89
- package/dist/commonjs/components/Toast.js +5 -147
- package/dist/commonjs/components/TouchableScale.js +3 -24
- package/dist/commonjs/components/TreeNode.js +55 -130
- package/dist/commonjs/console.js +1 -16
- package/dist/commonjs/constants/index.js +1 -32
- package/dist/commonjs/constants/telemetryConfig.js +1 -6
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -4
- package/dist/commonjs/crash.js +1 -23
- package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
- package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
- package/dist/commonjs/customHooks/consoleLogger.js +6 -445
- package/dist/commonjs/customHooks/crashHandler.js +7 -656
- package/dist/commonjs/customHooks/logFilters.js +1 -23
- package/dist/commonjs/customHooks/networkLogger.js +2 -536
- package/dist/commonjs/customHooks/performanceTracker.js +63 -750
- package/dist/commonjs/customHooks/reduxLogger.js +2 -313
- package/dist/commonjs/customHooks/storageInspector.js +1 -435
- package/dist/commonjs/customHooks/useAccordion.js +1 -18
- package/dist/commonjs/decorators/index.js +1 -100
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
- package/dist/commonjs/helpers/index.js +8 -921
- package/dist/commonjs/helpers/memoryManager.js +1 -99
- package/dist/commonjs/helpers/qrGenerator.js +1 -367
- package/dist/commonjs/helpers/remoteConfig.js +1 -165
- package/dist/commonjs/helpers/searchQueryParser.js +1 -62
- package/dist/commonjs/helpers/settingsStore.js +1 -144
- package/dist/commonjs/helpers/telemetry.js +1 -501
- package/dist/commonjs/helpers/toast.js +1 -20
- package/dist/commonjs/i18n/index.js +1 -90
- package/dist/commonjs/i18n/locales/en.json +1 -1122
- package/dist/commonjs/index.js +5 -2153
- package/dist/commonjs/metro.js +6 -468
- package/dist/commonjs/native/NativeInspector.d.ts +3 -0
- package/dist/commonjs/native/NativeInspector.js +1 -402
- package/dist/commonjs/native/NativeNetworkInspector.d.ts +1 -0
- package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
- package/dist/commonjs/network.js +1 -13
- package/dist/commonjs/performance.js +1 -29
- package/dist/commonjs/redux.js +1 -20
- package/dist/commonjs/storage.js +1 -14
- package/dist/commonjs/styles/AppColors.js +1 -423
- package/dist/commonjs/styles/AppFonts.js +1 -17
- package/dist/commonjs/styles/common.js +1 -190
- package/dist/commonjs/styles/index.d.ts +6 -0
- package/dist/commonjs/styles/index.js +1 -1589
- package/dist/commonjs/types/enums.d.ts +2 -1
- package/dist/commonjs/types/enums.js +1 -150
- package/dist/commonjs/types/index.js +1 -18
- package/dist/commonjs/types/interfaces.d.ts +7 -0
- package/dist/commonjs/types/interfaces.js +1 -2
- package/dist/esm/analytics.js +1 -2
- package/dist/esm/bundle.js +1 -2
- package/dist/esm/capture.d.ts +2 -0
- package/dist/esm/capture.js +1 -29
- package/dist/esm/components/AnalyticsDetail.js +171 -664
- package/dist/esm/components/AnalyticsEventCard.js +77 -335
- package/dist/esm/components/AnalyticsGraph.js +95 -357
- package/dist/esm/components/AnimatedEntrance.js +1 -6
- package/dist/esm/components/AppHeaderLogo.js +7 -94
- package/dist/esm/components/BrandCircleIcon.js +114 -119
- package/dist/esm/components/BrandSquareIcon.js +73 -78
- package/dist/esm/components/CodeSnippet.js +58 -595
- package/dist/esm/components/ConsoleLogCard.js +91 -526
- package/dist/esm/components/CopyButton.js +3 -51
- package/dist/esm/components/DiffViewer.js +22 -48
- package/dist/esm/components/DomainHeader.js +43 -138
- package/dist/esm/components/EmptyState.d.ts +1 -0
- package/dist/esm/components/EmptyState.js +17 -56
- package/dist/esm/components/EndOfListFooter.js +15 -83
- package/dist/esm/components/ErrorBoundary.js +125 -582
- package/dist/esm/components/HeadersSection.js +52 -93
- package/dist/esm/components/HighlightText.js +17 -53
- package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/esm/components/Inspector/AboutModal.js +351 -0
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
- package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
- package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
- package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
- package/dist/esm/components/Inspector/CrashDetail.js +236 -747
- package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
- package/dist/esm/components/Inspector/CrashTab.js +177 -711
- package/dist/esm/components/Inspector/DebuggingTab.js +156 -923
- package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
- package/dist/esm/components/Inspector/FabLauncher.js +85 -49
- package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
- package/dist/esm/components/Inspector/FeedbackModal.d.ts +9 -0
- package/dist/esm/components/Inspector/FeedbackModal.js +182 -499
- package/dist/esm/components/Inspector/InspectorContext.js +1 -12
- package/dist/esm/components/Inspector/InspectorHeader.js +309 -1145
- package/dist/esm/components/Inspector/LogDetail.js +235 -1023
- package/dist/esm/components/Inspector/MainScreen.js +86 -320
- package/dist/esm/components/Inspector/MediaGalleryTab.js +157 -259
- package/dist/esm/components/Inspector/MediaPreviewModal.js +153 -340
- package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +141 -472
- package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
- package/dist/esm/components/Inspector/NetworkTab.js +125 -517
- package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
- package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
- package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
- package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
- package/dist/esm/components/Inspector/ReduxTab.js +144 -722
- package/dist/esm/components/Inspector/SettingsPanel.js +647 -3609
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Inspector/StorageTab.js +172 -866
- package/dist/esm/components/Inspector/TabBar.js +52 -183
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +79 -416
- package/dist/esm/components/JsonViewer.js +179 -353
- package/dist/esm/components/LogCard.js +93 -565
- package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
- package/dist/esm/components/MetaAccordion.js +136 -267
- package/dist/esm/components/MiniBarChart.js +3 -18
- package/dist/esm/components/MiniLineChart.js +3 -20
- package/dist/esm/components/NetworkIcons.d.ts +7 -0
- package/dist/esm/components/NetworkIcons.js +481 -817
- package/dist/esm/components/QRCodeView.js +8 -45
- package/dist/esm/components/SectionHeader.js +22 -39
- package/dist/esm/components/SegmentedTabs.js +8 -57
- package/dist/esm/components/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Slider.js +24 -213
- package/dist/esm/components/SourcePageCard.js +65 -86
- package/dist/esm/components/Toast.js +10 -117
- package/dist/esm/components/TouchableScale.js +3 -19
- package/dist/esm/components/TreeNode.js +58 -95
- package/dist/esm/console.js +1 -2
- package/dist/esm/constants/index.js +1 -28
- package/dist/esm/constants/telemetryConfig.js +1 -3
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/crash.js +1 -2
- package/dist/esm/customHooks/analyticsLogger.js +1 -230
- package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
- package/dist/esm/customHooks/consoleLogger.js +6 -432
- package/dist/esm/customHooks/crashHandler.js +7 -630
- package/dist/esm/customHooks/logFilters.js +1 -20
- package/dist/esm/customHooks/networkLogger.js +2 -519
- package/dist/esm/customHooks/performanceTracker.js +63 -723
- package/dist/esm/customHooks/reduxLogger.js +2 -293
- package/dist/esm/customHooks/storageInspector.js +1 -418
- package/dist/esm/customHooks/useAccordion.js +1 -16
- package/dist/esm/decorators/index.js +1 -95
- package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
- package/dist/esm/helpers/index.js +8 -861
- package/dist/esm/helpers/memoryManager.js +1 -91
- package/dist/esm/helpers/qrGenerator.js +1 -364
- package/dist/esm/helpers/remoteConfig.js +1 -160
- package/dist/esm/helpers/searchQueryParser.js +1 -59
- package/dist/esm/helpers/settingsStore.js +1 -134
- package/dist/esm/helpers/telemetry.js +1 -489
- package/dist/esm/helpers/toast.js +1 -15
- package/dist/esm/i18n/index.js +1 -78
- package/dist/esm/i18n/locales/en.json +1 -1122
- package/dist/esm/index.js +7 -1967
- package/dist/esm/metro.js +6 -459
- package/dist/esm/native/NativeInspector.d.ts +3 -0
- package/dist/esm/native/NativeInspector.js +1 -370
- package/dist/esm/native/NativeNetworkInspector.d.ts +1 -0
- package/dist/esm/native/NativeNetworkInspector.js +1 -2
- package/dist/esm/network.js +1 -1
- package/dist/esm/performance.js +1 -2
- package/dist/esm/redux.js +1 -1
- package/dist/esm/storage.js +1 -1
- package/dist/esm/styles/AppColors.js +1 -417
- package/dist/esm/styles/AppFonts.js +1 -13
- package/dist/esm/styles/common.js +1 -186
- package/dist/esm/styles/index.d.ts +6 -0
- package/dist/esm/styles/index.js +1 -1551
- package/dist/esm/types/enums.d.ts +2 -1
- package/dist/esm/types/enums.js +1 -147
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/interfaces.d.ts +7 -0
- package/dist/esm/types/interfaces.js +1 -1
- package/ios/NetworkInspectorModule.mm +253 -136
- package/package.json +5 -3
- package/react-native-inapp-inspector.podspec +1 -1
- package/src/native/NativeInspector.ts +17 -0
- package/src/native/NativeNetworkInspector.ts +1 -0
- package/src/analytics.ts +0 -35
- package/src/bundle.ts +0 -25
- package/src/capture.ts +0 -101
- package/src/components/AnalyticsDetail.tsx +0 -870
- package/src/components/AnalyticsEventCard.tsx +0 -444
- package/src/components/AnalyticsGraph.tsx +0 -583
- package/src/components/AnimatedEntrance.tsx +0 -20
- package/src/components/AppHeaderLogo.tsx +0 -143
- package/src/components/BrandCircleIcon.tsx +0 -144
- package/src/components/BrandSquareIcon.tsx +0 -184
- package/src/components/CodeSnippet.tsx +0 -725
- package/src/components/ConsoleLogCard.tsx +0 -679
- package/src/components/CopyButton.tsx +0 -87
- package/src/components/DiffViewer.tsx +0 -82
- package/src/components/DomainHeader.tsx +0 -224
- package/src/components/EmptyState.tsx +0 -95
- package/src/components/EndOfListFooter.tsx +0 -100
- package/src/components/ErrorBoundary.tsx +0 -688
- package/src/components/HeadersSection.tsx +0 -172
- package/src/components/HighlightText.tsx +0 -100
- package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
- package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
- package/src/components/Inspector/BundleTab.tsx +0 -4768
- package/src/components/Inspector/ConsoleTab.tsx +0 -726
- package/src/components/Inspector/CrashDetail.tsx +0 -997
- package/src/components/Inspector/CrashFilterModal.tsx +0 -721
- package/src/components/Inspector/CrashTab.tsx +0 -933
- package/src/components/Inspector/DebuggingTab.tsx +0 -1103
- package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
- package/src/components/Inspector/FabLauncher.tsx +0 -80
- package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
- package/src/components/Inspector/FeedbackModal.tsx +0 -626
- package/src/components/Inspector/InspectorContext.tsx +0 -28
- package/src/components/Inspector/InspectorHeader.tsx +0 -1545
- package/src/components/Inspector/LogDetail.tsx +0 -1431
- package/src/components/Inspector/MainScreen.tsx +0 -459
- package/src/components/Inspector/MediaGalleryTab.tsx +0 -355
- package/src/components/Inspector/MediaPreviewModal.tsx +0 -435
- package/src/components/Inspector/NavigationTracker.tsx +0 -13
- package/src/components/Inspector/NetworkDetail.tsx +0 -795
- package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
- package/src/components/Inspector/NetworkTab.tsx +0 -820
- package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
- package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
- package/src/components/Inspector/PerformanceTab.tsx +0 -1967
- package/src/components/Inspector/ReduxDetail.tsx +0 -1651
- package/src/components/Inspector/ReduxTab.tsx +0 -987
- package/src/components/Inspector/SettingsPanel.tsx +0 -4580
- package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Inspector/StorageTab.tsx +0 -1159
- package/src/components/Inspector/TabBar.tsx +0 -263
- package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
- package/src/components/JsonViewer.tsx +0 -547
- package/src/components/LogCard.tsx +0 -694
- package/src/components/LogSyntaxHighlighter.tsx +0 -178
- package/src/components/MetaAccordion.tsx +0 -355
- package/src/components/MiniBarChart.tsx +0 -42
- package/src/components/MiniLineChart.tsx +0 -33
- package/src/components/NetworkIcons.tsx +0 -2599
- package/src/components/QRCodeView.tsx +0 -75
- package/src/components/SectionHeader.tsx +0 -101
- package/src/components/SegmentedTabs.tsx +0 -83
- package/src/components/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Slider.tsx +0 -300
- package/src/components/SourcePageCard.tsx +0 -150
- package/src/components/Toast.tsx +0 -131
- package/src/components/TouchableScale.tsx +0 -61
- package/src/components/TreeNode.tsx +0 -171
- package/src/console.ts +0 -24
- package/src/constants/index.ts +0 -41
- package/src/constants/telemetryConfig.ts +0 -4
- package/src/constants/version.ts +0 -3
- package/src/crash.ts +0 -32
- package/src/customHooks/analyticsLogger.ts +0 -336
- package/src/customHooks/bundleAnalyzer.ts +0 -1256
- package/src/customHooks/consoleLogger.ts +0 -530
- package/src/customHooks/crashHandler.ts +0 -944
- package/src/customHooks/logFilters.ts +0 -32
- package/src/customHooks/networkLogger.ts +0 -624
- package/src/customHooks/performanceTracker.ts +0 -1014
- package/src/customHooks/reduxLogger.ts +0 -406
- package/src/customHooks/storageInspector.ts +0 -513
- package/src/customHooks/useAccordion.tsx +0 -27
- package/src/decorators/index.ts +0 -184
- package/src/helpers/gaAnalyticsRegistry.ts +0 -204
- package/src/helpers/index.ts +0 -1092
- package/src/helpers/memoryManager.ts +0 -138
- package/src/helpers/qrGenerator.ts +0 -430
- package/src/helpers/remoteConfig.ts +0 -212
- package/src/helpers/searchQueryParser.ts +0 -84
- package/src/helpers/settingsStore.ts +0 -171
- package/src/helpers/telemetry.ts +0 -568
- package/src/helpers/toast.ts +0 -17
- package/src/i18n/index.ts +0 -104
- package/src/i18n/locales/en.json +0 -1125
- package/src/index.tsx +0 -2635
- package/src/metro.ts +0 -598
- package/src/network.ts +0 -22
- package/src/performance.ts +0 -38
- package/src/redux.ts +0 -23
- package/src/storage.ts +0 -18
- package/src/styles/AppColors.ts +0 -455
- package/src/styles/AppFonts.ts +0 -26
- package/src/styles/common.ts +0 -209
- package/src/styles/index.ts +0 -1606
- package/src/types/enums.ts +0 -208
- package/src/types/index.ts +0 -34
- package/src/types/interfaces.ts +0 -530
|
@@ -1,45 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const margin = 4;
|
|
10
|
-
const totalCells = numCells + margin * 2;
|
|
11
|
-
const cellSize = size / totalCells;
|
|
12
|
-
return (<View style={[
|
|
13
|
-
styles.container,
|
|
14
|
-
{
|
|
15
|
-
width: size + 20,
|
|
16
|
-
height: size + 20,
|
|
17
|
-
backgroundColor,
|
|
18
|
-
},
|
|
19
|
-
]}>
|
|
20
|
-
<Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
|
|
21
|
-
<Rect width={size} height={size} fill={backgroundColor}/>
|
|
22
|
-
<G>
|
|
23
|
-
{matrix.map((row, r) => row.map((cell, c) => {
|
|
24
|
-
if (!cell)
|
|
25
|
-
return null;
|
|
26
|
-
return (<Rect key={`${r}-${c}`} x={(c + margin) * cellSize} y={(r + margin) * cellSize} width={cellSize + 0.3} height={cellSize + 0.3} fill={color}/>);
|
|
27
|
-
}))}
|
|
28
|
-
</G>
|
|
29
|
-
</Svg>
|
|
30
|
-
</View>);
|
|
31
|
-
};
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
container: {
|
|
34
|
-
padding: 10,
|
|
35
|
-
borderRadius: 14,
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
justifyContent: 'center',
|
|
38
|
-
shadowColor: AppColors.black,
|
|
39
|
-
shadowOffset: { width: 0, height: 3 },
|
|
40
|
-
shadowOpacity: 0.15,
|
|
41
|
-
shadowRadius: 8,
|
|
42
|
-
elevation: 4,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
export default QRCodeView;
|
|
1
|
+
import{useMemo as V}from"react";import{View as G,StyleSheet as M}from"react-native";import O,{Rect as F,G as Q}from"react-native-svg";import{generateQRMatrix as b}from"../helpers/qrGenerator";import{AppColors as j}from"../styles/AppColors";export const QRCodeView=({value:r,size:t=200,color:R="#000000",backgroundColor:i="#FFFFFF"})=>{const n=V(()=>b(r||"http://localhost:8081"),[r]),C=n.length||21,o=4,S=C+o*2,e=t/S;return<G style={[k.container,{width:t+20,height:t+20,backgroundColor:i}]}>
|
|
2
|
+
<O width={t}height={t}viewBox={`0 0 ${t} ${t}`}>
|
|
3
|
+
<F width={t}height={t}fill={i}/>
|
|
4
|
+
<Q>
|
|
5
|
+
{n.map(($,h)=>$.map((v,l)=>v?<F key={`${h}-${l}`}x={(l+o)*e}y={(h+o)*e}width={e+.3}height={e+.3}fill={R}/>:null))}
|
|
6
|
+
</Q>
|
|
7
|
+
</O>
|
|
8
|
+
</G>};const k=M.create({container:{padding:10,borderRadius:14,alignItems:"center",justifyContent:"center",shadowColor:j.black,shadowOffset:{width:0,height:3},shadowOpacity:.15,shadowRadius:8,elevation:4}});export default QRCodeView;
|
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{showDiff && (<TouchableScale onPress={onToggleDiff} hitSlop={12} style={[
|
|
24
|
-
styles.iconSquareBtn,
|
|
25
|
-
isDiffing ? styles.iconSquareBtnActive : null,
|
|
26
|
-
]}>
|
|
27
|
-
<DiffIcon color={isDiffing ? AppColors.skyBlue : AppColors.grayTextWeak} size={14}/>
|
|
28
|
-
</TouchableScale>)}
|
|
29
|
-
<CopyButton value={value} label={title}/>
|
|
30
|
-
<TouchableScale onPress={onToggleExpand} hitSlop={12} style={styles.iconSquareBtn}>
|
|
31
|
-
<View style={{ transform: [{ rotate: isOpen ? '180deg' : '0deg' }] }}>
|
|
32
|
-
<ChevronIcon color={AppColors.grayTextStrong} size={14}/>
|
|
33
|
-
</View>
|
|
34
|
-
</TouchableScale>
|
|
35
|
-
</View>
|
|
36
|
-
</View>
|
|
37
|
-
</View>);
|
|
38
|
-
};
|
|
39
|
-
export default SectionHeader;
|
|
1
|
+
import"react";import{View as S,Pressable as A,Text as H}from"react-native";import{AppColors as o}from"../styles/AppColors";import V from"./CopyButton";import T from"./TouchableScale";import{RequestIcon as C,ResponseIcon as W,HeadersIcon as G,DiffIcon as O,ChevronIcon as D,SearchIcon as F}from"./NetworkIcons";import e from"../styles";const J=({title:r,value:b,expanded:h,onToggleExpand:B,showDiff:q,isDiffing:d,onToggleDiff:w,showSearch:I,isSearching:P,onToggleSearch:R})=>{const k=h===void 0?!1:!!h;return<S style={e.sectionHeaderGradient}>
|
|
2
|
+
<S style={e.sectionHeaderRow}>
|
|
3
|
+
<A style={e.sectionTitleRow}onPress={B}hitSlop={12}>
|
|
4
|
+
{r==="Request"||r==="API"?<C color={o.offerPurple}/>:r==="Response"?<W color={o.greenColor}/>:<G color={o.skyBlue}/>}
|
|
5
|
+
<H style={e.sectionTitle}>{r}</H>
|
|
6
|
+
</A>
|
|
7
|
+
<S style={e.sectionHeaderActions}>
|
|
8
|
+
{I&&<T onPress={R}hitSlop={12}style={[e.iconSquareBtn,P?e.iconSquareBtnActive:null]}>
|
|
9
|
+
<F color={P?o.skyBlue:o.grayTextWeak}size={14}/>
|
|
10
|
+
</T>}
|
|
11
|
+
{q&&<T onPress={w}hitSlop={12}style={[e.iconSquareBtn,d?e.iconSquareBtnActive:null]}>
|
|
12
|
+
<O color={d?o.skyBlue:o.grayTextWeak}size={14}/>
|
|
13
|
+
</T>}
|
|
14
|
+
<V value={b}label={r}/>
|
|
15
|
+
<T onPress={B}hitSlop={12}style={e.iconSquareBtn}>
|
|
16
|
+
<S style={{transform:[{rotate:k?"180deg":"0deg"}]}}>
|
|
17
|
+
<D color={o.grayTextStrong}size={14}/>
|
|
18
|
+
</S>
|
|
19
|
+
</T>
|
|
20
|
+
</S>
|
|
21
|
+
</S>
|
|
22
|
+
</S>};export default J;
|
|
@@ -1,57 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
backgroundColor: `${AppColors.slate200}80`,
|
|
10
|
-
padding: 3,
|
|
11
|
-
borderWidth: 1,
|
|
12
|
-
borderColor: AppColors.dividerColor,
|
|
13
|
-
gap: 3,
|
|
14
|
-
},
|
|
15
|
-
style,
|
|
16
|
-
]}>
|
|
17
|
-
{tabs.map((tab) => {
|
|
18
|
-
const isActive = activeKey === tab.key;
|
|
19
|
-
return (<Pressable key={tab.key} onPress={() => onChange(tab.key)} style={({ pressed }) => [
|
|
20
|
-
{
|
|
21
|
-
flex: 1,
|
|
22
|
-
paddingVertical: 7,
|
|
23
|
-
paddingHorizontal: 6,
|
|
24
|
-
borderRadius: 7,
|
|
25
|
-
backgroundColor: isActive
|
|
26
|
-
? AppColors.brandPurple
|
|
27
|
-
: 'transparent',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
justifyContent: 'center',
|
|
30
|
-
gap: 4.5,
|
|
31
|
-
flexDirection: 'row',
|
|
32
|
-
opacity: pressed ? 0.8 : 1,
|
|
33
|
-
},
|
|
34
|
-
isActive && {
|
|
35
|
-
shadowColor: AppColors.brandPurple,
|
|
36
|
-
shadowOffset: { width: 0, height: 1 },
|
|
37
|
-
shadowOpacity: 0.25,
|
|
38
|
-
shadowRadius: 3,
|
|
39
|
-
elevation: 2,
|
|
40
|
-
},
|
|
41
|
-
]}>
|
|
42
|
-
{tab.icon ? tab.icon(isActive) : null}
|
|
43
|
-
<Text numberOfLines={1} ellipsizeMode="tail" style={{
|
|
44
|
-
flexShrink: 1,
|
|
45
|
-
fontFamily: AppFonts.interBold,
|
|
46
|
-
fontSize: 10.5,
|
|
47
|
-
color: isActive
|
|
48
|
-
? AppColors.white
|
|
49
|
-
: AppColors.grayText,
|
|
50
|
-
letterSpacing: 0.2,
|
|
51
|
-
}}>
|
|
52
|
-
{tab.label}
|
|
53
|
-
</Text>
|
|
54
|
-
</Pressable>);
|
|
55
|
-
})}
|
|
56
|
-
</View>));
|
|
57
|
-
export default SegmentedTabs;
|
|
1
|
+
import d from"react";import{Pressable as C,Text as P,View as R}from"react-native";import{AppColors as o}from"../styles/AppColors";import{AppFonts as S}from"../styles/AppFonts";const T=d.memo(({tabs:i,activeKey:t,onChange:n,style:l})=><R style={[{flexDirection:"row",borderRadius:10,backgroundColor:`${o.slate200}80`,padding:3,borderWidth:1,borderColor:o.dividerColor,gap:3,minWidth:0},l]}>
|
|
2
|
+
{i.map(e=>{const r=t===e.key;return<C key={e.key}onPress={()=>n(e.key)}style={({pressed:a})=>[{flex:1,paddingVertical:7,paddingHorizontal:6,borderRadius:7,backgroundColor:r?o.brandPurple:"transparent",alignItems:"center",justifyContent:"center",gap:4.5,flexDirection:"row",opacity:a?.8:1},r&&{shadowColor:o.brandPurple,shadowOffset:{width:0,height:1},shadowOpacity:.25,shadowRadius:3,elevation:2}]}>
|
|
3
|
+
{e.icon?e.icon(r):null}
|
|
4
|
+
<P numberOfLines={1}ellipsizeMode="tail"style={{flexShrink:1,fontFamily:S.interBold,fontSize:10.5,color:r?o.white:o.grayText,letterSpacing:.2}}>
|
|
5
|
+
{e.label}
|
|
6
|
+
</P>
|
|
7
|
+
</C>})}
|
|
8
|
+
</R>);export default T;
|
|
@@ -1,173 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Animated, StyleSheet, View } from 'react-native';
|
|
3
|
-
import { AppColors } from '../styles/AppColors';
|
|
4
|
-
export const SkeletonPlaceholder = React.memo(function SkeletonPlaceholder({ cardCount = 4, }) {
|
|
5
|
-
const shimmerAnim = useRef(new Animated.Value(0.35)).current;
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const animation = Animated.loop(Animated.sequence([
|
|
8
|
-
Animated.timing(shimmerAnim, {
|
|
9
|
-
toValue: 0.85,
|
|
10
|
-
duration: 750,
|
|
11
|
-
useNativeDriver: false,
|
|
12
|
-
}),
|
|
13
|
-
Animated.timing(shimmerAnim, {
|
|
14
|
-
toValue: 0.35,
|
|
15
|
-
duration: 750,
|
|
16
|
-
useNativeDriver: false,
|
|
17
|
-
}),
|
|
18
|
-
]));
|
|
19
|
-
animation.start();
|
|
20
|
-
return () => animation.stop();
|
|
21
|
-
}, [shimmerAnim]);
|
|
22
|
-
return (<View style={skeletonStyles.container}>
|
|
1
|
+
import B,{useEffect as R,useRef as x}from"react";import{Animated as k,StyleSheet as v,View as S}from"react-native";import{AppColors as w}from"../styles/AppColors";export const SkeletonPlaceholder=B.memo(function({cardCount:C=4}){const b=x(new k.Value(.35)).current;return R(()=>{const f=k.loop(k.sequence([k.timing(b,{toValue:.85,duration:750,useNativeDriver:!1}),k.timing(b,{toValue:.35,duration:750,useNativeDriver:!1})]));return f.start(),()=>f.stop()},[b]),<S style={e.container}>
|
|
23
2
|
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<Animated.View style={[skeletonStyles.iconButtonSkeleton, { opacity: shimmerAnim }]}/>
|
|
32
|
-
</View>
|
|
33
|
-
</View>
|
|
3
|
+
<S style={e.toolbarSkeleton}>
|
|
4
|
+
<k.View style={[e.searchBarSkeleton,{opacity:b}]}/>
|
|
5
|
+
<S style={e.actionButtonsRow}>
|
|
6
|
+
<k.View style={[e.iconButtonSkeleton,{opacity:b}]}/>
|
|
7
|
+
<k.View style={[e.iconButtonSkeleton,{opacity:b}]}/>
|
|
8
|
+
</S>
|
|
9
|
+
</S>
|
|
34
10
|
|
|
35
11
|
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
</
|
|
12
|
+
<S style={e.chipStripSkeleton}>
|
|
13
|
+
<k.View style={[e.chipSkeleton,{width:48,opacity:b}]}/>
|
|
14
|
+
<k.View style={[e.chipSkeleton,{width:68,opacity:b}]}/>
|
|
15
|
+
<k.View style={[e.chipSkeleton,{width:76,opacity:b}]}/>
|
|
16
|
+
<k.View style={[e.chipSkeleton,{width:58,opacity:b}]}/>
|
|
17
|
+
</S>
|
|
42
18
|
|
|
43
19
|
|
|
44
|
-
{Array.from({
|
|
20
|
+
{Array.from({length:C}).map((f,V)=><k.View key={`skeleton_card_${V}`}style={[e.cardSkeleton,{opacity:b}]}>
|
|
45
21
|
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
</
|
|
51
|
-
<
|
|
52
|
-
</
|
|
22
|
+
<S style={e.cardTopRow}>
|
|
23
|
+
<S style={e.badgeGroup}>
|
|
24
|
+
<S style={e.statusBadgeSkeleton}/>
|
|
25
|
+
<S style={e.methodBadgeSkeleton}/>
|
|
26
|
+
</S>
|
|
27
|
+
<S style={e.timeSkeleton}/>
|
|
28
|
+
</S>
|
|
53
29
|
|
|
54
30
|
|
|
55
|
-
<
|
|
56
|
-
<
|
|
31
|
+
<S style={e.urlLineLong}/>
|
|
32
|
+
<S style={e.urlLineShort}/>
|
|
57
33
|
|
|
58
34
|
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
</
|
|
63
|
-
</
|
|
64
|
-
</
|
|
65
|
-
});
|
|
66
|
-
const skeletonStyles = StyleSheet.create({
|
|
67
|
-
container: {
|
|
68
|
-
flex: 1,
|
|
69
|
-
paddingHorizontal: 12,
|
|
70
|
-
paddingTop: 8,
|
|
71
|
-
},
|
|
72
|
-
toolbarSkeleton: {
|
|
73
|
-
flexDirection: 'row',
|
|
74
|
-
alignItems: 'center',
|
|
75
|
-
gap: 8,
|
|
76
|
-
marginBottom: 8,
|
|
77
|
-
},
|
|
78
|
-
searchBarSkeleton: {
|
|
79
|
-
flex: 1,
|
|
80
|
-
height: 36,
|
|
81
|
-
borderRadius: 8,
|
|
82
|
-
backgroundColor: AppColors.graySurface,
|
|
83
|
-
borderWidth: 1,
|
|
84
|
-
borderColor: AppColors.dividerColor,
|
|
85
|
-
},
|
|
86
|
-
actionButtonsRow: {
|
|
87
|
-
flexDirection: 'row',
|
|
88
|
-
gap: 6,
|
|
89
|
-
},
|
|
90
|
-
iconButtonSkeleton: {
|
|
91
|
-
width: 36,
|
|
92
|
-
height: 36,
|
|
93
|
-
borderRadius: 8,
|
|
94
|
-
backgroundColor: AppColors.graySurface,
|
|
95
|
-
borderWidth: 1,
|
|
96
|
-
borderColor: AppColors.dividerColor,
|
|
97
|
-
},
|
|
98
|
-
chipStripSkeleton: {
|
|
99
|
-
flexDirection: 'row',
|
|
100
|
-
gap: 6,
|
|
101
|
-
marginBottom: 10,
|
|
102
|
-
},
|
|
103
|
-
chipSkeleton: {
|
|
104
|
-
height: 24,
|
|
105
|
-
borderRadius: 6,
|
|
106
|
-
backgroundColor: AppColors.graySurface,
|
|
107
|
-
borderWidth: 1,
|
|
108
|
-
borderColor: AppColors.dividerColor,
|
|
109
|
-
},
|
|
110
|
-
cardSkeleton: {
|
|
111
|
-
backgroundColor: AppColors.primaryLight,
|
|
112
|
-
borderRadius: 10,
|
|
113
|
-
padding: 12,
|
|
114
|
-
marginBottom: 8,
|
|
115
|
-
borderWidth: 1,
|
|
116
|
-
borderColor: AppColors.dividerColor,
|
|
117
|
-
},
|
|
118
|
-
cardTopRow: {
|
|
119
|
-
flexDirection: 'row',
|
|
120
|
-
justifyContent: 'space-between',
|
|
121
|
-
alignItems: 'center',
|
|
122
|
-
marginBottom: 8,
|
|
123
|
-
},
|
|
124
|
-
badgeGroup: {
|
|
125
|
-
flexDirection: 'row',
|
|
126
|
-
alignItems: 'center',
|
|
127
|
-
gap: 6,
|
|
128
|
-
},
|
|
129
|
-
statusBadgeSkeleton: {
|
|
130
|
-
width: 38,
|
|
131
|
-
height: 18,
|
|
132
|
-
borderRadius: 4,
|
|
133
|
-
backgroundColor: AppColors.graySurface,
|
|
134
|
-
},
|
|
135
|
-
methodBadgeSkeleton: {
|
|
136
|
-
width: 44,
|
|
137
|
-
height: 18,
|
|
138
|
-
borderRadius: 4,
|
|
139
|
-
backgroundColor: AppColors.graySurface,
|
|
140
|
-
},
|
|
141
|
-
timeSkeleton: {
|
|
142
|
-
width: 48,
|
|
143
|
-
height: 12,
|
|
144
|
-
borderRadius: 4,
|
|
145
|
-
backgroundColor: AppColors.graySurface,
|
|
146
|
-
},
|
|
147
|
-
urlLineLong: {
|
|
148
|
-
height: 13,
|
|
149
|
-
borderRadius: 4,
|
|
150
|
-
backgroundColor: AppColors.graySurface,
|
|
151
|
-
marginBottom: 5,
|
|
152
|
-
width: '90%',
|
|
153
|
-
},
|
|
154
|
-
urlLineShort: {
|
|
155
|
-
height: 11,
|
|
156
|
-
borderRadius: 4,
|
|
157
|
-
backgroundColor: AppColors.graySurface,
|
|
158
|
-
marginBottom: 8,
|
|
159
|
-
width: '55%',
|
|
160
|
-
},
|
|
161
|
-
cardBottomRow: {
|
|
162
|
-
flexDirection: 'row',
|
|
163
|
-
gap: 8,
|
|
164
|
-
marginTop: 2,
|
|
165
|
-
},
|
|
166
|
-
metaPillSkeleton: {
|
|
167
|
-
width: 52,
|
|
168
|
-
height: 14,
|
|
169
|
-
borderRadius: 4,
|
|
170
|
-
backgroundColor: AppColors.graySurface,
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
export default SkeletonPlaceholder;
|
|
35
|
+
<S style={e.cardBottomRow}>
|
|
36
|
+
<S style={e.metaPillSkeleton}/>
|
|
37
|
+
<S style={e.metaPillSkeleton}/>
|
|
38
|
+
</S>
|
|
39
|
+
</k.View>)}
|
|
40
|
+
</S>});const e=v.create({container:{flex:1,paddingHorizontal:12,paddingTop:8},toolbarSkeleton:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:8},searchBarSkeleton:{flex:1,height:36,borderRadius:8,backgroundColor:w.graySurface,borderWidth:1,borderColor:w.dividerColor},actionButtonsRow:{flexDirection:"row",gap:6},iconButtonSkeleton:{width:36,height:36,borderRadius:8,backgroundColor:w.graySurface,borderWidth:1,borderColor:w.dividerColor},chipStripSkeleton:{flexDirection:"row",gap:6,marginBottom:10},chipSkeleton:{height:24,borderRadius:6,backgroundColor:w.graySurface,borderWidth:1,borderColor:w.dividerColor},cardSkeleton:{backgroundColor:w.primaryLight,borderRadius:10,padding:12,marginBottom:8,borderWidth:1,borderColor:w.dividerColor},cardTopRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},badgeGroup:{flexDirection:"row",alignItems:"center",gap:6},statusBadgeSkeleton:{width:38,height:18,borderRadius:4,backgroundColor:w.graySurface},methodBadgeSkeleton:{width:44,height:18,borderRadius:4,backgroundColor:w.graySurface},timeSkeleton:{width:48,height:12,borderRadius:4,backgroundColor:w.graySurface},urlLineLong:{height:13,borderRadius:4,backgroundColor:w.graySurface,marginBottom:5,width:"90%"},urlLineShort:{height:11,borderRadius:4,backgroundColor:w.graySurface,marginBottom:8,width:"55%"},cardBottomRow:{flexDirection:"row",gap:8,marginTop:2},metaPillSkeleton:{width:52,height:14,borderRadius:4,backgroundColor:w.graySurface}});export default SkeletonPlaceholder;
|
|
@@ -1,222 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { View, Text, StyleSheet, PanResponder, } from 'react-native';
|
|
3
|
-
import { AppColors } from '../styles/AppColors';
|
|
4
|
-
import { AppFonts } from '../styles/AppFonts';
|
|
5
|
-
import TouchableScale from './TouchableScale';
|
|
6
|
-
export const Slider = React.memo(({ value, onValueChange, min = 50, max = 90, step = 5, formatLabel = val => `${Math.round(val)}%`, quickPresets = [50, 60, 70, 80, 90], disabled = false, }) => {
|
|
7
|
-
const trackWidthRef = useRef(0);
|
|
8
|
-
const [trackWidth, setTrackWidth] = useState(0);
|
|
9
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
10
|
-
const clampedValue = Math.max(min, Math.min(max, value));
|
|
11
|
-
const percentage = (clampedValue - min) / (max - min || 1);
|
|
12
|
-
const updateValueFromPosition = useCallback((pageX, trackPageX) => {
|
|
13
|
-
if (trackWidthRef.current <= 0)
|
|
14
|
-
return;
|
|
15
|
-
const relativeX = Math.max(0, Math.min(trackWidthRef.current, pageX - trackPageX));
|
|
16
|
-
const rawRatio = relativeX / trackWidthRef.current;
|
|
17
|
-
let newValue = min + rawRatio * (max - min);
|
|
18
|
-
if (step > 0) {
|
|
19
|
-
newValue = Math.round(newValue / step) * step;
|
|
20
|
-
}
|
|
21
|
-
newValue = Math.max(min, Math.min(max, newValue));
|
|
22
|
-
onValueChange(newValue);
|
|
23
|
-
}, [min, max, step, onValueChange]);
|
|
24
|
-
const trackContainerRef = useRef(null);
|
|
25
|
-
const trackPageXRef = useRef(0);
|
|
26
|
-
const measureTrack = useCallback(() => {
|
|
27
|
-
if (trackContainerRef.current) {
|
|
28
|
-
trackContainerRef.current.measure((_x, _y, _width, _height, pageX) => {
|
|
29
|
-
trackPageXRef.current = pageX;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}, []);
|
|
33
|
-
const panResponder = useMemo(() => PanResponder.create({
|
|
34
|
-
onStartShouldSetPanResponder: () => !disabled,
|
|
35
|
-
onMoveShouldSetPanResponder: () => !disabled,
|
|
36
|
-
onPanResponderGrant: (evt) => {
|
|
37
|
-
setIsDragging(true);
|
|
38
|
-
measureTrack();
|
|
39
|
-
updateValueFromPosition(evt.nativeEvent.pageX, trackPageXRef.current);
|
|
40
|
-
},
|
|
41
|
-
onPanResponderMove: (evt, _gestureState) => {
|
|
42
|
-
updateValueFromPosition(evt.nativeEvent.pageX, trackPageXRef.current);
|
|
43
|
-
},
|
|
44
|
-
onPanResponderRelease: () => {
|
|
45
|
-
setIsDragging(false);
|
|
46
|
-
},
|
|
47
|
-
onPanResponderTerminate: () => {
|
|
48
|
-
setIsDragging(false);
|
|
49
|
-
},
|
|
50
|
-
}), [disabled, measureTrack, updateValueFromPosition]);
|
|
51
|
-
const handleLayout = (e) => {
|
|
52
|
-
const w = e.nativeEvent.layout.width;
|
|
53
|
-
trackWidthRef.current = w;
|
|
54
|
-
setTrackWidth(w);
|
|
55
|
-
measureTrack();
|
|
56
|
-
};
|
|
57
|
-
const thumbPosition = percentage * (trackWidth || 0);
|
|
58
|
-
return (<View style={styles.container}>
|
|
1
|
+
import Z,{useRef as I,useState as O,useCallback as L,useMemo as q}from"react";import{View as R,Text as M,StyleSheet as ee,PanResponder as te}from"react-native";import{AppColors as e}from"../styles/AppColors";import{AppFonts as X}from"../styles/AppFonts";import Re from"./TouchableScale";export const Slider=Z.memo(({value:G,onValueChange:S,min:v=50,max:T=90,step:V=5,formatLabel:J=x=>`${Math.round(x)}%`,quickPresets:B=[50,60,70,80,90],disabled:A=!1})=>{const x=I(0),[_,K]=O(0),[j,P]=O(!1),W=Math.max(v,Math.min(T,G)),E=(W-v)/(T-v||1),D=L((r,o)=>{if(x.current<=0)return;const H=Math.max(0,Math.min(x.current,r-o))/x.current;let C=v+H*(T-v);V>0&&(C=Math.round(C/V)*V),C=Math.max(v,Math.min(T,C)),S(C)},[v,T,V,S]),$=I(null),z=I(0),F=L(()=>{$.current&&$.current.measure((r,o,Y,H,C)=>{z.current=C})},[]),N=q(()=>te.create({onStartShouldSetPanResponder:()=>!A,onMoveShouldSetPanResponder:()=>!A,onPanResponderGrant:r=>{P(!0),F(),D(r.nativeEvent.pageX,z.current)},onPanResponderMove:(r,o)=>{D(r.nativeEvent.pageX,z.current)},onPanResponderRelease:()=>{P(!1)},onPanResponderTerminate:()=>{P(!1)}}),[A,F,D]),Q=r=>{const o=r.nativeEvent.layout.width;x.current=o,K(o),F()},U=E*(_||0);return<R style={t.container}>
|
|
59
2
|
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</View>
|
|
68
|
-
<Text style={styles.rangeText}>{max}%</Text>
|
|
69
|
-
</View>
|
|
3
|
+
<R style={t.valueRow}>
|
|
4
|
+
<M style={t.rangeText}>{v}%</M>
|
|
5
|
+
<R style={[t.currentValueBadge,j&&t.currentValueBadgeActive]}>
|
|
6
|
+
<M style={t.currentValueText}>{J(W)}</M>
|
|
7
|
+
</R>
|
|
8
|
+
<M style={t.rangeText}>{T}%</M>
|
|
9
|
+
</R>
|
|
70
10
|
|
|
71
11
|
|
|
72
|
-
<
|
|
12
|
+
<R ref={$}onLayout={Q}{...N.panHandlers}style={t.touchArea}>
|
|
73
13
|
|
|
74
|
-
<
|
|
14
|
+
<R style={t.rail}>
|
|
75
15
|
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
{ width: `${Math.round(percentage * 100)}%` },
|
|
79
|
-
]}/>
|
|
80
|
-
</View>
|
|
16
|
+
<R style={[t.fillBar,{width:`${Math.round(E*100)}%`}]}/>
|
|
17
|
+
</R>
|
|
81
18
|
|
|
82
19
|
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
isDragging && styles.thumbActive,
|
|
89
|
-
]}>
|
|
90
|
-
<View style={styles.thumbCenterDot}/>
|
|
91
|
-
</View>
|
|
92
|
-
</View>
|
|
20
|
+
<R style={[t.thumb,{left:Math.max(0,Math.min((_||0)-24,U-12))},j&&t.thumbActive]}>
|
|
21
|
+
<R style={t.thumbCenterDot}/>
|
|
22
|
+
</R>
|
|
23
|
+
</R>
|
|
93
24
|
|
|
94
25
|
|
|
95
|
-
{
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
styles.presetText,
|
|
104
|
-
isSelected && styles.presetTextActive,
|
|
105
|
-
]}>
|
|
106
|
-
{preset}%
|
|
107
|
-
</Text>
|
|
108
|
-
</TouchableScale>);
|
|
109
|
-
})}
|
|
110
|
-
</View>)}
|
|
111
|
-
</View>);
|
|
112
|
-
});
|
|
113
|
-
const styles = StyleSheet.create({
|
|
114
|
-
container: {
|
|
115
|
-
paddingVertical: 4,
|
|
116
|
-
gap: 8,
|
|
117
|
-
},
|
|
118
|
-
valueRow: {
|
|
119
|
-
flexDirection: 'row',
|
|
120
|
-
alignItems: 'center',
|
|
121
|
-
justifyContent: 'space-between',
|
|
122
|
-
paddingHorizontal: 2,
|
|
123
|
-
},
|
|
124
|
-
rangeText: {
|
|
125
|
-
fontFamily: AppFonts.interMedium,
|
|
126
|
-
fontSize: 11,
|
|
127
|
-
color: AppColors.grayText,
|
|
128
|
-
},
|
|
129
|
-
currentValueBadge: {
|
|
130
|
-
backgroundColor: `${AppColors.purple}1A`,
|
|
131
|
-
borderColor: `${AppColors.purple}33`,
|
|
132
|
-
borderWidth: 1,
|
|
133
|
-
borderRadius: 8,
|
|
134
|
-
paddingHorizontal: 10,
|
|
135
|
-
paddingVertical: 2.5,
|
|
136
|
-
},
|
|
137
|
-
currentValueBadgeActive: {
|
|
138
|
-
backgroundColor: AppColors.purple,
|
|
139
|
-
borderColor: AppColors.purple,
|
|
140
|
-
transform: [{ scale: 1.05 }],
|
|
141
|
-
},
|
|
142
|
-
currentValueText: {
|
|
143
|
-
fontFamily: AppFonts.interBold,
|
|
144
|
-
fontSize: 12,
|
|
145
|
-
color: AppColors.purple,
|
|
146
|
-
},
|
|
147
|
-
touchArea: {
|
|
148
|
-
height: 36,
|
|
149
|
-
justifyContent: 'center',
|
|
150
|
-
position: 'relative',
|
|
151
|
-
},
|
|
152
|
-
rail: {
|
|
153
|
-
height: 8,
|
|
154
|
-
backgroundColor: `${AppColors.grayTextWeak}2B`,
|
|
155
|
-
borderRadius: 4,
|
|
156
|
-
overflow: 'hidden',
|
|
157
|
-
position: 'relative',
|
|
158
|
-
},
|
|
159
|
-
fillBar: {
|
|
160
|
-
height: '100%',
|
|
161
|
-
backgroundColor: AppColors.purple,
|
|
162
|
-
borderRadius: 4,
|
|
163
|
-
},
|
|
164
|
-
thumb: {
|
|
165
|
-
position: 'absolute',
|
|
166
|
-
width: 24,
|
|
167
|
-
height: 24,
|
|
168
|
-
borderRadius: 12,
|
|
169
|
-
backgroundColor: AppColors.white,
|
|
170
|
-
borderWidth: 2.5,
|
|
171
|
-
borderColor: AppColors.purple,
|
|
172
|
-
alignItems: 'center',
|
|
173
|
-
justifyContent: 'center',
|
|
174
|
-
shadowColor: AppColors.black,
|
|
175
|
-
shadowOffset: { width: 0, height: 2 },
|
|
176
|
-
shadowOpacity: 0.18,
|
|
177
|
-
shadowRadius: 3.5,
|
|
178
|
-
elevation: 4,
|
|
179
|
-
},
|
|
180
|
-
thumbActive: {
|
|
181
|
-
transform: [{ scale: 1.15 }],
|
|
182
|
-
shadowOpacity: 0.28,
|
|
183
|
-
shadowRadius: 5,
|
|
184
|
-
elevation: 6,
|
|
185
|
-
borderColor: AppColors.purple,
|
|
186
|
-
},
|
|
187
|
-
thumbCenterDot: {
|
|
188
|
-
width: 6,
|
|
189
|
-
height: 6,
|
|
190
|
-
borderRadius: 3,
|
|
191
|
-
backgroundColor: AppColors.purple,
|
|
192
|
-
},
|
|
193
|
-
presetRow: {
|
|
194
|
-
flexDirection: 'row',
|
|
195
|
-
alignItems: 'center',
|
|
196
|
-
justifyContent: 'space-between',
|
|
197
|
-
gap: 8,
|
|
198
|
-
marginTop: 2,
|
|
199
|
-
},
|
|
200
|
-
presetButton: {
|
|
201
|
-
flex: 1,
|
|
202
|
-
paddingVertical: 5,
|
|
203
|
-
borderRadius: 7,
|
|
204
|
-
alignItems: 'center',
|
|
205
|
-
backgroundColor: AppColors.grayBackground,
|
|
206
|
-
borderWidth: 1,
|
|
207
|
-
borderColor: AppColors.dividerColor,
|
|
208
|
-
},
|
|
209
|
-
presetButtonActive: {
|
|
210
|
-
backgroundColor: `${AppColors.purple}20`,
|
|
211
|
-
borderColor: AppColors.purple,
|
|
212
|
-
},
|
|
213
|
-
presetText: {
|
|
214
|
-
fontFamily: AppFonts.interBold,
|
|
215
|
-
fontSize: 10.5,
|
|
216
|
-
color: AppColors.grayText,
|
|
217
|
-
},
|
|
218
|
-
presetTextActive: {
|
|
219
|
-
color: AppColors.purple,
|
|
220
|
-
},
|
|
221
|
-
});
|
|
222
|
-
export default Slider;
|
|
26
|
+
{B&&B.length>0&&<R style={t.presetRow}>
|
|
27
|
+
{B.map(r=>{const o=Math.round(W)===r;return<Re key={r}onPress={()=>S(r)}style={[t.presetButton,o&&t.presetButtonActive]}>
|
|
28
|
+
<M style={[t.presetText,o&&t.presetTextActive]}>
|
|
29
|
+
{r}%
|
|
30
|
+
</M>
|
|
31
|
+
</Re>})}
|
|
32
|
+
</R>}
|
|
33
|
+
</R>});const t=ee.create({container:{paddingVertical:4,gap:8},valueRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:2},rangeText:{fontFamily:X.interMedium,fontSize:11,color:e.grayText},currentValueBadge:{backgroundColor:`${e.purple}1A`,borderColor:`${e.purple}33`,borderWidth:1,borderRadius:8,paddingHorizontal:10,paddingVertical:2.5},currentValueBadgeActive:{backgroundColor:e.purple,borderColor:e.purple,transform:[{scale:1.05}]},currentValueText:{fontFamily:X.interBold,fontSize:12,color:e.purple},touchArea:{height:36,justifyContent:"center",position:"relative"},rail:{height:8,backgroundColor:`${e.grayTextWeak}2B`,borderRadius:4,overflow:"hidden",position:"relative"},fillBar:{height:"100%",backgroundColor:e.purple,borderRadius:4},thumb:{position:"absolute",width:24,height:24,borderRadius:12,backgroundColor:e.white,borderWidth:2.5,borderColor:e.purple,alignItems:"center",justifyContent:"center",shadowColor:e.black,shadowOffset:{width:0,height:2},shadowOpacity:.18,shadowRadius:3.5,elevation:4},thumbActive:{transform:[{scale:1.15}],shadowOpacity:.28,shadowRadius:5,elevation:6,borderColor:e.purple},thumbCenterDot:{width:6,height:6,borderRadius:3,backgroundColor:e.purple},presetRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,marginTop:2},presetButton:{flex:1,paddingVertical:5,borderRadius:7,alignItems:"center",backgroundColor:e.grayBackground,borderWidth:1,borderColor:e.dividerColor},presetButtonActive:{backgroundColor:`${e.purple}20`,borderColor:e.purple},presetText:{fontFamily:X.interBold,fontSize:10.5,color:e.grayText},presetTextActive:{color:e.purple}});export default Slider;
|