@amazon-devices/lottie-react-native 2.0.1758683737

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.
Files changed (60) hide show
  1. package/LICENSE +7 -0
  2. package/SystemBundles/90296ccfe5ff2db2f9fe68a18eca092f8b7c17d1125cfafc612d18788fe9bce6.bundle +10322 -0
  3. package/SystemBundles/90296ccfe5ff2db2f9fe68a18eca092f8b7c17d1125cfafc612d18788fe9bce6.map +1 -0
  4. package/SystemModules/amzn__lottie-react-native-2.modules.txt +13 -0
  5. package/SystemModules/amzn__lottie-react-native-2.private.modules.txt +92 -0
  6. package/SystemModules/keplerscript-system-bundle-config.json +7 -0
  7. package/THIRD_PARTY_NOTICES.txt +640 -0
  8. package/android/build.gradle +120 -0
  9. package/android/gradle.properties +27 -0
  10. package/android/src/main/AndroidManifest.xml +6 -0
  11. package/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewManagerImpl.kt +260 -0
  12. package/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewPropertyManager.kt +156 -0
  13. package/android/src/main/java/com/airbnb/android/react/lottie/LottiePackage.kt +18 -0
  14. package/android/src/newarch/com/airbnb/android/react/lottie/LottieAnimationViewManager.kt +219 -0
  15. package/android/src/oldarch/com/airbnb/android/react/lottie/LottieAnimationViewManager.kt +187 -0
  16. package/ios/Fabric/LottieAnimationViewComponentView.h +28 -0
  17. package/ios/Fabric/LottieAnimationViewComponentView.mm +140 -0
  18. package/ios/Fabric/LottieContainerView.h +33 -0
  19. package/ios/Fabric/RNLottieFabricConversions.h +29 -0
  20. package/ios/LottieReactNative/AnimationViewManagerModule.swift +88 -0
  21. package/ios/LottieReactNative/Bridging.h +4 -0
  22. package/ios/LottieReactNative/ContainerView.swift +281 -0
  23. package/ios/LottieReactNative/LRNAnimationViewManagerObjC.m +25 -0
  24. package/ios/LottieReactNative/PlatformColor.swift +31 -0
  25. package/ios/LottieReactNative/RCTConvert+Lottie.h +7 -0
  26. package/ios/LottieReactNative/RCTConvert+Lottie.m +24 -0
  27. package/ios/LottieReactNative.xcodeproj/project.pbxproj +449 -0
  28. package/ios/LottieReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  29. package/ios/LottieReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  30. package/kepler-compatibility.json +8 -0
  31. package/kepler-transformed-package-info.json +3 -0
  32. package/lib/commonjs/LottieView.js +207 -0
  33. package/lib/commonjs/LottieView.js.map +1 -0
  34. package/lib/commonjs/LottieView.types.js +6 -0
  35. package/lib/commonjs/LottieView.types.js.map +1 -0
  36. package/lib/commonjs/index.js +9 -0
  37. package/lib/commonjs/index.js.map +1 -0
  38. package/lib/commonjs/specs/LottieAnimationViewNativeComponent.js +97 -0
  39. package/lib/commonjs/specs/LottieAnimationViewNativeComponent.js.map +1 -0
  40. package/lib/module/LottieView.js +201 -0
  41. package/lib/module/LottieView.js.map +1 -0
  42. package/lib/module/LottieView.types.js +2 -0
  43. package/lib/module/LottieView.types.js.map +1 -0
  44. package/lib/module/index.js +3 -0
  45. package/lib/module/index.js.map +1 -0
  46. package/lib/module/specs/LottieAnimationViewNativeComponent.js +91 -0
  47. package/lib/module/specs/LottieAnimationViewNativeComponent.js.map +1 -0
  48. package/lib/typescript/LottieView.d.ts +27 -0
  49. package/lib/typescript/LottieView.types.d.ts +206 -0
  50. package/lib/typescript/index.d.ts +2 -0
  51. package/lib/typescript/specs/LottieAnimationViewNativeComponent.d.ts +61 -0
  52. package/lottie-react-native.podspec +44 -0
  53. package/package.json +1 -0
  54. package/react-native.config.js +32 -0
  55. package/src/LottieView.tsx +257 -0
  56. package/src/LottieView.types.ts +275 -0
  57. package/src/__tests__/__snapshots__/validate-public-api.test.js.snap +248 -0
  58. package/src/__tests__/validate-public-api.test.js +33 -0
  59. package/src/index.tsx +2 -0
  60. package/src/specs/LottieAnimationViewNativeComponent.ts +170 -0
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Portions of this file are copyright (c) 2023 Amazon.com, Inc. or its affiliates. All rights reserved.
3
+ *
4
+ * PORTIONS OF THIS FILE ARE AMAZON PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS.
5
+ *
6
+ * Amazon modifications are indicated by [amznmod_* comments].
7
+ */
8
+
9
+ /*
10
+ * Changelog:
11
+ * Set up lottie-react-native package to build for Kepler
12
+ */
13
+
14
+ import type {
15
+ BubblingEventHandler,
16
+ Int32,
17
+ Double,
18
+ Float,
19
+ } from 'react-native/Libraries/Types/CodegenTypes';
20
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
21
+ import type { HostComponent, ProcessedColorValue, ViewProps } from 'react-native';
22
+ import register from '@amazon-devices/react-native-kepler/Libraries/Utilities/registerGeneratedViewConfig';
23
+
24
+ export type OnAnimationFinishEvent = Readonly<{
25
+ isCancelled: boolean;
26
+ }>;
27
+
28
+ // amznmod_react - add EmptyEvent type
29
+ export type EmptyEvent = {
30
+ // Nothing to return in this event
31
+ };
32
+
33
+ type ColorFilterStruct = Readonly<{
34
+ keypath: string;
35
+ color: ProcessedColorValue;
36
+ }>;
37
+
38
+ type TextFilterIOSStruct = Readonly<{
39
+ keypath: string;
40
+ text: string;
41
+ }>;
42
+
43
+ type TextFilterAndroidStruct = Readonly<{
44
+ find: string;
45
+ replace: string;
46
+ }>;
47
+
48
+ type TextFilterKeplerStruct = Readonly<{
49
+ keypath: string;
50
+ text: string;
51
+ }>;
52
+
53
+ export interface NativeProps extends ViewProps {
54
+ // amznmod_react - add autoPlay as native prop to avoid component mount race condition
55
+ autoPlay?: boolean;
56
+ resizeMode?: string;
57
+ renderMode?: string;
58
+ sourceName?: string;
59
+ sourceJson?: string;
60
+ sourceURL?: string;
61
+ imageAssetsFolder?: string;
62
+ progress?: Float;
63
+ speed?: Double;
64
+ loop?: boolean;
65
+ enableMergePathsAndroidForKitKatAndAbove?: boolean;
66
+ hardwareAccelerationAndroid?: boolean;
67
+ cacheComposition?: boolean;
68
+ colorFilters?: ReadonlyArray<ColorFilterStruct>;
69
+ // dummy that solves codegen issue when there's a ReadonlyArray<Object> without another Object prop
70
+ // https://github.com/reactwg/react-native-new-architecture/discussions/104
71
+ dummy?: Readonly<{ dummy: boolean }>;
72
+ textFiltersAndroid?: ReadonlyArray<TextFilterAndroidStruct>;
73
+ textFiltersIOS?: ReadonlyArray<TextFilterIOSStruct>;
74
+ // amznmod_react - add textFiltersKepler prop
75
+ textFiltersKepler?: ReadonlyArray<TextFilterKeplerStruct>;
76
+ onAnimationFinish?: BubblingEventHandler<
77
+ OnAnimationFinishEvent,
78
+ 'onAnimationFinish'
79
+ >;
80
+ // amznmod_react - add onAnimation... callbacks
81
+ onAnimationLoad?: BubblingEventHandler<EmptyEvent>;
82
+ onAnimationPlay?: BubblingEventHandler<EmptyEvent>;
83
+ onAnimationPause?: BubblingEventHandler<EmptyEvent>;
84
+ onAnimationResume?: BubblingEventHandler<EmptyEvent>;
85
+ // PROJ*-136246 - deprecate onAnimationJsonLoad in MR33
86
+ onAnimationJsonLoad?: BubblingEventHandler<EmptyEvent>;
87
+ }
88
+
89
+ // amznmod_react - change NativeComponentType to HostComponent
90
+ type LottieViewNativeComponentType = HostComponent<NativeProps>;
91
+
92
+ interface NativeCommands {
93
+ play: (
94
+ viewRef: React.ElementRef<LottieViewNativeComponentType>,
95
+ startFrame: Int32,
96
+ endFrame: Int32,
97
+ ) => void;
98
+ reset: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
99
+ pause: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
100
+ resume: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
101
+ }
102
+
103
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
104
+ supportedCommands: ['play', 'reset', 'pause', 'resume'],
105
+ });
106
+
107
+ // amznmod_react - native component registration to build for Kepler
108
+ const LottieNativeComponent = 'LottieAnimationView'
109
+ const viewConfig = {
110
+ autoPlay: true,
111
+ sourceName: true,
112
+ resizeMode: true,
113
+ renderMode: true,
114
+ sourceJson: true,
115
+ sourceURL: true,
116
+ imageAssetsFolder: true,
117
+ progress: true,
118
+ speed: true,
119
+ loop: true,
120
+ enableMergePathsAndroidForKitKatAndAbove: true,
121
+ hardwareAccelerationAndroid: true,
122
+ cacheComposition: true,
123
+ colorFilters: true,
124
+ textFiltersAndroid: true,
125
+ textFiltersIOS: true,
126
+ textFiltersKepler: true,
127
+ };
128
+
129
+ const bubblingEventTypes = {
130
+ topOnAnimationFinish: {
131
+ phasedRegistrationNames: {
132
+ bubbled: 'onAnimationFinish',
133
+ captured: 'onAnimationFinishCapture'
134
+ }
135
+ },
136
+ topOnAnimationLoad: {
137
+ phasedRegistrationNames: {
138
+ bubbled: 'onAnimationLoad',
139
+ captured: 'onAnimationLoadCapture'
140
+ }
141
+ },
142
+ // PROJ*-136246 - deprecate onAnimationJsonLoad in MR33
143
+ topOnAnimationJsonLoad: {
144
+ phasedRegistrationNames: {
145
+ bubbled: 'onAnimationJsonLoad',
146
+ captured: 'onAnimationJsonLoadCapture'
147
+ }
148
+ },
149
+ topOnAnimationPlay: {
150
+ phasedRegistrationNames: {
151
+ bubbled: 'onAnimationPlay',
152
+ captured: 'onAnimationPlayCapture'
153
+ }
154
+ },
155
+ topOnAnimationPause: {
156
+ phasedRegistrationNames: {
157
+ bubbled: 'onAnimationPause',
158
+ captured: 'onAnimationPauseCapture'
159
+ }
160
+ },
161
+ topOnAnimationResume: {
162
+ phasedRegistrationNames: {
163
+ bubbled: 'onAnimationResume',
164
+ captured: 'onAnimationResumeCapture'
165
+ }
166
+ }
167
+ };
168
+
169
+ register(LottieNativeComponent, {uiViewClassName: LottieNativeComponent, validAttributes: viewConfig, bubblingEventTypes: bubblingEventTypes});
170
+ export default (LottieNativeComponent as unknown) as HostComponent<NativeProps>;