react-native-ensys-camera-x 1.0.7
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/CustomCamera.podspec +20 -0
- package/LICENSE +20 -0
- package/README.md +833 -0
- package/android/build.gradle +135 -0
- package/android/consumer-rules.pro +47 -0
- package/android/src/main/AndroidManifest.xml +72 -0
- package/android/src/main/java/android/print/PdfPrint.java +51 -0
- package/android/src/main/java/com/customcamera/AnimatedImageViewManager.kt +199 -0
- package/android/src/main/java/com/customcamera/AudioPlayerView.kt +322 -0
- package/android/src/main/java/com/customcamera/AudioRecorder.kt +506 -0
- package/android/src/main/java/com/customcamera/BarcodeScannerActivity.kt +361 -0
- package/android/src/main/java/com/customcamera/BlurBackgroundView.kt +199 -0
- package/android/src/main/java/com/customcamera/CacheCleanupManager.kt +386 -0
- package/android/src/main/java/com/customcamera/CameraAspectRatioMode.kt +77 -0
- package/android/src/main/java/com/customcamera/CameraAsset.kt +211 -0
- package/android/src/main/java/com/customcamera/CameraTheme.kt +479 -0
- package/android/src/main/java/com/customcamera/CompressionCacheStore.kt +504 -0
- package/android/src/main/java/com/customcamera/CompressionFileNameUtils.kt +7 -0
- package/android/src/main/java/com/customcamera/CompressionProfile.kt +195 -0
- package/android/src/main/java/com/customcamera/CustomCameraActivity.kt +7291 -0
- package/android/src/main/java/com/customcamera/CustomCameraFileProvider.kt +9 -0
- package/android/src/main/java/com/customcamera/CustomCameraModule.kt +2479 -0
- package/android/src/main/java/com/customcamera/CustomCameraPackage.kt +53 -0
- package/android/src/main/java/com/customcamera/DisplayUtils.kt +9 -0
- package/android/src/main/java/com/customcamera/DocumentPreviewView.kt +846 -0
- package/android/src/main/java/com/customcamera/DrawingView.kt +214 -0
- package/android/src/main/java/com/customcamera/EmojiPickerData.kt +228 -0
- package/android/src/main/java/com/customcamera/FilterStripAdapter.kt +158 -0
- package/android/src/main/java/com/customcamera/GifSupport.kt +215 -0
- package/android/src/main/java/com/customcamera/GlobalAudioPlayer.kt +320 -0
- package/android/src/main/java/com/customcamera/ImageExporter.kt +1394 -0
- package/android/src/main/java/com/customcamera/ImageFormatSupport.kt +163 -0
- package/android/src/main/java/com/customcamera/Localization.kt +206 -0
- package/android/src/main/java/com/customcamera/MediaAdapters.kt +758 -0
- package/android/src/main/java/com/customcamera/MediaCacheManager.kt +782 -0
- package/android/src/main/java/com/customcamera/MediaExportFormats.kt +201 -0
- package/android/src/main/java/com/customcamera/MediaFileIo.kt +310 -0
- package/android/src/main/java/com/customcamera/MediaMetadataStore.kt +494 -0
- package/android/src/main/java/com/customcamera/MediaPreviewEditor.kt +14865 -0
- package/android/src/main/java/com/customcamera/MediaPublisher.kt +423 -0
- package/android/src/main/java/com/customcamera/MediaStorageWorkflow.kt +722 -0
- package/android/src/main/java/com/customcamera/MediaStoreRepository.kt +378 -0
- package/android/src/main/java/com/customcamera/MediaThumbnailView.kt +286 -0
- package/android/src/main/java/com/customcamera/MediaUtils.kt +37 -0
- package/android/src/main/java/com/customcamera/NativeVideoViewManager.kt +845 -0
- package/android/src/main/java/com/customcamera/OfficeDocumentConverter.kt +2791 -0
- package/android/src/main/java/com/customcamera/PendingCaptureCrops.kt +88 -0
- package/android/src/main/java/com/customcamera/PowerPointPreview.kt +4077 -0
- package/android/src/main/java/com/customcamera/RecentPickerStore.kt +74 -0
- package/android/src/main/java/com/customcamera/SecureFileEraser.kt +411 -0
- package/android/src/main/java/com/customcamera/SecureKeyModule.kt +88 -0
- package/android/src/main/java/com/customcamera/SecureMediaDeleter.kt +493 -0
- package/android/src/main/java/com/customcamera/StickerPickerData.kt +107 -0
- package/android/src/main/java/com/customcamera/SvgDrawable.kt +175 -0
- package/android/src/main/java/com/customcamera/SvgIconViewManager.kt +77 -0
- package/android/src/main/java/com/customcamera/TextEntryController.kt +553 -0
- package/android/src/main/java/com/customcamera/ThumbnailLoader.kt +455 -0
- package/android/src/main/java/com/customcamera/UploadService.kt +909 -0
- package/android/src/main/java/com/customcamera/VideoEditUtils.kt +210 -0
- package/android/src/main/java/com/customcamera/VideoRotationTranscoder.kt +1992 -0
- package/android/src/main/java/com/customcamera/gif/AnimatedGifEncoder.kt +473 -0
- package/android/src/main/java/com/customcamera/gif/GifDecoder.kt +690 -0
- package/android/src/main/java/com/customcamera/gif/GifFramesDrawable.kt +160 -0
- package/android/src/main/java/com/customcamera/gif/GifHttp.kt +112 -0
- package/android/src/main/java/com/customcamera/gif/GifImageLoader.kt +186 -0
- package/android/src/main/java/com/customcamera/gif/GifModels.kt +74 -0
- package/android/src/main/java/com/customcamera/gif/GifProvider.kt +49 -0
- package/android/src/main/java/com/customcamera/gif/GifProviders.kt +27 -0
- package/android/src/main/java/com/customcamera/gif/GifRepository.kt +124 -0
- package/android/src/main/java/com/customcamera/gif/GifSafety.kt +33 -0
- package/android/src/main/java/com/customcamera/gif/GiphyGifProvider.kt +146 -0
- package/android/src/main/java/com/customcamera/gif/LZWEncoder.kt +258 -0
- package/android/src/main/java/com/customcamera/gif/NeuQuant.kt +435 -0
- package/android/src/main/java/com/customcamera/gif/TenorGifProvider.kt +147 -0
- package/android/src/main/res/drawable/bg_brush_selected.xml +5 -0
- package/android/src/main/res/drawable/bg_color_swatch.xml +5 -0
- package/android/src/main/res/drawable/bg_editor_toolbar.xml +6 -0
- package/android/src/main/res/drawable/bg_icon_circle.xml +5 -0
- package/android/src/main/res/drawable/bg_icon_circle_light.xml +5 -0
- package/android/src/main/res/drawable/bg_mode_tab_active.xml +6 -0
- package/android/src/main/res/drawable/bg_pill.xml +6 -0
- package/android/src/main/res/drawable/bg_recording_dot.xml +6 -0
- package/android/src/main/res/drawable/bg_selection_badge.xml +8 -0
- package/android/src/main/res/drawable/bg_send_button.xml +5 -0
- package/android/src/main/res/drawable/bg_shutter_inner.xml +5 -0
- package/android/src/main/res/drawable/bg_shutter_recording.xml +6 -0
- package/android/src/main/res/drawable/bg_shutter_ring.xml +8 -0
- package/android/src/main/res/drawable/bg_shutter_video_idle.xml +5 -0
- package/android/src/main/res/drawable/bg_thumbnail.xml +9 -0
- package/android/src/main/res/drawable/ic_aspect_ratio.xml +17 -0
- package/android/src/main/res/drawable/ic_audio.xml +10 -0
- package/android/src/main/res/drawable/ic_back.xml +10 -0
- package/android/src/main/res/drawable/ic_brush_medium.xml +12 -0
- package/android/src/main/res/drawable/ic_brush_thick.xml +12 -0
- package/android/src/main/res/drawable/ic_brush_thin.xml +12 -0
- package/android/src/main/res/drawable/ic_check.xml +17 -0
- package/android/src/main/res/drawable/ic_chevron_down.xml +10 -0
- package/android/src/main/res/drawable/ic_chevron_up.xml +13 -0
- package/android/src/main/res/drawable/ic_clear_drawing.xml +10 -0
- package/android/src/main/res/drawable/ic_close.xml +10 -0
- package/android/src/main/res/drawable/ic_cover.xml +9 -0
- package/android/src/main/res/drawable/ic_crop.xml +10 -0
- package/android/src/main/res/drawable/ic_delete.xml +9 -0
- package/android/src/main/res/drawable/ic_document.xml +10 -0
- package/android/src/main/res/drawable/ic_done.xml +10 -0
- package/android/src/main/res/drawable/ic_download.xml +10 -0
- package/android/src/main/res/drawable/ic_emoji.xml +10 -0
- package/android/src/main/res/drawable/ic_filter.xml +10 -0
- package/android/src/main/res/drawable/ic_flash_auto.xml +7 -0
- package/android/src/main/res/drawable/ic_flash_off.xml +23 -0
- package/android/src/main/res/drawable/ic_flash_on.xml +16 -0
- package/android/src/main/res/drawable/ic_flip.xml +15 -0
- package/android/src/main/res/drawable/ic_gallery.xml +10 -0
- package/android/src/main/res/drawable/ic_gif.xml +24 -0
- package/android/src/main/res/drawable/ic_lock.xml +19 -0
- package/android/src/main/res/drawable/ic_lock_open.xml +22 -0
- package/android/src/main/res/drawable/ic_marker.xml +10 -0
- package/android/src/main/res/drawable/ic_more_vert.xml +18 -0
- package/android/src/main/res/drawable/ic_overlay_close.xml +19 -0
- package/android/src/main/res/drawable/ic_overlay_resize.xml +18 -0
- package/android/src/main/res/drawable/ic_pause.xml +10 -0
- package/android/src/main/res/drawable/ic_photo_mode.xml +10 -0
- package/android/src/main/res/drawable/ic_play.xml +10 -0
- package/android/src/main/res/drawable/ic_redo.xml +10 -0
- package/android/src/main/res/drawable/ic_rotate.xml +9 -0
- package/android/src/main/res/drawable/ic_send.xml +10 -0
- package/android/src/main/res/drawable/ic_share.xml +10 -0
- package/android/src/main/res/drawable/ic_stat_upload.xml +10 -0
- package/android/src/main/res/drawable/ic_sticker.xml +24 -0
- package/android/src/main/res/drawable/ic_text.xml +10 -0
- package/android/src/main/res/drawable/ic_text_align_center.xml +11 -0
- package/android/src/main/res/drawable/ic_text_align_left.xml +11 -0
- package/android/src/main/res/drawable/ic_text_align_right.xml +11 -0
- package/android/src/main/res/drawable/ic_text_bg.xml +11 -0
- package/android/src/main/res/drawable/ic_trim.xml +23 -0
- package/android/src/main/res/drawable/ic_undo.xml +10 -0
- package/android/src/main/res/drawable/ic_video_mode.xml +10 -0
- package/android/src/main/res/drawable/ic_video_note.xml +13 -0
- package/android/src/main/res/drawable/ic_volume_off.xml +9 -0
- package/android/src/main/res/drawable/ic_volume_on.xml +9 -0
- package/android/src/main/res/drawable/sticker_heart.xml +9 -0
- package/android/src/main/res/drawable/sticker_smile.xml +9 -0
- package/android/src/main/res/drawable/sticker_star.xml +9 -0
- package/android/src/main/res/drawable/sticker_thumbsup.xml +9 -0
- package/android/src/main/res/values/colors.xml +34 -0
- package/android/src/main/res/values/ids.xml +15 -0
- package/android/src/main/res/values/strings.xml +15 -0
- package/android/src/main/res/values/styles.xml +20 -0
- package/android/src/main/res/xml/file_paths.xml +34 -0
- package/ios/CustomCamera.h +5 -0
- package/ios/CustomCamera.mm +214 -0
- package/lib/module/AudioPlayerContext.js +233 -0
- package/lib/module/AudioPlayerContext.js.map +1 -0
- package/lib/module/CameraPreview.js +304 -0
- package/lib/module/CameraPreview.js.map +1 -0
- package/lib/module/NativeAnimatedImageView.js +41 -0
- package/lib/module/NativeAnimatedImageView.js.map +1 -0
- package/lib/module/NativeAudioPlayerView.js +33 -0
- package/lib/module/NativeAudioPlayerView.js.map +1 -0
- package/lib/module/NativeBlurView.js +35 -0
- package/lib/module/NativeBlurView.js.map +1 -0
- package/lib/module/NativeCustomCamera.js +128 -0
- package/lib/module/NativeCustomCamera.js.map +1 -0
- package/lib/module/NativeCustomCamera.web.js +143 -0
- package/lib/module/NativeCustomCamera.web.js.map +1 -0
- package/lib/module/NativeCustomVideoView.js +5 -0
- package/lib/module/NativeCustomVideoView.js.map +1 -0
- package/lib/module/NativeDocumentPreviewView.js +156 -0
- package/lib/module/NativeDocumentPreviewView.js.map +1 -0
- package/lib/module/NativeMediaThumbnailView.js +110 -0
- package/lib/module/NativeMediaThumbnailView.js.map +1 -0
- package/lib/module/NativeSvgIcon.js +32 -0
- package/lib/module/NativeSvgIcon.js.map +1 -0
- package/lib/module/ResponsivePreviewContainer.js +171 -0
- package/lib/module/ResponsivePreviewContainer.js.map +1 -0
- package/lib/module/accessibility.js +61 -0
- package/lib/module/accessibility.js.map +1 -0
- package/lib/module/config.js +352 -0
- package/lib/module/config.js.map +1 -0
- package/lib/module/cpuOptimization.js +296 -0
- package/lib/module/cpuOptimization.js.map +1 -0
- package/lib/module/db/DatabaseManager.js +191 -0
- package/lib/module/db/DatabaseManager.js.map +1 -0
- package/lib/module/db/MediaMapper.js +284 -0
- package/lib/module/db/MediaMapper.js.map +1 -0
- package/lib/module/db/MediaRepository.js +242 -0
- package/lib/module/db/MediaRepository.js.map +1 -0
- package/lib/module/db/index.js +41 -0
- package/lib/module/db/index.js.map +1 -0
- package/lib/module/db/migrations.js +180 -0
- package/lib/module/db/migrations.js.map +1 -0
- package/lib/module/db/react-native-sqlcipher.d.js +2 -0
- package/lib/module/db/react-native-sqlcipher.d.js.map +1 -0
- package/lib/module/db/secureKey.js +87 -0
- package/lib/module/db/secureKey.js.map +1 -0
- package/lib/module/db/types.js +57 -0
- package/lib/module/db/types.js.map +1 -0
- package/lib/module/db/useMediaDatabase.js +123 -0
- package/lib/module/db/useMediaDatabase.js.map +1 -0
- package/lib/module/defaultIcons.js +2259 -0
- package/lib/module/defaultIcons.js.map +1 -0
- package/lib/module/deviceCapabilities.js +408 -0
- package/lib/module/deviceCapabilities.js.map +1 -0
- package/lib/module/errors.js +267 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/iconConfig.js +796 -0
- package/lib/module/iconConfig.js.map +1 -0
- package/lib/module/icons.js +514 -0
- package/lib/module/icons.js.map +1 -0
- package/lib/module/index.js +251 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/jest-globals.d.js +2 -0
- package/lib/module/jest-globals.d.js.map +1 -0
- package/lib/module/library/MediaLibrary.js +107 -0
- package/lib/module/library/MediaLibrary.js.map +1 -0
- package/lib/module/library/MediaLibraryScreen.js +2597 -0
- package/lib/module/library/MediaLibraryScreen.js.map +1 -0
- package/lib/module/library/components/AudioPreview.js +74 -0
- package/lib/module/library/components/AudioPreview.js.map +1 -0
- package/lib/module/library/components/DocumentPreview.js +331 -0
- package/lib/module/library/components/DocumentPreview.js.map +1 -0
- package/lib/module/library/components/ExpandableFab.js +343 -0
- package/lib/module/library/components/ExpandableFab.js.map +1 -0
- package/lib/module/library/components/FileTiles.js +251 -0
- package/lib/module/library/components/FileTiles.js.map +1 -0
- package/lib/module/library/components/ImagePreview.js +70 -0
- package/lib/module/library/components/ImagePreview.js.map +1 -0
- package/lib/module/library/components/MediaMetadataHeader.js +175 -0
- package/lib/module/library/components/MediaMetadataHeader.js.map +1 -0
- package/lib/module/library/components/RecordAudioScreen.js +816 -0
- package/lib/module/library/components/RecordAudioScreen.js.map +1 -0
- package/lib/module/library/components/VideoPreview.js +453 -0
- package/lib/module/library/components/VideoPreview.js.map +1 -0
- package/lib/module/library/components/ViewerCounter.js +55 -0
- package/lib/module/library/components/ViewerCounter.js.map +1 -0
- package/lib/module/library/compressionEstimate.js +507 -0
- package/lib/module/library/compressionEstimate.js.map +1 -0
- package/lib/module/library/fileMetadata.js +196 -0
- package/lib/module/library/fileMetadata.js.map +1 -0
- package/lib/module/library/index.js +42 -0
- package/lib/module/library/index.js.map +1 -0
- package/lib/module/library/libraryIconRegistry.js +69 -0
- package/lib/module/library/libraryIconRegistry.js.map +1 -0
- package/lib/module/library/libraryIcons.js +858 -0
- package/lib/module/library/libraryIcons.js.map +1 -0
- package/lib/module/library/localizedFormat.js +181 -0
- package/lib/module/library/localizedFormat.js.map +1 -0
- package/lib/module/library/palette.js +225 -0
- package/lib/module/library/palette.js.map +1 -0
- package/lib/module/library/responsive.js +53 -0
- package/lib/module/library/responsive.js.map +1 -0
- package/lib/module/locales.js +416 -0
- package/lib/module/locales.js.map +1 -0
- package/lib/module/localization.js +1064 -0
- package/lib/module/localization.js.map +1 -0
- package/lib/module/logger.js +20 -0
- package/lib/module/logger.js.map +1 -0
- package/lib/module/lowMemoryCache.js +206 -0
- package/lib/module/lowMemoryCache.js.map +1 -0
- package/lib/module/mediaHistory.js +33 -0
- package/lib/module/mediaHistory.js.map +1 -0
- package/lib/module/mediaStorageService.js +402 -0
- package/lib/module/mediaStorageService.js.map +1 -0
- package/lib/module/memory.js +79 -0
- package/lib/module/memory.js.map +1 -0
- package/lib/module/nativeActions.js +307 -0
- package/lib/module/nativeActions.js.map +1 -0
- package/lib/module/nativeComponentSupport.js +61 -0
- package/lib/module/nativeComponentSupport.js.map +1 -0
- package/lib/module/networkPerformance.js +24 -0
- package/lib/module/networkPerformance.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/performance.js +104 -0
- package/lib/module/performance.js.map +1 -0
- package/lib/module/performanceMonitor.js +155 -0
- package/lib/module/performanceMonitor.js.map +1 -0
- package/lib/module/permissions.js +370 -0
- package/lib/module/permissions.js.map +1 -0
- package/lib/module/rendering.js +40 -0
- package/lib/module/rendering.js.map +1 -0
- package/lib/module/security.js +18 -0
- package/lib/module/security.js.map +1 -0
- package/lib/module/state.js +266 -0
- package/lib/module/state.js.map +1 -0
- package/lib/module/storage.js +400 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/theme.js +390 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +115 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/validation.js +288 -0
- package/lib/module/validation.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/AudioPlayerContext.d.ts +27 -0
- package/lib/typescript/src/AudioPlayerContext.d.ts.map +1 -0
- package/lib/typescript/src/CameraPreview.d.ts +13 -0
- package/lib/typescript/src/CameraPreview.d.ts.map +1 -0
- package/lib/typescript/src/NativeAnimatedImageView.d.ts +33 -0
- package/lib/typescript/src/NativeAnimatedImageView.d.ts.map +1 -0
- package/lib/typescript/src/NativeAudioPlayerView.d.ts +12 -0
- package/lib/typescript/src/NativeAudioPlayerView.d.ts.map +1 -0
- package/lib/typescript/src/NativeBlurView.d.ts +12 -0
- package/lib/typescript/src/NativeBlurView.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomCamera.d.ts +167 -0
- package/lib/typescript/src/NativeCustomCamera.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomCamera.web.d.ts +47 -0
- package/lib/typescript/src/NativeCustomCamera.web.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomVideoView.d.ts +30 -0
- package/lib/typescript/src/NativeCustomVideoView.d.ts.map +1 -0
- package/lib/typescript/src/NativeDocumentPreviewView.d.ts +48 -0
- package/lib/typescript/src/NativeDocumentPreviewView.d.ts.map +1 -0
- package/lib/typescript/src/NativeMediaThumbnailView.d.ts +54 -0
- package/lib/typescript/src/NativeMediaThumbnailView.d.ts.map +1 -0
- package/lib/typescript/src/NativeSvgIcon.d.ts +25 -0
- package/lib/typescript/src/NativeSvgIcon.d.ts.map +1 -0
- package/lib/typescript/src/ResponsivePreviewContainer.d.ts +92 -0
- package/lib/typescript/src/ResponsivePreviewContainer.d.ts.map +1 -0
- package/lib/typescript/src/accessibility.d.ts +20 -0
- package/lib/typescript/src/accessibility.d.ts.map +1 -0
- package/lib/typescript/src/config.d.ts +145 -0
- package/lib/typescript/src/config.d.ts.map +1 -0
- package/lib/typescript/src/cpuOptimization.d.ts +63 -0
- package/lib/typescript/src/cpuOptimization.d.ts.map +1 -0
- package/lib/typescript/src/db/DatabaseManager.d.ts +48 -0
- package/lib/typescript/src/db/DatabaseManager.d.ts.map +1 -0
- package/lib/typescript/src/db/MediaMapper.d.ts +77 -0
- package/lib/typescript/src/db/MediaMapper.d.ts.map +1 -0
- package/lib/typescript/src/db/MediaRepository.d.ts +66 -0
- package/lib/typescript/src/db/MediaRepository.d.ts.map +1 -0
- package/lib/typescript/src/db/index.d.ts +23 -0
- package/lib/typescript/src/db/index.d.ts.map +1 -0
- package/lib/typescript/src/db/migrations.d.ts +31 -0
- package/lib/typescript/src/db/migrations.d.ts.map +1 -0
- package/lib/typescript/src/db/secureKey.d.ts +10 -0
- package/lib/typescript/src/db/secureKey.d.ts.map +1 -0
- package/lib/typescript/src/db/types.d.ts +115 -0
- package/lib/typescript/src/db/types.d.ts.map +1 -0
- package/lib/typescript/src/db/useMediaDatabase.d.ts +41 -0
- package/lib/typescript/src/db/useMediaDatabase.d.ts.map +1 -0
- package/lib/typescript/src/defaultIcons.d.ts +139 -0
- package/lib/typescript/src/defaultIcons.d.ts.map +1 -0
- package/lib/typescript/src/deviceCapabilities.d.ts +92 -0
- package/lib/typescript/src/deviceCapabilities.d.ts.map +1 -0
- package/lib/typescript/src/errors.d.ts +95 -0
- package/lib/typescript/src/errors.d.ts.map +1 -0
- package/lib/typescript/src/iconConfig.d.ts +176 -0
- package/lib/typescript/src/iconConfig.d.ts.map +1 -0
- package/lib/typescript/src/icons.d.ts +217 -0
- package/lib/typescript/src/icons.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +104 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/library/MediaLibrary.d.ts +57 -0
- package/lib/typescript/src/library/MediaLibrary.d.ts.map +1 -0
- package/lib/typescript/src/library/MediaLibraryScreen.d.ts +51 -0
- package/lib/typescript/src/library/MediaLibraryScreen.d.ts.map +1 -0
- package/lib/typescript/src/library/components/AudioPreview.d.ts +6 -0
- package/lib/typescript/src/library/components/AudioPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/DocumentPreview.d.ts +10 -0
- package/lib/typescript/src/library/components/DocumentPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ExpandableFab.d.ts +39 -0
- package/lib/typescript/src/library/components/ExpandableFab.d.ts.map +1 -0
- package/lib/typescript/src/library/components/FileTiles.d.ts +8 -0
- package/lib/typescript/src/library/components/FileTiles.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ImagePreview.d.ts +5 -0
- package/lib/typescript/src/library/components/ImagePreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts +16 -0
- package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts.map +1 -0
- package/lib/typescript/src/library/components/RecordAudioScreen.d.ts +8 -0
- package/lib/typescript/src/library/components/RecordAudioScreen.d.ts.map +1 -0
- package/lib/typescript/src/library/components/VideoPreview.d.ts +20 -0
- package/lib/typescript/src/library/components/VideoPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ViewerCounter.d.ts +13 -0
- package/lib/typescript/src/library/components/ViewerCounter.d.ts.map +1 -0
- package/lib/typescript/src/library/compressionEstimate.d.ts +313 -0
- package/lib/typescript/src/library/compressionEstimate.d.ts.map +1 -0
- package/lib/typescript/src/library/fileMetadata.d.ts +33 -0
- package/lib/typescript/src/library/fileMetadata.d.ts.map +1 -0
- package/lib/typescript/src/library/index.d.ts +40 -0
- package/lib/typescript/src/library/index.d.ts.map +1 -0
- package/lib/typescript/src/library/libraryIconRegistry.d.ts +35 -0
- package/lib/typescript/src/library/libraryIconRegistry.d.ts.map +1 -0
- package/lib/typescript/src/library/libraryIcons.d.ts +85 -0
- package/lib/typescript/src/library/libraryIcons.d.ts.map +1 -0
- package/lib/typescript/src/library/localizedFormat.d.ts +49 -0
- package/lib/typescript/src/library/localizedFormat.d.ts.map +1 -0
- package/lib/typescript/src/library/palette.d.ts +104 -0
- package/lib/typescript/src/library/palette.d.ts.map +1 -0
- package/lib/typescript/src/library/responsive.d.ts +15 -0
- package/lib/typescript/src/library/responsive.d.ts.map +1 -0
- package/lib/typescript/src/locales.d.ts +103 -0
- package/lib/typescript/src/locales.d.ts.map +1 -0
- package/lib/typescript/src/localization.d.ts +1051 -0
- package/lib/typescript/src/localization.d.ts.map +1 -0
- package/lib/typescript/src/logger.d.ts +4 -0
- package/lib/typescript/src/logger.d.ts.map +1 -0
- package/lib/typescript/src/lowMemoryCache.d.ts +64 -0
- package/lib/typescript/src/lowMemoryCache.d.ts.map +1 -0
- package/lib/typescript/src/mediaHistory.d.ts +3 -0
- package/lib/typescript/src/mediaHistory.d.ts.map +1 -0
- package/lib/typescript/src/mediaStorageService.d.ts +155 -0
- package/lib/typescript/src/mediaStorageService.d.ts.map +1 -0
- package/lib/typescript/src/memory.d.ts +21 -0
- package/lib/typescript/src/memory.d.ts.map +1 -0
- package/lib/typescript/src/nativeActions.d.ts +174 -0
- package/lib/typescript/src/nativeActions.d.ts.map +1 -0
- package/lib/typescript/src/nativeComponentSupport.d.ts +30 -0
- package/lib/typescript/src/nativeComponentSupport.d.ts.map +1 -0
- package/lib/typescript/src/networkPerformance.d.ts +12 -0
- package/lib/typescript/src/networkPerformance.d.ts.map +1 -0
- package/lib/typescript/src/performance.d.ts +32 -0
- package/lib/typescript/src/performance.d.ts.map +1 -0
- package/lib/typescript/src/performanceMonitor.d.ts +45 -0
- package/lib/typescript/src/performanceMonitor.d.ts.map +1 -0
- package/lib/typescript/src/permissions.d.ts +132 -0
- package/lib/typescript/src/permissions.d.ts.map +1 -0
- package/lib/typescript/src/rendering.d.ts +9 -0
- package/lib/typescript/src/rendering.d.ts.map +1 -0
- package/lib/typescript/src/security.d.ts +6 -0
- package/lib/typescript/src/security.d.ts.map +1 -0
- package/lib/typescript/src/state.d.ts +102 -0
- package/lib/typescript/src/state.d.ts.map +1 -0
- package/lib/typescript/src/storage.d.ts +117 -0
- package/lib/typescript/src/storage.d.ts.map +1 -0
- package/lib/typescript/src/theme.d.ts +15 -0
- package/lib/typescript/src/theme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +802 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +50 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/validation.d.ts +52 -0
- package/lib/typescript/src/validation.d.ts.map +1 -0
- package/package.json +204 -0
- package/react-native.config.js +17 -0
- package/src/AudioPlayerContext.tsx +220 -0
- package/src/CameraPreview.tsx +352 -0
- package/src/NativeAnimatedImageView.tsx +71 -0
- package/src/NativeAudioPlayerView.tsx +39 -0
- package/src/NativeBlurView.tsx +40 -0
- package/src/NativeCustomCamera.ts +305 -0
- package/src/NativeCustomCamera.web.ts +192 -0
- package/src/NativeCustomVideoView.ts +30 -0
- package/src/NativeDocumentPreviewView.tsx +196 -0
- package/src/NativeMediaThumbnailView.tsx +167 -0
- package/src/NativeSvgIcon.tsx +46 -0
- package/src/ResponsivePreviewContainer.tsx +227 -0
- package/src/accessibility.ts +80 -0
- package/src/config.ts +406 -0
- package/src/cpuOptimization.ts +365 -0
- package/src/db/DatabaseManager.ts +212 -0
- package/src/db/MediaMapper.ts +377 -0
- package/src/db/MediaRepository.ts +313 -0
- package/src/db/index.ts +73 -0
- package/src/db/migrations.ts +222 -0
- package/src/db/react-native-sqlcipher.d.ts +76 -0
- package/src/db/secureKey.ts +100 -0
- package/src/db/types.ts +123 -0
- package/src/db/useMediaDatabase.ts +191 -0
- package/src/defaultIcons.tsx +2390 -0
- package/src/deviceCapabilities.ts +438 -0
- package/src/errors.ts +350 -0
- package/src/iconConfig.tsx +962 -0
- package/src/icons.tsx +788 -0
- package/src/index.tsx +763 -0
- package/src/jest-globals.d.ts +9 -0
- package/src/library/MediaLibrary.tsx +141 -0
- package/src/library/MediaLibraryScreen.tsx +3003 -0
- package/src/library/components/AudioPreview.tsx +73 -0
- package/src/library/components/DocumentPreview.tsx +361 -0
- package/src/library/components/ExpandableFab.tsx +342 -0
- package/src/library/components/FileTiles.tsx +252 -0
- package/src/library/components/ImagePreview.tsx +72 -0
- package/src/library/components/MediaMetadataHeader.tsx +208 -0
- package/src/library/components/RecordAudioScreen.tsx +845 -0
- package/src/library/components/VideoPreview.tsx +478 -0
- package/src/library/components/ViewerCounter.tsx +71 -0
- package/src/library/compressionEstimate.ts +662 -0
- package/src/library/fileMetadata.ts +212 -0
- package/src/library/index.ts +66 -0
- package/src/library/libraryIconRegistry.tsx +86 -0
- package/src/library/libraryIcons.tsx +928 -0
- package/src/library/localizedFormat.ts +207 -0
- package/src/library/palette.ts +281 -0
- package/src/library/responsive.ts +49 -0
- package/src/locales.ts +381 -0
- package/src/localization.ts +1947 -0
- package/src/logger.ts +20 -0
- package/src/lowMemoryCache.ts +218 -0
- package/src/mediaHistory.ts +42 -0
- package/src/mediaStorageService.ts +546 -0
- package/src/memory.ts +102 -0
- package/src/nativeActions.ts +422 -0
- package/src/nativeComponentSupport.ts +60 -0
- package/src/networkPerformance.ts +30 -0
- package/src/performance.ts +137 -0
- package/src/performanceMonitor.ts +219 -0
- package/src/permissions.ts +403 -0
- package/src/rendering.ts +47 -0
- package/src/security.ts +19 -0
- package/src/state.ts +333 -0
- package/src/storage.ts +453 -0
- package/src/theme.tsx +467 -0
- package/src/types.ts +946 -0
- package/src/utils.ts +177 -0
- package/src/validation.ts +372 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import React, { useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
Text,
|
|
7
|
+
ActivityIndicator,
|
|
8
|
+
Dimensions,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
import { openCameraPicker } from './index';
|
|
12
|
+
import type { CameraAsset, CameraThemeConfig } from './types';
|
|
13
|
+
import {
|
|
14
|
+
ResponsivePreviewContainer,
|
|
15
|
+
calcPreviewDimensions,
|
|
16
|
+
} from './ResponsivePreviewContainer';
|
|
17
|
+
import { useCameraTheme } from './theme';
|
|
18
|
+
import { useCameraLocalization } from './localization';
|
|
19
|
+
import { RenderIcon } from './icons';
|
|
20
|
+
|
|
21
|
+
interface CameraPreviewProps {
|
|
22
|
+
onCapture: (assets: CameraAsset[]) => void;
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
/** Override aspect ratio; defaults to WhatsApp-like 720:1165 */
|
|
25
|
+
aspectRatio?: number;
|
|
26
|
+
/** Maximum number of items that can be selected. 0 or undefined = unlimited. */
|
|
27
|
+
selectionLimit?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Stable camera-preview aspect ratio locked once for the lifetime of this
|
|
31
|
+
* component instance. All captures share this value so every asset arrives
|
|
32
|
+
* at EditingScreen with identical framing metadata. */
|
|
33
|
+
const LOCKED_ASPECT_RATIO = (() => {
|
|
34
|
+
const { width: w, height: h } = Dimensions.get('window');
|
|
35
|
+
const { aspectRatio } = calcPreviewDimensions(w, h);
|
|
36
|
+
return aspectRatio;
|
|
37
|
+
})();
|
|
38
|
+
|
|
39
|
+
export const CameraPreview: React.FC<CameraPreviewProps> = ({
|
|
40
|
+
onCapture,
|
|
41
|
+
onClose,
|
|
42
|
+
aspectRatio = LOCKED_ASPECT_RATIO,
|
|
43
|
+
selectionLimit,
|
|
44
|
+
}) => {
|
|
45
|
+
const [isCapturing, setIsCapturing] = useState(false);
|
|
46
|
+
const [showNativeCamera, setShowNativeCamera] = useState(false);
|
|
47
|
+
const [mediaType, setMediaType] = useState<'photo' | 'video'>('photo');
|
|
48
|
+
const theme = useCameraTheme();
|
|
49
|
+
const { t, isRtl, writingDirectionStyle } = useCameraLocalization();
|
|
50
|
+
|
|
51
|
+
// Every render recomputes preview dimensions from the STABLE locked
|
|
52
|
+
// aspect ratio; no stale per-capture state can drift.
|
|
53
|
+
const { width: previewW, height: previewH } = useMemo(() => {
|
|
54
|
+
const { width: screenW, height: screenH } = Dimensions.get('window');
|
|
55
|
+
return calcPreviewDimensions(screenW, screenH);
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const handleCaptureFromNativeCamera = useCallback(async () => {
|
|
59
|
+
try {
|
|
60
|
+
setIsCapturing(true);
|
|
61
|
+
setShowNativeCamera(true);
|
|
62
|
+
|
|
63
|
+
const result = await openCameraPicker({
|
|
64
|
+
mediaTypes: mediaType,
|
|
65
|
+
selectionLimit: selectionLimit ?? 0,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
if (!result.cancelled && result.assets && result.assets.length > 0) {
|
|
69
|
+
const capturedWidth = previewW;
|
|
70
|
+
const capturedHeight = previewH;
|
|
71
|
+
|
|
72
|
+
const processedAssets: CameraAsset[] = result.assets.map((asset) => ({
|
|
73
|
+
id: asset.id || Date.now().toString(),
|
|
74
|
+
uri: asset.uri || '',
|
|
75
|
+
type: asset.type || 'photo',
|
|
76
|
+
width: capturedWidth,
|
|
77
|
+
height: capturedHeight,
|
|
78
|
+
fileName:
|
|
79
|
+
asset.fileName ||
|
|
80
|
+
(asset.type === 'video'
|
|
81
|
+
? `video_${Date.now()}.mp4`
|
|
82
|
+
: `photo_${Date.now()}.jpg`),
|
|
83
|
+
dateTaken: asset.dateTaken || Date.now(),
|
|
84
|
+
// Use the native capture's previewAspectRatio (set by CustomCameraActivity)
|
|
85
|
+
// which reflects the actual aspect ratio used during capture (including FULL mode),
|
|
86
|
+
// rather than the fixed LOCKED_ASPECT_RATIO. This ensures the editor uses the
|
|
87
|
+
// exact same framing as the capture screen.
|
|
88
|
+
previewAspectRatio: asset.previewAspectRatio ?? aspectRatio,
|
|
89
|
+
needsThumbnail: asset.needsThumbnail || false,
|
|
90
|
+
mimeType: asset.mimeType,
|
|
91
|
+
caption: asset.caption,
|
|
92
|
+
duration: asset.duration,
|
|
93
|
+
size: asset.size,
|
|
94
|
+
location: asset.location,
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
onCapture(processedAssets);
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('Error capturing from native camera:', error);
|
|
101
|
+
} finally {
|
|
102
|
+
setIsCapturing(false);
|
|
103
|
+
setShowNativeCamera(false);
|
|
104
|
+
}
|
|
105
|
+
}, [previewW, previewH, mediaType, onCapture, aspectRatio]);
|
|
106
|
+
|
|
107
|
+
const cameraPreviewTheme = theme.components.cameraPreview;
|
|
108
|
+
const styles = useMemo(() => createCameraPreviewStyles(theme), [theme]);
|
|
109
|
+
|
|
110
|
+
if (showNativeCamera) {
|
|
111
|
+
return (
|
|
112
|
+
<ResponsivePreviewContainer width={previewW} height={previewH}>
|
|
113
|
+
<ActivityIndicator size="large" color={cameraPreviewTheme.loadingText} />
|
|
114
|
+
<Text
|
|
115
|
+
style={[
|
|
116
|
+
styles.loadingText,
|
|
117
|
+
writingDirectionStyle,
|
|
118
|
+
{ color: cameraPreviewTheme.loadingText },
|
|
119
|
+
]}
|
|
120
|
+
>
|
|
121
|
+
{t('openingCamera')}
|
|
122
|
+
</Text>
|
|
123
|
+
</ResponsivePreviewContainer>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<ResponsivePreviewContainer width={previewW} height={previewH}>
|
|
129
|
+
{/* Camera preview placeholder – shows what the capture area looks like */}
|
|
130
|
+
<View
|
|
131
|
+
style={[
|
|
132
|
+
styles.cameraPlaceholder,
|
|
133
|
+
{ backgroundColor: cameraPreviewTheme.background },
|
|
134
|
+
]}
|
|
135
|
+
>
|
|
136
|
+
<View
|
|
137
|
+
style={[styles.cameraOverlay, { backgroundColor: cameraPreviewTheme.overlay }]}
|
|
138
|
+
/>
|
|
139
|
+
<Text
|
|
140
|
+
style={[
|
|
141
|
+
styles.cameraPlaceholderText,
|
|
142
|
+
writingDirectionStyle,
|
|
143
|
+
{ color: cameraPreviewTheme.placeholderText },
|
|
144
|
+
]}
|
|
145
|
+
>
|
|
146
|
+
{mediaType === 'photo' ? t('photoMode') : t('videoMode')}
|
|
147
|
+
</Text>
|
|
148
|
+
<View
|
|
149
|
+
style={[
|
|
150
|
+
styles.modeIndicator,
|
|
151
|
+
isRtl ? styles.modeIndicatorRtl : styles.modeIndicatorLtr,
|
|
152
|
+
{ backgroundColor: cameraPreviewTheme.modeIndicatorBackground },
|
|
153
|
+
]}
|
|
154
|
+
>
|
|
155
|
+
<View style={styles.modeIndicatorContent}>
|
|
156
|
+
<RenderIcon
|
|
157
|
+
name={mediaType === 'photo' ? 'camera' : 'video'}
|
|
158
|
+
size={cameraPreviewTheme.modeIndicatorIconSize}
|
|
159
|
+
color={cameraPreviewTheme.modeIndicatorText}
|
|
160
|
+
/>
|
|
161
|
+
</View>
|
|
162
|
+
</View>
|
|
163
|
+
</View>
|
|
164
|
+
|
|
165
|
+
{/* Controls */}
|
|
166
|
+
<View
|
|
167
|
+
style={[
|
|
168
|
+
styles.controlsContainer,
|
|
169
|
+
{ flexDirection: isRtl ? 'row-reverse' : 'row' },
|
|
170
|
+
]}
|
|
171
|
+
>
|
|
172
|
+
<TouchableOpacity
|
|
173
|
+
style={[
|
|
174
|
+
styles.controlButton,
|
|
175
|
+
{ backgroundColor: cameraPreviewTheme.controlButtonBackground },
|
|
176
|
+
]}
|
|
177
|
+
disabled={isCapturing}
|
|
178
|
+
accessibilityLabel={t('toggleFlashlight')}
|
|
179
|
+
>
|
|
180
|
+
<RenderIcon name="flash_auto" size={cameraPreviewTheme.controlIconSize} color={cameraPreviewTheme.controlButtonText} />
|
|
181
|
+
</TouchableOpacity>
|
|
182
|
+
|
|
183
|
+
<TouchableOpacity
|
|
184
|
+
style={[
|
|
185
|
+
styles.captureButton,
|
|
186
|
+
{ backgroundColor: cameraPreviewTheme.captureButtonBackground },
|
|
187
|
+
isCapturing && styles.captureButtonDisabled,
|
|
188
|
+
]}
|
|
189
|
+
onPress={handleCaptureFromNativeCamera}
|
|
190
|
+
disabled={isCapturing}
|
|
191
|
+
accessibilityLabel={
|
|
192
|
+
mediaType === 'photo' ? t('photoMode') : t('videoMode')
|
|
193
|
+
}
|
|
194
|
+
>
|
|
195
|
+
{isCapturing ? (
|
|
196
|
+
<ActivityIndicator color={cameraPreviewTheme.controlButtonText} size="small" />
|
|
197
|
+
) : (
|
|
198
|
+
<View
|
|
199
|
+
style={[
|
|
200
|
+
styles.captureButtonInner,
|
|
201
|
+
{ borderColor: cameraPreviewTheme.captureButtonInnerBorder },
|
|
202
|
+
]}
|
|
203
|
+
/>
|
|
204
|
+
)}
|
|
205
|
+
</TouchableOpacity>
|
|
206
|
+
|
|
207
|
+
<TouchableOpacity
|
|
208
|
+
style={[
|
|
209
|
+
styles.controlButton,
|
|
210
|
+
{ backgroundColor: cameraPreviewTheme.controlButtonBackground },
|
|
211
|
+
]}
|
|
212
|
+
disabled={isCapturing}
|
|
213
|
+
accessibilityLabel={
|
|
214
|
+
mediaType === 'photo' ? t('videoMode') : t('photoMode')
|
|
215
|
+
}
|
|
216
|
+
onPress={() =>
|
|
217
|
+
setMediaType(mediaType === 'photo' ? 'video' : 'photo')
|
|
218
|
+
}
|
|
219
|
+
>
|
|
220
|
+
<RenderIcon
|
|
221
|
+
name={mediaType === 'photo' ? 'video' : 'camera'}
|
|
222
|
+
size={cameraPreviewTheme.controlIconSize}
|
|
223
|
+
color={cameraPreviewTheme.controlButtonText}
|
|
224
|
+
/>
|
|
225
|
+
</TouchableOpacity>
|
|
226
|
+
</View>
|
|
227
|
+
|
|
228
|
+
{/* Close button */}
|
|
229
|
+
<TouchableOpacity
|
|
230
|
+
style={[
|
|
231
|
+
styles.closeButton,
|
|
232
|
+
isRtl ? styles.closeButtonRtl : styles.closeButtonLtr,
|
|
233
|
+
{ backgroundColor: cameraPreviewTheme.closeButtonBackground },
|
|
234
|
+
]}
|
|
235
|
+
onPress={onClose}
|
|
236
|
+
accessibilityLabel={t('close')}
|
|
237
|
+
>
|
|
238
|
+
<RenderIcon name="close" size={cameraPreviewTheme.closeIconSize} color={cameraPreviewTheme.closeButtonText} />
|
|
239
|
+
</TouchableOpacity>
|
|
240
|
+
</ResponsivePreviewContainer>
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Builds every CameraPreview style from the active theme. Components never
|
|
246
|
+
* hardcode sizing/typography/spacing — they all flow from `theme.components.cameraPreview`,
|
|
247
|
+
* `theme.typography`, and `theme.spacing` (see src/types.ts / src/theme.tsx).
|
|
248
|
+
*/
|
|
249
|
+
const createCameraPreviewStyles = (theme: CameraThemeConfig) => {
|
|
250
|
+
const cp = theme.components.cameraPreview;
|
|
251
|
+
const spacing = theme.spacing;
|
|
252
|
+
const weights = theme.typography.fontWeights;
|
|
253
|
+
|
|
254
|
+
return StyleSheet.create({
|
|
255
|
+
cameraPlaceholder: {
|
|
256
|
+
width: '100%',
|
|
257
|
+
height: '100%',
|
|
258
|
+
justifyContent: 'center',
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
position: 'relative',
|
|
261
|
+
},
|
|
262
|
+
cameraOverlay: {
|
|
263
|
+
...StyleSheet.absoluteFill,
|
|
264
|
+
},
|
|
265
|
+
cameraPlaceholderText: {
|
|
266
|
+
fontSize: cp.placeholderTextSize,
|
|
267
|
+
fontWeight: weights.semibold,
|
|
268
|
+
marginBottom: spacing.sm,
|
|
269
|
+
zIndex: 1,
|
|
270
|
+
},
|
|
271
|
+
loadingText: {
|
|
272
|
+
marginTop: spacing.lg,
|
|
273
|
+
fontSize: cp.loadingTextSize,
|
|
274
|
+
},
|
|
275
|
+
controlsContainer: {
|
|
276
|
+
position: 'absolute',
|
|
277
|
+
bottom: cp.controlsBottomInset,
|
|
278
|
+
left: 0,
|
|
279
|
+
right: 0,
|
|
280
|
+
flexDirection: 'row',
|
|
281
|
+
justifyContent: 'space-between',
|
|
282
|
+
alignItems: 'center',
|
|
283
|
+
paddingHorizontal: cp.controlsPaddingHorizontal,
|
|
284
|
+
},
|
|
285
|
+
controlButton: {
|
|
286
|
+
width: cp.controlButtonSize,
|
|
287
|
+
height: cp.controlButtonSize,
|
|
288
|
+
borderRadius: cp.controlButtonSize / 2,
|
|
289
|
+
justifyContent: 'center',
|
|
290
|
+
alignItems: 'center',
|
|
291
|
+
},
|
|
292
|
+
controlButtonText: {
|
|
293
|
+
fontSize: cp.controlButtonTextSize,
|
|
294
|
+
},
|
|
295
|
+
captureButton: {
|
|
296
|
+
width: cp.captureButtonSize,
|
|
297
|
+
height: cp.captureButtonSize,
|
|
298
|
+
borderRadius: cp.captureButtonSize / 2,
|
|
299
|
+
justifyContent: 'center',
|
|
300
|
+
alignItems: 'center',
|
|
301
|
+
},
|
|
302
|
+
captureButtonDisabled: {
|
|
303
|
+
opacity: cp.disabledOpacity,
|
|
304
|
+
},
|
|
305
|
+
captureButtonInner: {
|
|
306
|
+
width: cp.captureButtonInnerSize,
|
|
307
|
+
height: cp.captureButtonInnerSize,
|
|
308
|
+
borderRadius: cp.captureButtonInnerSize / 2,
|
|
309
|
+
borderWidth: cp.captureButtonBorderWidth,
|
|
310
|
+
},
|
|
311
|
+
closeButton: {
|
|
312
|
+
position: 'absolute',
|
|
313
|
+
top: cp.topInset,
|
|
314
|
+
width: cp.closeButtonSize,
|
|
315
|
+
height: cp.closeButtonSize,
|
|
316
|
+
borderRadius: cp.closeButtonSize / 2,
|
|
317
|
+
justifyContent: 'center',
|
|
318
|
+
alignItems: 'center',
|
|
319
|
+
},
|
|
320
|
+
closeButtonLtr: {
|
|
321
|
+
right: cp.sideInset,
|
|
322
|
+
},
|
|
323
|
+
closeButtonRtl: {
|
|
324
|
+
left: cp.sideInset,
|
|
325
|
+
},
|
|
326
|
+
closeButtonText: {
|
|
327
|
+
fontSize: cp.closeButtonTextSize,
|
|
328
|
+
fontWeight: weights.bold,
|
|
329
|
+
},
|
|
330
|
+
modeIndicator: {
|
|
331
|
+
position: 'absolute',
|
|
332
|
+
top: cp.topInset,
|
|
333
|
+
paddingHorizontal: cp.modeIndicatorPaddingHorizontal,
|
|
334
|
+
paddingVertical: cp.modeIndicatorPaddingVertical,
|
|
335
|
+
borderRadius: cp.modeIndicatorRadius,
|
|
336
|
+
zIndex: 1,
|
|
337
|
+
},
|
|
338
|
+
modeIndicatorLtr: {
|
|
339
|
+
left: cp.sideInset,
|
|
340
|
+
},
|
|
341
|
+
modeIndicatorRtl: {
|
|
342
|
+
right: cp.sideInset,
|
|
343
|
+
},
|
|
344
|
+
modeIndicatorContent: {
|
|
345
|
+
flexDirection: 'row',
|
|
346
|
+
alignItems: 'center',
|
|
347
|
+
},
|
|
348
|
+
modeIndicatorText: {
|
|
349
|
+
fontSize: cp.modeIndicatorTextSize,
|
|
350
|
+
},
|
|
351
|
+
});
|
|
352
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
type ImageStyle,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
type ViewProps,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import {
|
|
9
|
+
resolveNativeComponent,
|
|
10
|
+
toImageSourceUri,
|
|
11
|
+
} from './nativeComponentSupport';
|
|
12
|
+
|
|
13
|
+
export interface NativeAnimatedImageViewProps extends Omit<ViewProps, 'style'> {
|
|
14
|
+
/** Image source uri (content://, file:// or a plain path). */
|
|
15
|
+
src?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Whether this view is the currently-visible page in a paging viewer. Only the active page
|
|
18
|
+
* animates; deactivating stops the animation on its current frame so an off-screen or
|
|
19
|
+
* recycled cell never burns CPU animating something the user cannot see.
|
|
20
|
+
*
|
|
21
|
+
* Optional — defaults to true natively, so a single-image consumer that never sets it just
|
|
22
|
+
* animates.
|
|
23
|
+
*/
|
|
24
|
+
active?: boolean;
|
|
25
|
+
/** How the frame is scaled into the view. Defaults to `contain`. */
|
|
26
|
+
resizeMode?: 'contain' | 'cover';
|
|
27
|
+
/**
|
|
28
|
+
* Typed as an image style rather than a view style: both the native view and the `<Image>`
|
|
29
|
+
* fallback render image content, and the fallback would not accept a plain ViewStyle.
|
|
30
|
+
*/
|
|
31
|
+
style?: StyleProp<ImageStyle>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Native animated-image view (Android). ReactNative's own <Image> renders only a static first
|
|
35
|
+
// frame for a GIF on Android unless the host app adds Fresco's animated-gif decoder — a
|
|
36
|
+
// dependency every consumer of this library would otherwise have to add themselves.
|
|
37
|
+
const NativeAnimatedImageComponent =
|
|
38
|
+
resolveNativeComponent<NativeAnimatedImageViewProps>(
|
|
39
|
+
'NativeAnimatedImageView'
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
/** True when native animated-image playback is available on this platform/build. */
|
|
43
|
+
export const isNativeAnimatedImageAvailable = (): boolean =>
|
|
44
|
+
NativeAnimatedImageComponent !== null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Renders an animated image (GIF), animating where the platform supports it.
|
|
48
|
+
*
|
|
49
|
+
* The fallback is a plain `<Image>` rather than an empty view: iOS animates GIFs through
|
|
50
|
+
* `<Image>` natively, and on any other target the still frame is the correct degraded result.
|
|
51
|
+
* Either way the underlying file is only ever read, never rewritten.
|
|
52
|
+
*/
|
|
53
|
+
export const NativeAnimatedImageView: FC<NativeAnimatedImageViewProps> = (
|
|
54
|
+
props
|
|
55
|
+
) => {
|
|
56
|
+
if (NativeAnimatedImageComponent) {
|
|
57
|
+
return <NativeAnimatedImageComponent {...props} />;
|
|
58
|
+
}
|
|
59
|
+
// ViewProps is a superset of ImageProps, so forward only the props an <Image> accepts
|
|
60
|
+
// rather than spreading the rest.
|
|
61
|
+
return (
|
|
62
|
+
<Image
|
|
63
|
+
style={props.style}
|
|
64
|
+
testID={props.testID}
|
|
65
|
+
// Bare filesystem paths — what the media database stores — need a scheme before Fresco
|
|
66
|
+
// will load them at all.
|
|
67
|
+
source={{ uri: toImageSourceUri(props.src) }}
|
|
68
|
+
resizeMode={props.resizeMode ?? 'contain'}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ComponentType, FC } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
View,
|
|
6
|
+
type ViewProps,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
export interface NativeAudioPlayerViewProps extends ViewProps {
|
|
10
|
+
/** Audio source uri (content:// or file://). */
|
|
11
|
+
src?: string;
|
|
12
|
+
/** False while the audio page is off-screen — force-pauses playback. */
|
|
13
|
+
active?: boolean;
|
|
14
|
+
/** Accent color for the play button and scrubber, e.g. "#4A56FF". */
|
|
15
|
+
tintColor?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Native (Android) audio transport built on MediaPlayer — play/pause, a scrubbable
|
|
19
|
+
// progress bar and elapsed/total time, all drawn natively with no third-party
|
|
20
|
+
// playback or preview library. Resolved lazily and platform-guarded so non-Android
|
|
21
|
+
// targets (or an app without the native view registered) fall back to a plain view.
|
|
22
|
+
let NativeAudioComponent: ComponentType<NativeAudioPlayerViewProps> | null =
|
|
23
|
+
null;
|
|
24
|
+
if (Platform.OS === 'android') {
|
|
25
|
+
try {
|
|
26
|
+
NativeAudioComponent =
|
|
27
|
+
requireNativeComponent<NativeAudioPlayerViewProps>('CustomAudioPlayer');
|
|
28
|
+
} catch {
|
|
29
|
+
NativeAudioComponent = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const NativeAudioPlayerView: FC<NativeAudioPlayerViewProps> = (props) => {
|
|
34
|
+
if (NativeAudioComponent) {
|
|
35
|
+
return <NativeAudioComponent {...props} />;
|
|
36
|
+
}
|
|
37
|
+
const { src, active, tintColor, ...rest } = props;
|
|
38
|
+
return <View {...rest} />;
|
|
39
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ComponentType, FC } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
View,
|
|
6
|
+
type ViewProps,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
export interface NativeBlurViewProps extends ViewProps {
|
|
10
|
+
/** When true, snapshots + blurs the content behind it; when false, clears. */
|
|
11
|
+
active?: boolean;
|
|
12
|
+
/** Box-blur radius applied to the down-sampled snapshot (1–25). */
|
|
13
|
+
blurRadius?: number;
|
|
14
|
+
/** Snapshot down-sample divisor — higher is softer and cheaper (1–16). */
|
|
15
|
+
downsampleFactor?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// The native blur is an Android-only capability (a pure-Kotlin snapshot blur, no
|
|
19
|
+
// third-party library). It is resolved lazily and guarded by platform so iOS/web —
|
|
20
|
+
// or an app where the native view is not registered — fall back to a plain view
|
|
21
|
+
// instead of crashing. Callers overlay their own dim scrim, so the fallback simply
|
|
22
|
+
// renders no blur.
|
|
23
|
+
let NativeBlurComponent: ComponentType<NativeBlurViewProps> | null = null;
|
|
24
|
+
if (Platform.OS === 'android') {
|
|
25
|
+
try {
|
|
26
|
+
NativeBlurComponent =
|
|
27
|
+
requireNativeComponent<NativeBlurViewProps>('CustomBlurBackground');
|
|
28
|
+
} catch {
|
|
29
|
+
NativeBlurComponent = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const NativeBlurView: FC<NativeBlurViewProps> = (props) => {
|
|
34
|
+
if (NativeBlurComponent) {
|
|
35
|
+
return <NativeBlurComponent {...props} />;
|
|
36
|
+
}
|
|
37
|
+
// Graceful fallback: a plain (non-blurring) view so layout is unaffected.
|
|
38
|
+
const { active, blurRadius, downsampleFactor, ...rest } = props;
|
|
39
|
+
return <View {...rest} />;
|
|
40
|
+
};
|