@legendapp/spark 0.0.2 → 0.0.4
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/init-template.cjs +7 -1
- package/package.json +10 -5
- package/patches/dependencies.json +252 -0
- package/patches/expo-application@55.0.19.patch +54 -0
- package/patches/expo-blur@55.0.18.patch +130 -0
- package/patches/expo-device@55.0.21.patch +149 -0
- package/patches/expo-font@55.0.8.patch +55 -0
- package/patches/expo-glass-effect@55.0.11.patch +304 -0
- package/patches/expo-haptics@55.0.18.patch +54 -0
- package/patches/expo-image-manipulator@55.0.21.patch +312 -0
- package/patches/expo-image-picker@55.0.24.patch +327 -0
- package/patches/expo-image@55.0.11.patch +158 -0
- package/patches/expo-keep-awake@55.0.8.patch +41 -0
- package/patches/expo-localization@55.0.19.patch +32 -0
- package/patches/expo-location@55.1.15.patch +190 -0
- package/patches/expo-symbols@55.0.9.patch +286 -0
- package/patches/expo-system-ui@55.0.22.patch +61 -0
- package/patches/expo-web-browser@55.0.20.patch +13 -0
- package/patches/react-native-app-logs@0.3.1.patch +20 -0
- package/patches/react-native-blurhash@2.1.3.patch +318 -0
- package/patches/react-native-community-blur@4.4.1.patch +415 -0
- package/patches/react-native-community-datetimepicker@9.2.2.patch +320 -0
- package/patches/react-native-fast-image@10.9.9.patch +131 -0
- package/patches/react-native-graph@1.4.0.patch +157 -0
- package/patches/react-native-keyboard-controller@1.22.9.patch +16 -0
- package/patches/react-native-masked-view-masked-view@0.3.2.patch +140 -0
- package/patches/react-native-mmkv@4.3.2.patch +40 -0
- package/patches/react-native-nitro-fetch@1.9.0.patch +130 -0
- package/patches/react-native-nitro-zxing@0.3.0.patch +13 -0
- package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
- package/patches/react-native-quick-base64@3.0.1.patch +13 -0
- package/patches/react-native-quick-crypto@1.1.9.patch +31 -0
- package/patches/react-native-release-profiler@0.4.5.patch +37 -0
- package/patches/react-native-screen-corner-radius@0.2.3.patch +13 -0
- package/patches/react-native-screens@4.23.0.patch +160 -0
- package/patches/react-native-svg@15.15.3.patch +31 -0
- package/patches/react-native-unistyles@3.6.0.patch +203 -0
- package/patches/react-native-worklets-core@1.6.3.patch +13 -0
- package/patches/react-navigation-native-stack@7.21.0.patch +16 -0
- package/patches/registry.json +615 -0
- package/patches/sentry-react-native@8.32.0.patch +76 -0
- package/patches/workspace/expo-audio@55.0.18.patch +159 -0
- package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
- package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
- package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
- package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
- package/postinstall.cjs +10 -1
- package/skills/spark/SKILL.md +37 -4
- package/skills/spark/UPGRADING.md +150 -1
- package/skills/spark/ai-customize.md +39 -0
- package/skills/spark/app-and-documents.md +56 -0
- package/skills/spark/external-libraries.md +87 -0
- package/skills/spark/files.md +64 -0
- package/skills/spark/integrations.md +69 -0
- package/skills/spark/keyboard.md +54 -0
- package/skills/spark/library-compat.md +76 -0
- package/skills/spark/menus-tray-dock.md +83 -0
- package/skills/spark/storage-settings.md +85 -0
- package/skills/spark/ui.md +57 -0
- package/skills/spark/windows.md +91 -0
- package/ui-popover.ts +1 -0
- package/ui-progress.ts +1 -0
- package/ui-sheet.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-table.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +139 -104
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +10 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +15 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +20 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +20 -20
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +315 -68
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
- package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +26 -13
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +418 -102
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +5 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +63 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +35 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
- package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +39 -6
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
diff --git a/RNDateTimePicker.podspec b/RNDateTimePicker.podspec
|
|
2
|
+
index 5f53282..ebb61c9 100644
|
|
3
|
+
--- a/RNDateTimePicker.podspec
|
|
4
|
+
+++ b/RNDateTimePicker.podspec
|
|
5
|
+
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|
6
|
+
s.license = package['license']
|
|
7
|
+
s.author = package['author']
|
|
8
|
+
s.homepage = package['homepage']
|
|
9
|
+
- s.platforms = { :ios => "11.0", :visionos => "1.0" }
|
|
10
|
+
+ s.platforms = { :ios => "11.0", :visionos => "1.0", :osx => "14.0" }
|
|
11
|
+
s.source = { :git => "https://github.com/react-native-community/datetimepicker", :tag => "v#{s.version}" }
|
|
12
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
13
|
+
s.requires_arc = true
|
|
14
|
+
diff --git a/ios/RNDateTimePicker.h b/ios/RNDateTimePicker.h
|
|
15
|
+
index 00dd45d..1308e42 100644
|
|
16
|
+
--- a/ios/RNDateTimePicker.h
|
|
17
|
+
+++ b/ios/RNDateTimePicker.h
|
|
18
|
+
@@ -1,3 +1,5 @@
|
|
19
|
+
+#include <TargetConditionals.h>
|
|
20
|
+
+#if !TARGET_OS_OSX
|
|
21
|
+
/**
|
|
22
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
+
*
|
|
24
|
+
@@ -10,3 +12,4 @@
|
|
25
|
+
@interface RNDateTimePicker : UIDatePicker
|
|
26
|
+
|
|
27
|
+
@end
|
|
28
|
+
+#endif
|
|
29
|
+
diff --git a/ios/RNDateTimePicker.m b/ios/RNDateTimePicker.m
|
|
30
|
+
index 9c73c8e..7a913f2 100644
|
|
31
|
+
--- a/ios/RNDateTimePicker.m
|
|
32
|
+
+++ b/ios/RNDateTimePicker.m
|
|
33
|
+
@@ -1,3 +1,5 @@
|
|
34
|
+
+#include <TargetConditionals.h>
|
|
35
|
+
+#if !TARGET_OS_OSX
|
|
36
|
+
/**
|
|
37
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
38
|
+
*
|
|
39
|
+
@@ -73,3 +75,4 @@ - (void)setDate:(NSDate *)date {
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@end
|
|
43
|
+
+#endif
|
|
44
|
+
diff --git a/ios/RNDateTimePickerManager.h b/ios/RNDateTimePickerManager.h
|
|
45
|
+
index a619db6..2925f0e 100644
|
|
46
|
+
--- a/ios/RNDateTimePickerManager.h
|
|
47
|
+
+++ b/ios/RNDateTimePickerManager.h
|
|
48
|
+
@@ -1,3 +1,5 @@
|
|
49
|
+
+#include <TargetConditionals.h>
|
|
50
|
+
+#if !TARGET_OS_OSX
|
|
51
|
+
/**
|
|
52
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
53
|
+
*
|
|
54
|
+
@@ -17,3 +19,4 @@
|
|
55
|
+
@interface RNDateTimePickerManager : RCTViewManager
|
|
56
|
+
|
|
57
|
+
@end
|
|
58
|
+
+#endif
|
|
59
|
+
diff --git a/ios/RNDateTimePickerManager.m b/ios/RNDateTimePickerManager.m
|
|
60
|
+
index 0a69f5c..85943c5 100644
|
|
61
|
+
--- a/ios/RNDateTimePickerManager.m
|
|
62
|
+
+++ b/ios/RNDateTimePickerManager.m
|
|
63
|
+
@@ -1,3 +1,5 @@
|
|
64
|
+
+#include <TargetConditionals.h>
|
|
65
|
+
+#if !TARGET_OS_OSX
|
|
66
|
+
/**
|
|
67
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
68
|
+
*
|
|
69
|
+
@@ -196,3 +198,4 @@ + (NSString*) datepickerStyleToString: (UIDatePickerStyle) style API_AVAILABLE(
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@end
|
|
73
|
+
+#endif
|
|
74
|
+
diff --git a/ios/RNDateTimePickerShadowView.h b/ios/RNDateTimePickerShadowView.h
|
|
75
|
+
index 0e25849..a8054d1 100644
|
|
76
|
+
--- a/ios/RNDateTimePickerShadowView.h
|
|
77
|
+
+++ b/ios/RNDateTimePickerShadowView.h
|
|
78
|
+
@@ -1,3 +1,5 @@
|
|
79
|
+
+#include <TargetConditionals.h>
|
|
80
|
+
+#if !TARGET_OS_OSX
|
|
81
|
+
#import <React/RCTShadowView.h>
|
|
82
|
+
#import <React/RCTLog.h>
|
|
83
|
+
#import "RNDateTimePicker.h"
|
|
84
|
+
@@ -13,3 +15,4 @@
|
|
85
|
+
@property (nonatomic, assign) UIDatePickerStyle displayIOS API_AVAILABLE(ios(13.4));
|
|
86
|
+
|
|
87
|
+
@end
|
|
88
|
+
+#endif
|
|
89
|
+
diff --git a/ios/RNDateTimePickerShadowView.m b/ios/RNDateTimePickerShadowView.m
|
|
90
|
+
index 4ff3362..352c0af 100644
|
|
91
|
+
--- a/ios/RNDateTimePickerShadowView.m
|
|
92
|
+
+++ b/ios/RNDateTimePickerShadowView.m
|
|
93
|
+
@@ -1,3 +1,5 @@
|
|
94
|
+
+#include <TargetConditionals.h>
|
|
95
|
+
+#if !TARGET_OS_OSX
|
|
96
|
+
#import "RNDateTimePickerShadowView.h"
|
|
97
|
+
|
|
98
|
+
@implementation RNDateTimePickerShadowView
|
|
99
|
+
@@ -79,3 +81,4 @@ static YGSize RNDateTimePickerShadowViewMeasure(YGNodeConstRef node, float width
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@end
|
|
103
|
+
+#endif
|
|
104
|
+
diff --git a/ios/fabric/RNDateTimePickerComponentView.mm b/ios/fabric/RNDateTimePickerComponentView.mm
|
|
105
|
+
index ec9d7cd..2ca07f1 100644
|
|
106
|
+
--- a/ios/fabric/RNDateTimePickerComponentView.mm
|
|
107
|
+
+++ b/ios/fabric/RNDateTimePickerComponentView.mm
|
|
108
|
+
@@ -1,3 +1,5 @@
|
|
109
|
+
+#include <TargetConditionals.h>
|
|
110
|
+
+#if !TARGET_OS_OSX
|
|
111
|
+
/**
|
|
112
|
+
* RNDateTimePickerComponentView is only be available when fabric is enabled.
|
|
113
|
+
*/
|
|
114
|
+
@@ -326,4 +328,4 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
|
|
115
|
+
{
|
|
116
|
+
return RNDateTimePickerComponentView.class;
|
|
117
|
+
}
|
|
118
|
+
-
|
|
119
|
+
+#endif
|
|
120
|
+
diff --git a/ios/fabric/RNDateTimePickerComponentViewMacOS.mm b/ios/fabric/RNDateTimePickerComponentViewMacOS.mm
|
|
121
|
+
new file mode 100644
|
|
122
|
+
index 0000000..7f8f91e
|
|
123
|
+
--- /dev/null
|
|
124
|
+
+++ b/ios/fabric/RNDateTimePickerComponentViewMacOS.mm
|
|
125
|
+
@@ -0,0 +1,179 @@
|
|
126
|
+
+/**
|
|
127
|
+
+ * macOS: the Fabric picker on AppKit's NSDatePicker. NSDatePicker has no countdown mode, wheels,
|
|
128
|
+
+ * minute interval or accent color; countdown shows a time picker and spinner a stepper field.
|
|
129
|
+
+ */
|
|
130
|
+
+#include <TargetConditionals.h>
|
|
131
|
+
+#if TARGET_OS_OSX
|
|
132
|
+
+
|
|
133
|
+
+#import "RNDateTimePickerComponentView.h"
|
|
134
|
+
+#import <React/RCTConversions.h>
|
|
135
|
+
+#import <React/RCTFabricComponentsPlugins.h>
|
|
136
|
+
+
|
|
137
|
+
+#import "cpp/react/renderer/components/RNDateTimePicker/ComponentDescriptors.h"
|
|
138
|
+
+#import <react/renderer/components/RNDateTimePickerCGen/EventEmitters.h>
|
|
139
|
+
+#import <react/renderer/components/RNDateTimePickerCGen/Props.h>
|
|
140
|
+
+#import <react/renderer/components/RNDateTimePickerCGen/RCTComponentViewHelpers.h>
|
|
141
|
+
+
|
|
142
|
+
+using namespace facebook::react;
|
|
143
|
+
+
|
|
144
|
+
+@interface RNDateTimePickerComponentView () <RCTRNDateTimePickerViewProtocol>
|
|
145
|
+
+@end
|
|
146
|
+
+
|
|
147
|
+
+@implementation RNDateTimePickerComponentView {
|
|
148
|
+
+ NSDatePicker *_picker;
|
|
149
|
+
+ RNDateTimePickerShadowNode::ConcreteState::Shared _state;
|
|
150
|
+
+ CGSize _measuredSize;
|
|
151
|
+
+}
|
|
152
|
+
+
|
|
153
|
+
+- (instancetype)initWithFrame:(CGRect)frame
|
|
154
|
+
+{
|
|
155
|
+
+ if (self = [super initWithFrame:frame]) {
|
|
156
|
+
+ static const auto defaultProps = std::make_shared<const RNDateTimePickerProps>();
|
|
157
|
+
+ _props = defaultProps;
|
|
158
|
+
+
|
|
159
|
+
+ _picker = [NSDatePicker new];
|
|
160
|
+
+ _picker.datePickerStyle = NSDatePickerStyleTextFieldAndStepper;
|
|
161
|
+
+ _picker.datePickerElements = NSDatePickerElementFlagYearMonthDay;
|
|
162
|
+
+ _picker.target = self;
|
|
163
|
+
+ _picker.action = @selector(onChange:);
|
|
164
|
+
+
|
|
165
|
+
+ self.contentView = _picker;
|
|
166
|
+
+ }
|
|
167
|
+
+ return self;
|
|
168
|
+
+}
|
|
169
|
+
+
|
|
170
|
+
+- (void)onChange:(NSDatePicker *)sender
|
|
171
|
+
+{
|
|
172
|
+
+ if (!_eventEmitter) {
|
|
173
|
+
+ return;
|
|
174
|
+
+ }
|
|
175
|
+
+ RNDateTimePickerEventEmitter::OnChange event = {
|
|
176
|
+
+ // Sending time in milliseconds
|
|
177
|
+
+ .timestamp = [sender.dateValue timeIntervalSince1970] * 1000
|
|
178
|
+
+ };
|
|
179
|
+
+ std::dynamic_pointer_cast<const RNDateTimePickerEventEmitter>(_eventEmitter)->onChange(event);
|
|
180
|
+
+}
|
|
181
|
+
+
|
|
182
|
+
+// Sizes the shadow node to the picker (see adopt in ComponentDescriptors.h).
|
|
183
|
+
+- (void)updateMeasurements
|
|
184
|
+
+{
|
|
185
|
+
+ CGSize size = _picker.fittingSize;
|
|
186
|
+
+ if (_state == nullptr || CGSizeEqualToSize(size, _measuredSize)) {
|
|
187
|
+
+ return;
|
|
188
|
+
+ }
|
|
189
|
+
+ _measuredSize = size;
|
|
190
|
+
+ _state->updateState(RNDateTimePickerState{RCTSizeFromCGSize(size)});
|
|
191
|
+
+}
|
|
192
|
+
+
|
|
193
|
+
++ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
194
|
+
+{
|
|
195
|
+
+ return concreteComponentDescriptorProvider<RNDateTimePickerComponentDescriptor>();
|
|
196
|
+
+}
|
|
197
|
+
+
|
|
198
|
+
++ (BOOL)shouldBeRecycled
|
|
199
|
+
+{
|
|
200
|
+
+ return NO;
|
|
201
|
+
+}
|
|
202
|
+
+
|
|
203
|
+
+- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState
|
|
204
|
+
+{
|
|
205
|
+
+ _state = std::static_pointer_cast<const RNDateTimePickerShadowNode::ConcreteState>(state);
|
|
206
|
+
+ if (oldState == nullptr) {
|
|
207
|
+
+ _measuredSize = CGSizeZero;
|
|
208
|
+
+ [self updateMeasurements];
|
|
209
|
+
+ }
|
|
210
|
+
+}
|
|
211
|
+
+
|
|
212
|
+
+- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
213
|
+
+{
|
|
214
|
+
+ const auto &oldPickerProps = *std::static_pointer_cast<const RNDateTimePickerProps>(_props);
|
|
215
|
+
+ const auto &newPickerProps = *std::static_pointer_cast<const RNDateTimePickerProps>(props);
|
|
216
|
+
+
|
|
217
|
+
+ BOOL limitsChanged = oldPickerProps.minimumDate != newPickerProps.minimumDate || oldPickerProps.maximumDate != newPickerProps.maximumDate;
|
|
218
|
+
+ if (limitsChanged) {
|
|
219
|
+
+ NSDate *minDate = newPickerProps.minimumDate ? [NSDate dateWithTimeIntervalSince1970:newPickerProps.minimumDate / 1000.0] : nil;
|
|
220
|
+
+ NSDate *maxDate = newPickerProps.maximumDate ? [NSDate dateWithTimeIntervalSince1970:newPickerProps.maximumDate / 1000.0] : nil;
|
|
221
|
+
+ // As on iOS, min > max leaves both unset and relies on the JavaScript warning.
|
|
222
|
+
+ BOOL valid = !minDate || !maxDate || [minDate compare:maxDate] != NSOrderedDescending;
|
|
223
|
+
+ _picker.minDate = nil;
|
|
224
|
+
+ _picker.maxDate = nil;
|
|
225
|
+
+ _picker.minDate = valid ? minDate : nil;
|
|
226
|
+
+ _picker.maxDate = valid ? maxDate : nil;
|
|
227
|
+
+ }
|
|
228
|
+
+
|
|
229
|
+
+ // NSDatePicker clamps its date whenever the limits move, so set the date after them.
|
|
230
|
+
+ if (limitsChanged || oldPickerProps.date != newPickerProps.date) {
|
|
231
|
+
+ _picker.dateValue = [NSDate dateWithTimeIntervalSince1970:newPickerProps.date / 1000.0];
|
|
232
|
+
+ }
|
|
233
|
+
+
|
|
234
|
+
+ if (oldPickerProps.locale != newPickerProps.locale) {
|
|
235
|
+
+ _picker.locale = [[NSLocale alloc] initWithLocaleIdentifier:RCTNSStringFromString(newPickerProps.locale)];
|
|
236
|
+
+ }
|
|
237
|
+
+
|
|
238
|
+
+ if (oldPickerProps.mode != newPickerProps.mode) {
|
|
239
|
+
+ switch (newPickerProps.mode) {
|
|
240
|
+
+ case RNDateTimePickerMode::Time:
|
|
241
|
+
+ case RNDateTimePickerMode::Countdown:
|
|
242
|
+
+ _picker.datePickerElements = NSDatePickerElementFlagHourMinute;
|
|
243
|
+
+ break;
|
|
244
|
+
+ case RNDateTimePickerMode::Datetime:
|
|
245
|
+
+ _picker.datePickerElements = NSDatePickerElementFlagYearMonthDay | NSDatePickerElementFlagHourMinute;
|
|
246
|
+
+ break;
|
|
247
|
+
+ default:
|
|
248
|
+
+ _picker.datePickerElements = NSDatePickerElementFlagYearMonthDay;
|
|
249
|
+
+ }
|
|
250
|
+
+ }
|
|
251
|
+
+
|
|
252
|
+
+ if (oldPickerProps.displayIOS != newPickerProps.displayIOS) {
|
|
253
|
+
+ _picker.datePickerStyle = newPickerProps.displayIOS == RNDateTimePickerDisplayIOS::Inline
|
|
254
|
+
+ ? NSDatePickerStyleClockAndCalendar
|
|
255
|
+
+ : NSDatePickerStyleTextFieldAndStepper;
|
|
256
|
+
+ }
|
|
257
|
+
+
|
|
258
|
+
+ if (oldPickerProps.timeZoneOffsetInMinutes != newPickerProps.timeZoneOffsetInMinutes) {
|
|
259
|
+
+ // JS standard for time zones is minutes.
|
|
260
|
+
+ _picker.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:newPickerProps.timeZoneOffsetInMinutes * 60.0];
|
|
261
|
+
+ }
|
|
262
|
+
+
|
|
263
|
+
+ if (oldPickerProps.timeZoneName != newPickerProps.timeZoneName) {
|
|
264
|
+
+ NSString *timeZoneName = RCTNSStringFromString(newPickerProps.timeZoneName);
|
|
265
|
+
+ NSTimeZone *timeZone = timeZoneName.length ? [NSTimeZone timeZoneWithName:timeZoneName] : nil;
|
|
266
|
+
+ if (timeZoneName.length && !timeZone) {
|
|
267
|
+
+ RCTLogWarn(@"'%@' does not exist in NSTimeZone.knownTimeZoneNames. Falling back to localTimeZone=%@", timeZoneName, NSTimeZone.localTimeZone.name);
|
|
268
|
+
+ }
|
|
269
|
+
+ _picker.timeZone = timeZone ?: NSTimeZone.localTimeZone;
|
|
270
|
+
+ }
|
|
271
|
+
+
|
|
272
|
+
+ if (oldPickerProps.textColor != newPickerProps.textColor) {
|
|
273
|
+
+ _picker.textColor = RCTUIColorFromSharedColor(newPickerProps.textColor) ?: NSColor.controlTextColor;
|
|
274
|
+
+ }
|
|
275
|
+
+
|
|
276
|
+
+ if (oldPickerProps.themeVariant != newPickerProps.themeVariant) {
|
|
277
|
+
+ switch (newPickerProps.themeVariant) {
|
|
278
|
+
+ case RNDateTimePickerThemeVariant::Light:
|
|
279
|
+
+ _picker.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
|
280
|
+
+ break;
|
|
281
|
+
+ case RNDateTimePickerThemeVariant::Dark:
|
|
282
|
+
+ _picker.appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
|
283
|
+
+ break;
|
|
284
|
+
+ default:
|
|
285
|
+
+ _picker.appearance = nil;
|
|
286
|
+
+ }
|
|
287
|
+
+ }
|
|
288
|
+
+
|
|
289
|
+
+ if (oldPickerProps.enabled != newPickerProps.enabled) {
|
|
290
|
+
+ _picker.enabled = newPickerProps.enabled;
|
|
291
|
+
+ }
|
|
292
|
+
+
|
|
293
|
+
+ [super updateProps:props oldProps:oldProps];
|
|
294
|
+
+ [self updateMeasurements];
|
|
295
|
+
+}
|
|
296
|
+
+
|
|
297
|
+
+@end
|
|
298
|
+
+
|
|
299
|
+
+Class<RCTComponentViewProtocol> RNDateTimePickerCls(void)
|
|
300
|
+
+{
|
|
301
|
+
+ return RNDateTimePickerComponentView.class;
|
|
302
|
+
+}
|
|
303
|
+
+
|
|
304
|
+
+#endif
|
|
305
|
+
diff --git a/src/datetimepicker.macos.js b/src/datetimepicker.macos.js
|
|
306
|
+
new file mode 100644
|
|
307
|
+
index 0000000..4290def
|
|
308
|
+
--- /dev/null
|
|
309
|
+
+++ b/src/datetimepicker.macos.js
|
|
310
|
+
@@ -0,0 +1,2 @@
|
|
311
|
+
+// macOS uses the native picker, like iOS.
|
|
312
|
+
+export { default } from './datetimepicker.ios';
|
|
313
|
+
diff --git a/src/picker.macos.js b/src/picker.macos.js
|
|
314
|
+
new file mode 100644
|
|
315
|
+
index 0000000..157ac5c
|
|
316
|
+
--- /dev/null
|
|
317
|
+
+++ b/src/picker.macos.js
|
|
318
|
+
@@ -0,0 +1,2 @@
|
|
319
|
+
+// macOS uses the native picker, like iOS.
|
|
320
|
+
+export { default } from './picker.ios';
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
diff --git a/src/index.macos.tsx b/src/index.macos.tsx
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000..0d10daf
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/src/index.macos.tsx
|
|
6
|
+
@@ -0,0 +1,125 @@
|
|
7
|
+
+// FastImage on macOS: React Native's Image stands in for the native view, which is
|
|
8
|
+
+// UIKit only. Sources (uri, headers, require()), objectFit, tintColor, placeholder and
|
|
9
|
+
+// defaultSource while loading, and the load events work; Image's own caches replace
|
|
10
|
+
+// SDWebImage's, so cache options, thumbhash/blurhash placeholders, transitions and
|
|
11
|
+
+// several sizes of one image are not supported (the largest size loads).
|
|
12
|
+
+import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
13
|
+
+import { Image, StyleSheet, View, type ImageResizeMode } from 'react-native'
|
|
14
|
+
+import { cacheControl, priority, resizeMode } from './constants'
|
|
15
|
+
+import { splitBackgroundProps } from './backgroundProps'
|
|
16
|
+
+import type {
|
|
17
|
+
+ ClearCacheResult,
|
|
18
|
+
+ FastImageBackgroundProps,
|
|
19
|
+
+ FastImageProps,
|
|
20
|
+
+ FastImageRef,
|
|
21
|
+
+ FastImageStaticProperties,
|
|
22
|
+
+ ObjectFit,
|
|
23
|
+
+ PreloadResult,
|
|
24
|
+
+} from './index'
|
|
25
|
+
+
|
|
26
|
+
+export type * from './index'
|
|
27
|
+
+
|
|
28
|
+
+const fits: Record<ObjectFit, ImageResizeMode> = {
|
|
29
|
+
+ fill: 'stretch',
|
|
30
|
+
+ contain: 'contain',
|
|
31
|
+
+ cover: 'cover',
|
|
32
|
+
+ none: 'center',
|
|
33
|
+
+ 'scale-down': 'center',
|
|
34
|
+
+}
|
|
35
|
+
+const unsupported = (name: string) =>
|
|
36
|
+
+ Promise.resolve({ ok: false as const, error: `FastImage.${name} is not supported on macOS` })
|
|
37
|
+
+
|
|
38
|
+
+type OneSource = Exclude<NonNullable<FastImageProps['source']>, readonly unknown[]>
|
|
39
|
+
+
|
|
40
|
+
+function imageSource(source: FastImageProps['source']) {
|
|
41
|
+
+ const sources = (Array.isArray(source) ? source : [source]) as (OneSource | undefined)[]
|
|
42
|
+
+ const area = (one: OneSource | undefined) => typeof one === 'object' ? (one.width ?? 0) * (one.height ?? 0) : 0
|
|
43
|
+
+ const selected = sources.reduce((best, next) => area(next) < area(best) ? best : next, sources[0])
|
|
44
|
+
+ const largest = typeof selected === 'number' ? Image.resolveAssetSource(selected) : selected
|
|
45
|
+
+ // RN Image copies source dimensions into its layout; let the container set the size.
|
|
46
|
+
+ return typeof largest === 'object'
|
|
47
|
+
+ ? { uri: largest.uri, headers: 'headers' in largest ? largest.headers : undefined, scale: largest.scale }
|
|
48
|
+
+ : largest
|
|
49
|
+
+}
|
|
50
|
+
+
|
|
51
|
+
+const FastImageComponent = forwardRef<FastImageRef, FastImageProps>(({
|
|
52
|
+
+ source, objectFit = 'cover', tintColor, placeholder, defaultSource,
|
|
53
|
+
+ onLoadStart, onProgress, onLoad, onError, onLoadEnd, style, ...props
|
|
54
|
+
+}, ref) => {
|
|
55
|
+
+ const view = useRef<View>(null)
|
|
56
|
+
+ const [attempt, setAttempt] = useState(0)
|
|
57
|
+
+ const [loaded, setLoaded] = useState(false)
|
|
58
|
+
+ useImperativeHandle(ref, () => Object.assign(view.current ?? {}, { reload: () => { setLoaded(false); setAttempt(value => value + 1) } }) as FastImageRef, [])
|
|
59
|
+
+ const fallback = typeof placeholder === 'number' ? placeholder
|
|
60
|
+
+ : typeof placeholder === 'string' ? { uri: placeholder }
|
|
61
|
+
+ : placeholder && 'uri' in placeholder && placeholder.uri ? { uri: placeholder.uri, headers: placeholder.headers }
|
|
62
|
+
+ : defaultSource
|
|
63
|
+
+ return <View ref={view} {...props} style={[styles.container, style]}>
|
|
64
|
+
+ {!loaded && fallback !== undefined && <Image source={imageSource(fallback) as never} resizeMode={fits[objectFit]} style={StyleSheet.absoluteFill} />}
|
|
65
|
+
+ <Image
|
|
66
|
+
+ key={attempt}
|
|
67
|
+
+ source={imageSource(source) as never}
|
|
68
|
+
+ resizeMode={fits[objectFit]}
|
|
69
|
+
+ tintColor={tintColor}
|
|
70
|
+
+ style={[StyleSheet.absoluteFill, tintColor === undefined ? null : { tintColor }]}
|
|
71
|
+
+ onLoadStart={() => { setLoaded(false); onLoadStart?.() }}
|
|
72
|
+
+ onProgress={event => onProgress?.({ nativeEvent: { loaded: event.nativeEvent.loaded, total: event.nativeEvent.total } } as never)}
|
|
73
|
+
+ onLoad={event => {
|
|
74
|
+
+ const loaded = (width: number, height: number) => {
|
|
75
|
+
+ setLoaded(true)
|
|
76
|
+
+ onLoad?.({ nativeEvent: { width, height } })
|
|
77
|
+
+ onLoadEnd?.({ ok: true, width, height })
|
|
78
|
+
+ }
|
|
79
|
+
+ // React Native macOS scales a 1x image's size by the screen's; getSize reads its pixels.
|
|
80
|
+
+ const { uri, width, height } = event.nativeEvent.source
|
|
81
|
+
+ if (uri) Image.getSize(uri).then(size => loaded(size.width, size.height), () => loaded(width, height))
|
|
82
|
+
+ else loaded(width, height)
|
|
83
|
+
+ }}
|
|
84
|
+
+ onError={event => {
|
|
85
|
+
+ const error = String(event.nativeEvent.error)
|
|
86
|
+
+ onError?.({ nativeEvent: { error } })
|
|
87
|
+
+ onLoadEnd?.({ ok: false, error })
|
|
88
|
+
+ }}
|
|
89
|
+
+ />
|
|
90
|
+
+ </View>
|
|
91
|
+
+})
|
|
92
|
+
+FastImageComponent.displayName = 'FastImage'
|
|
93
|
+
+
|
|
94
|
+
+const statics: FastImageStaticProperties = {
|
|
95
|
+
+ resizeMode,
|
|
96
|
+
+ priority,
|
|
97
|
+
+ cacheControl,
|
|
98
|
+
+ preload: sources => Promise.all(sources.map(async (source): Promise<PreloadResult> => {
|
|
99
|
+
+ if (!source?.uri) return { ok: false, uri: source?.uri, error: 'FastImage.preload needs a uri on macOS' }
|
|
100
|
+
+ try {
|
|
101
|
+
+ await Image.prefetch(source.uri)
|
|
102
|
+
+ const { width, height } = await Image.getSize(source.uri)
|
|
103
|
+
+ return { ok: true, uri: source.uri, width, height }
|
|
104
|
+
+ } catch (error) {
|
|
105
|
+
+ return { ok: false, uri: source.uri, error: String(error) }
|
|
106
|
+
+ }
|
|
107
|
+
+ })),
|
|
108
|
+
+ clearMemoryCache: () => unsupported('clearMemoryCache') as Promise<ClearCacheResult>,
|
|
109
|
+
+ clearDiskCache: () => unsupported('clearDiskCache') as Promise<ClearCacheResult>,
|
|
110
|
+
+ getCachePath: () => unsupported('getCachePath') as never,
|
|
111
|
+
+ writeToCache: () => unsupported('writeToCache') as never,
|
|
112
|
+
+ configureCache: () => unsupported('configureCache') as never,
|
|
113
|
+
+ setDefaults: () => {},
|
|
114
|
+
+}
|
|
115
|
+
+
|
|
116
|
+
+const FastImage = Object.assign(FastImageComponent, statics)
|
|
117
|
+
+
|
|
118
|
+
+export const FastImageBackground = forwardRef<View, FastImageBackgroundProps>(
|
|
119
|
+
+ ({ style, imageStyle, imageRef, imageProps, children, ...props }, ref) => {
|
|
120
|
+
+ const [image, container] = splitBackgroundProps(props, imageProps)
|
|
121
|
+
+ return <View ref={ref} {...container} style={style}>
|
|
122
|
+
+ <FastImageComponent {...image} style={[StyleSheet.absoluteFill, imageStyle]} ref={imageRef} />
|
|
123
|
+
+ {children}
|
|
124
|
+
+ </View>
|
|
125
|
+
+ },
|
|
126
|
+
+)
|
|
127
|
+
+FastImageBackground.displayName = 'FastImageBackground'
|
|
128
|
+
+
|
|
129
|
+
+const styles = StyleSheet.create({ container: { overflow: 'hidden' } })
|
|
130
|
+
+
|
|
131
|
+
+export default FastImage
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
diff --git a/lib/module/AnimatedLineGraph.js b/lib/module/AnimatedLineGraph.js
|
|
2
|
+
index f08d7f4..5621a8b 100644
|
|
3
|
+
--- a/lib/module/AnimatedLineGraph.js
|
|
4
|
+
+++ b/lib/module/AnimatedLineGraph.js
|
|
5
|
+
@@ -77,14 +77,14 @@ export function AnimatedLineGraph({
|
|
6
|
+
setHeight(Math.round(layout.height));
|
|
7
|
+
}, []);
|
|
8
|
+
const straightLine = useMemo(() => {
|
|
9
|
+
- const path = Skia.Path.Make();
|
|
10
|
+
+ const path = Skia.PathBuilder.Make();
|
|
11
|
+
path.moveTo(0, height / 2);
|
|
12
|
+
for (let i = 0; i < width - 1; i += 2) {
|
|
13
|
+
const x = i;
|
|
14
|
+
const y = height / 2;
|
|
15
|
+
path.cubicTo(x, y, x, y, x, y);
|
|
16
|
+
}
|
|
17
|
+
- return path;
|
|
18
|
+
+ return path.build();
|
|
19
|
+
}, [height, width]);
|
|
20
|
+
const paths = useSharedValue({});
|
|
21
|
+
const gradientPaths = useSharedValue({});
|
|
22
|
+
diff --git a/lib/module/CreateGraphPath.js b/lib/module/CreateGraphPath.js
|
|
23
|
+
index cad0ca6..28e70c7 100644
|
|
24
|
+
--- a/lib/module/CreateGraphPath.js
|
|
25
|
+
+++ b/lib/module/CreateGraphPath.js
|
|
26
|
+
@@ -49,13 +49,14 @@ function createGraphPathBase({
|
|
27
|
+
canvasWidth: width,
|
|
28
|
+
shouldFillGradient
|
|
29
|
+
}) {
|
|
30
|
+
- const path = Skia.Path.Make();
|
|
31
|
+
+ // Skia 2 builds paths with PathBuilder; SkPath itself is immutable.
|
|
32
|
+
+ const builder = Skia.PathBuilder.Make();
|
|
33
|
+
|
|
34
|
+
// Canvas width substracted by the horizontal padding => Actual drawing width
|
|
35
|
+
const drawingWidth = width - 2 * horizontalPadding;
|
|
36
|
+
// Canvas height substracted by the vertical padding => Actual drawing height
|
|
37
|
+
const drawingHeight = height - 2 * verticalPadding;
|
|
38
|
+
- if (graphData[0] == null) return path;
|
|
39
|
+
+ if (graphData[0] == null) return builder.build();
|
|
40
|
+
const points = [];
|
|
41
|
+
const startX = getXInRange(drawingWidth, graphData[0].date, range.x) + horizontalPadding;
|
|
42
|
+
const endX = getXInRange(drawingWidth, graphData[graphData.length - 1].date, range.x) + horizontalPadding;
|
|
43
|
+
@@ -91,7 +92,7 @@ function createGraphPathBase({
|
|
44
|
+
const point = points[i];
|
|
45
|
+
|
|
46
|
+
// first point needs to start the path
|
|
47
|
+
- if (i === 0) path.moveTo(point.x, point.y);
|
|
48
|
+
+ if (i === 0) builder.moveTo(point.x, point.y);
|
|
49
|
+
const prev = points[i - 1];
|
|
50
|
+
const prevPrev = points[i - 2];
|
|
51
|
+
if (prev == null) continue;
|
|
52
|
+
@@ -103,15 +104,19 @@ function createGraphPathBase({
|
|
53
|
+
const cp2y = (p0.y + 2 * p1.y) / 3;
|
|
54
|
+
const cp3x = (p0.x + 4 * p1.x + point.x) / 6;
|
|
55
|
+
const cp3y = (p0.y + 4 * p1.y + point.y) / 6;
|
|
56
|
+
- path.cubicTo(cp1x, cp1y, cp2x, cp2y, cp3x, cp3y);
|
|
57
|
+
+ builder.cubicTo(cp1x, cp1y, cp2x, cp2y, cp3x, cp3y);
|
|
58
|
+
if (i === points.length - 1) {
|
|
59
|
+
- path.cubicTo(point.x, point.y, point.x, point.y, point.x, point.y);
|
|
60
|
+
+ builder.cubicTo(point.x, point.y, point.x, point.y, point.x, point.y);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
+ const path = builder.build();
|
|
64
|
+
if (!shouldFillGradient) return path;
|
|
65
|
+
- const gradientPath = path.copy();
|
|
66
|
+
- gradientPath.lineTo(endX, height + verticalPadding);
|
|
67
|
+
- gradientPath.lineTo(0 + horizontalPadding, height + verticalPadding);
|
|
68
|
+
+
|
|
69
|
+
+ // build() leaves the builder intact, so the gradient continues the line path.
|
|
70
|
+
+ const gradientPath = builder
|
|
71
|
+
+ .lineTo(endX, height + verticalPadding)
|
|
72
|
+
+ .lineTo(0 + horizontalPadding, height + verticalPadding)
|
|
73
|
+
+ .build();
|
|
74
|
+
return {
|
|
75
|
+
path: path,
|
|
76
|
+
gradientPath: gradientPath
|
|
77
|
+
diff --git a/src/AnimatedLineGraph.tsx b/src/AnimatedLineGraph.tsx
|
|
78
|
+
index 6b12417..f1b4b0a 100644
|
|
79
|
+
--- a/src/AnimatedLineGraph.tsx
|
|
80
|
+
+++ b/src/AnimatedLineGraph.tsx
|
|
81
|
+
@@ -133,7 +133,7 @@ export function AnimatedLineGraph({
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const straightLine = useMemo(() => {
|
|
85
|
+
- const path = Skia.Path.Make();
|
|
86
|
+
+ const path = Skia.PathBuilder.Make();
|
|
87
|
+
path.moveTo(0, height / 2);
|
|
88
|
+
for (let i = 0; i < width - 1; i += 2) {
|
|
89
|
+
const x = i;
|
|
90
|
+
@@ -141,7 +141,7 @@ export function AnimatedLineGraph({
|
|
91
|
+
path.cubicTo(x, y, x, y, x, y);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- return path;
|
|
95
|
+
+ return path.build();
|
|
96
|
+
}, [height, width]);
|
|
97
|
+
|
|
98
|
+
const paths = useSharedValue<{ from?: SkPath; to?: SkPath }>({});
|
|
99
|
+
diff --git a/src/CreateGraphPath.ts b/src/CreateGraphPath.ts
|
|
100
|
+
index 0c7f1c0..38c4065 100644
|
|
101
|
+
--- a/src/CreateGraphPath.ts
|
|
102
|
+
+++ b/src/CreateGraphPath.ts
|
|
103
|
+
@@ -144,14 +144,15 @@ function createGraphPathBase({
|
|
104
|
+
}: GraphPathConfigWithGradient | GraphPathConfigWithoutGradient):
|
|
105
|
+
| SkPath
|
|
106
|
+
| GraphPathWithGradient {
|
|
107
|
+
- const path = Skia.Path.Make();
|
|
108
|
+
+ // Skia 2 builds paths with PathBuilder; SkPath itself is immutable.
|
|
109
|
+
+ const builder = Skia.PathBuilder.Make();
|
|
110
|
+
|
|
111
|
+
// Canvas width substracted by the horizontal padding => Actual drawing width
|
|
112
|
+
const drawingWidth = width - 2 * horizontalPadding;
|
|
113
|
+
// Canvas height substracted by the vertical padding => Actual drawing height
|
|
114
|
+
const drawingHeight = height - 2 * verticalPadding;
|
|
115
|
+
|
|
116
|
+
- if (graphData[0] == null) return path;
|
|
117
|
+
+ if (graphData[0] == null) return builder.build();
|
|
118
|
+
|
|
119
|
+
const points: SkPoint[] = [];
|
|
120
|
+
|
|
121
|
+
@@ -215,7 +216,7 @@ function createGraphPathBase({
|
|
122
|
+
const point = points[i]!;
|
|
123
|
+
|
|
124
|
+
// first point needs to start the path
|
|
125
|
+
- if (i === 0) path.moveTo(point.x, point.y);
|
|
126
|
+
+ if (i === 0) builder.moveTo(point.x, point.y);
|
|
127
|
+
|
|
128
|
+
const prev = points[i - 1];
|
|
129
|
+
const prevPrev = points[i - 2];
|
|
130
|
+
@@ -231,19 +232,21 @@ function createGraphPathBase({
|
|
131
|
+
const cp3x = (p0.x + 4 * p1.x + point.x) / 6;
|
|
132
|
+
const cp3y = (p0.y + 4 * p1.y + point.y) / 6;
|
|
133
|
+
|
|
134
|
+
- path.cubicTo(cp1x, cp1y, cp2x, cp2y, cp3x, cp3y);
|
|
135
|
+
+ builder.cubicTo(cp1x, cp1y, cp2x, cp2y, cp3x, cp3y);
|
|
136
|
+
|
|
137
|
+
if (i === points.length - 1) {
|
|
138
|
+
- path.cubicTo(point.x, point.y, point.x, point.y, point.x, point.y);
|
|
139
|
+
+ builder.cubicTo(point.x, point.y, point.x, point.y, point.x, point.y);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
+ const path = builder.build();
|
|
144
|
+
if (!shouldFillGradient) return path;
|
|
145
|
+
|
|
146
|
+
- const gradientPath = path.copy();
|
|
147
|
+
-
|
|
148
|
+
- gradientPath.lineTo(endX, height + verticalPadding);
|
|
149
|
+
- gradientPath.lineTo(0 + horizontalPadding, height + verticalPadding);
|
|
150
|
+
+ // build() leaves the builder intact, so the gradient continues the line path.
|
|
151
|
+
+ const gradientPath = builder
|
|
152
|
+
+ .lineTo(endX, height + verticalPadding)
|
|
153
|
+
+ .lineTo(0 + horizontalPadding, height + verticalPadding)
|
|
154
|
+
+ .build();
|
|
155
|
+
|
|
156
|
+
return { path: path, gradientPath: gradientPath };
|
|
157
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
diff --git a/src/bindings.macos.ts b/src/bindings.macos.ts
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000..30108ce
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/src/bindings.macos.ts
|
|
6
|
+
@@ -0,0 +1,2 @@
|
|
7
|
+
+// macOS has no software keyboard: use the no-op bindings that web uses instead of the native module.
|
|
8
|
+
+export * from "./bindings.ts";
|
|
9
|
+
diff --git a/src/reanimated.macos.ts b/src/reanimated.macos.ts
|
|
10
|
+
new file mode 100644
|
|
11
|
+
index 0000000..fd25177
|
|
12
|
+
--- /dev/null
|
|
13
|
+
+++ b/src/reanimated.macos.ts
|
|
14
|
+
@@ -0,0 +1,2 @@
|
|
15
|
+
+// macOS has no software keyboard: keyboard handlers are no-ops, as on web.
|
|
16
|
+
+export * from "./reanimated.ts";
|