@shopify/react-native-skia 2.3.7 → 2.3.9
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/cpp/api/JsiNativeBuffer.h +4 -0
 - package/cpp/api/JsiSkAnimatedImage.h +71 -1
 - package/cpp/api/JsiSkAnimatedImageFactory.h +4 -0
 - package/cpp/api/JsiSkApi.h +2 -0
 - package/cpp/api/JsiSkCanvas.h +2 -0
 - package/cpp/api/JsiSkColorFilter.h +2 -0
 - package/cpp/api/JsiSkColorFilterFactory.h +4 -0
 - package/cpp/api/JsiSkContourMeasure.h +2 -0
 - package/cpp/api/JsiSkContourMeasureIter.h +4 -0
 - package/cpp/api/JsiSkData.h +2 -0
 - package/cpp/api/JsiSkDataFactory.h +2 -0
 - package/cpp/api/JsiSkFont.h +2 -0
 - package/cpp/api/JsiSkFontMgr.h +2 -0
 - package/cpp/api/JsiSkFontMgrFactory.h +2 -0
 - package/cpp/api/JsiSkFontStyle.h +2 -0
 - package/cpp/api/JsiSkHostObjects.h +50 -0
 - package/cpp/api/JsiSkImage.h +3 -1
 - package/cpp/api/JsiSkImageFactory.h +2 -0
 - package/cpp/api/JsiSkImageFilter.h +3 -1
 - package/cpp/api/JsiSkImageFilterFactory.h +4 -0
 - package/cpp/api/JsiSkImageInfo.h +2 -0
 - package/cpp/api/JsiSkMaskFilter.h +2 -0
 - package/cpp/api/JsiSkMaskFilterFactory.h +4 -0
 - package/cpp/api/JsiSkMatrix.h +2 -0
 - package/cpp/api/JsiSkPaint.h +2 -0
 - package/cpp/api/JsiSkParagraph.h +3 -1
 - package/cpp/api/JsiSkParagraphBuilder.h +3 -1
 - package/cpp/api/JsiSkParagraphBuilderFactory.h +5 -1
 - package/cpp/api/JsiSkPath.h +2 -0
 - package/cpp/api/JsiSkPathEffect.h +2 -0
 - package/cpp/api/JsiSkPathEffectFactory.h +4 -0
 - package/cpp/api/JsiSkPathFactory.h +2 -0
 - package/cpp/api/JsiSkPicture.h +2 -0
 - package/cpp/api/JsiSkPictureFactory.h +10 -0
 - package/cpp/api/JsiSkPictureRecorder.h +3 -3
 - package/cpp/api/JsiSkPoint.h +2 -0
 - package/cpp/api/JsiSkRRect.h +2 -0
 - package/cpp/api/JsiSkRSXform.h +2 -0
 - package/cpp/api/JsiSkRect.h +2 -0
 - package/cpp/api/JsiSkRuntimeEffect.h +2 -0
 - package/cpp/api/JsiSkRuntimeEffectFactory.h +4 -0
 - package/cpp/api/JsiSkRuntimeShaderBuilder.h +4 -0
 - package/cpp/api/JsiSkSVG.h +2 -0
 - package/cpp/api/JsiSkSVGFactory.h +2 -0
 - package/cpp/api/JsiSkShader.h +3 -1
 - package/cpp/api/JsiSkShaderFactory.h +2 -0
 - package/cpp/api/JsiSkSkottie.h +2 -0
 - package/cpp/api/JsiSkSurface.h +50 -7
 - package/cpp/api/JsiSkSurfaceFactory.h +2 -0
 - package/cpp/api/JsiSkTextBlob.h +2 -0
 - package/cpp/api/JsiSkTextBlobFactory.h +2 -0
 - package/cpp/api/JsiSkTypeface.h +2 -0
 - package/cpp/api/JsiSkTypefaceFactory.h +2 -0
 - package/cpp/api/JsiSkTypefaceFontProvider.h +4 -0
 - package/cpp/api/JsiSkTypefaceFontProviderFactory.h +4 -0
 - package/cpp/api/JsiSkVertices.h +2 -0
 - package/cpp/api/JsiSkiaContext.h +3 -1
 - package/cpp/api/JsiSkottieFactory.h +2 -0
 - package/cpp/api/JsiVideo.h +2 -0
 - package/cpp/api/recorder/JsiRecorder.h +42 -7
 - package/cpp/jsi/ViewProperty.h +32 -1
 - package/lib/commonjs/skia/types/Picture/PictureFactory.d.ts +1 -1
 - package/lib/commonjs/skia/types/Picture/PictureFactory.js.map +1 -1
 - package/lib/commonjs/skia/types/Recorder.d.ts +2 -1
 - package/lib/commonjs/skia/types/Recorder.js.map +1 -1
 - package/lib/commonjs/sksg/Container.native.d.ts +4 -0
 - package/lib/commonjs/sksg/Container.native.js +18 -6
 - package/lib/commonjs/sksg/Container.native.js.map +1 -1
 - package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
 - package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +4 -0
 - package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
 - package/lib/module/skia/types/Picture/PictureFactory.d.ts +1 -1
 - package/lib/module/skia/types/Picture/PictureFactory.js.map +1 -1
 - package/lib/module/skia/types/Recorder.d.ts +2 -1
 - package/lib/module/skia/types/Recorder.js.map +1 -1
 - package/lib/module/sksg/Container.native.d.ts +4 -0
 - package/lib/module/sksg/Container.native.js +18 -6
 - package/lib/module/sksg/Container.native.js.map +1 -1
 - package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
 - package/lib/module/sksg/Recorder/ReanimatedRecorder.js +4 -0
 - package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
 - package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +5 -0
 - package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
 - package/lib/typescript/lib/module/sksg/Container.native.d.ts +5 -0
 - package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
 - package/lib/typescript/src/skia/types/Picture/PictureFactory.d.ts +1 -1
 - package/lib/typescript/src/skia/types/Recorder.d.ts +2 -1
 - package/lib/typescript/src/sksg/Container.native.d.ts +4 -0
 - package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
 - package/package.json +1 -1
 - package/src/skia/types/Picture/PictureFactory.ts +1 -1
 - package/src/skia/types/Recorder.ts +2 -1
 - package/src/sksg/Container.native.ts +25 -7
 - package/src/sksg/Recorder/ReanimatedRecorder.ts +5 -0
 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n  TextProps,\n  AtlasProps,\n  BlurMaskFilterProps,\n  BoxProps,\n  BoxShadowProps,\n  CircleProps,\n  CTMProps,\n  DiffRectProps,\n  GlyphsProps,\n  ImageProps,\n  ImageSVGProps,\n  LineProps,\n  NodeType,\n  OvalProps,\n  PaintProps,\n  ParagraphProps,\n  PatchProps,\n  PathProps,\n  PictureProps,\n  PointsProps,\n  RectProps,\n  RoundedRectProps,\n  TextBlobProps,\n  TextPathProps,\n  VerticesProps,\n  SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n  saveGroup(): void;\n  restoreGroup(): void;\n  savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n  restorePaint(): void;\n  restorePaintDeclaration(): void;\n  materializePaint(): void;\n  pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n  pushImageFilter(\n    imageFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void;\n  pushColorFilter(\n    colorFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void;\n  pushShader(\n    shaderType: NodeType,\n    props: AnimatedProps<unknown>,\n    children: number\n  ): void;\n  pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n  composePathEffect(): void;\n  composeColorFilter(): void;\n  composeImageFilter(): void;\n  saveCTM(props: AnimatedProps<CTMProps>): void;\n  restoreCTM(): void;\n  drawPaint(): void;\n  saveLayer(): void;\n  saveBackdropFilter(): void;\n  drawBox(\n    boxProps: AnimatedProps<BoxProps>,\n    shadows: {\n      props: BoxShadowProps;\n      animatedProps?: Record<string, SharedValue<unknown>>;\n    }[]\n  ): void;\n  drawImage(props: AnimatedProps<ImageProps>): void;\n  drawCircle(props: AnimatedProps<CircleProps>): void;\n  drawPoints(props: AnimatedProps<PointsProps>): void;\n  drawPath(props: AnimatedProps<PathProps>): void;\n  drawRect(props: AnimatedProps<RectProps>): void;\n  drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n  drawOval(props: AnimatedProps<OvalProps>): void;\n  drawLine(props: AnimatedProps<LineProps>): void;\n  drawPatch(props: AnimatedProps<PatchProps>): void;\n  drawVertices(props: AnimatedProps<VerticesProps>): void;\n  drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n  drawText(props: AnimatedProps<TextProps>): void;\n  drawTextPath(props: AnimatedProps<TextPathProps>): void;\n  drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n  drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n  drawPicture(props: AnimatedProps<PictureProps>): void;\n  drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n  drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n  drawSkottie(props: AnimatedProps<SkottieProps>): void;\n  drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n  play():  
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n  TextProps,\n  AtlasProps,\n  BlurMaskFilterProps,\n  BoxProps,\n  BoxShadowProps,\n  CircleProps,\n  CTMProps,\n  DiffRectProps,\n  GlyphsProps,\n  ImageProps,\n  ImageSVGProps,\n  LineProps,\n  NodeType,\n  OvalProps,\n  PaintProps,\n  ParagraphProps,\n  PatchProps,\n  PathProps,\n  PictureProps,\n  PointsProps,\n  RectProps,\n  RoundedRectProps,\n  TextBlobProps,\n  TextPathProps,\n  VerticesProps,\n  SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n  saveGroup(): void;\n  restoreGroup(): void;\n  savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n  restorePaint(): void;\n  restorePaintDeclaration(): void;\n  materializePaint(): void;\n  pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n  pushImageFilter(\n    imageFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void;\n  pushColorFilter(\n    colorFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void;\n  pushShader(\n    shaderType: NodeType,\n    props: AnimatedProps<unknown>,\n    children: number\n  ): void;\n  pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n  composePathEffect(): void;\n  composeColorFilter(): void;\n  composeImageFilter(): void;\n  saveCTM(props: AnimatedProps<CTMProps>): void;\n  restoreCTM(): void;\n  drawPaint(): void;\n  saveLayer(): void;\n  saveBackdropFilter(): void;\n  drawBox(\n    boxProps: AnimatedProps<BoxProps>,\n    shadows: {\n      props: BoxShadowProps;\n      animatedProps?: Record<string, SharedValue<unknown>>;\n    }[]\n  ): void;\n  drawImage(props: AnimatedProps<ImageProps>): void;\n  drawCircle(props: AnimatedProps<CircleProps>): void;\n  drawPoints(props: AnimatedProps<PointsProps>): void;\n  drawPath(props: AnimatedProps<PathProps>): void;\n  drawRect(props: AnimatedProps<RectProps>): void;\n  drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n  drawOval(props: AnimatedProps<OvalProps>): void;\n  drawLine(props: AnimatedProps<LineProps>): void;\n  drawPatch(props: AnimatedProps<PatchProps>): void;\n  drawVertices(props: AnimatedProps<VerticesProps>): void;\n  drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n  drawText(props: AnimatedProps<TextProps>): void;\n  drawTextPath(props: AnimatedProps<TextPathProps>): void;\n  drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n  drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n  drawPicture(props: AnimatedProps<PictureProps>): void;\n  drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n  drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n  drawSkottie(props: AnimatedProps<SkottieProps>): void;\n  drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n  play(picture: SkPicture): void;\n  applyUpdates(variables: SharedValue<unknown>[]): void;\n  reset(): void;\n}\n"],"mappings":"","ignoreList":[]}
         
     | 
| 
         @@ -5,6 +5,10 @@ import "../views/api"; 
     | 
|
| 
       5 
5 
     | 
    
         
             
            declare class NativeReanimatedContainer extends Container {
         
     | 
| 
       6 
6 
     | 
    
         
             
                private nativeId;
         
     | 
| 
       7 
7 
     | 
    
         
             
                private mapperId;
         
     | 
| 
      
 8 
     | 
    
         
            +
                private picture;
         
     | 
| 
      
 9 
     | 
    
         
            +
                private recorderA;
         
     | 
| 
      
 10 
     | 
    
         
            +
                private recorderB;
         
     | 
| 
      
 11 
     | 
    
         
            +
                private currentRecorder;
         
     | 
| 
       8 
12 
     | 
    
         
             
                constructor(Skia: Skia, nativeId: number);
         
     | 
| 
       9 
13 
     | 
    
         
             
                redraw(): void;
         
     | 
| 
       10 
14 
     | 
    
         
             
            }
         
     | 
| 
         @@ -8,11 +8,11 @@ import { Container, StaticContainer } from "./StaticContainer"; 
     | 
|
| 
       8 
8 
     | 
    
         
             
            import { visit } from "./Recorder/Visitor";
         
     | 
| 
       9 
9 
     | 
    
         
             
            import "../skia/NativeSetup";
         
     | 
| 
       10 
10 
     | 
    
         
             
            import "../views/api";
         
     | 
| 
       11 
     | 
    
         
            -
            const nativeDrawOnscreen = (nativeId, recorder) => {
         
     | 
| 
      
 11 
     | 
    
         
            +
            const nativeDrawOnscreen = (nativeId, recorder, picture) => {
         
     | 
| 
       12 
12 
     | 
    
         
             
              "worklet";
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              //const start = performance.now();
         
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
      
 15 
     | 
    
         
            +
              recorder.play(picture);
         
     | 
| 
       16 
16 
     | 
    
         
             
              //const end = performance.now();
         
     | 
| 
       17 
17 
     | 
    
         
             
              //console.log("Recording time: ", end - start);
         
     | 
| 
       18 
18 
     | 
    
         
             
              SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
         
     | 
| 
         @@ -22,6 +22,14 @@ class NativeReanimatedContainer extends Container { 
     | 
|
| 
       22 
22 
     | 
    
         
             
                super(Skia);
         
     | 
| 
       23 
23 
     | 
    
         
             
                this.nativeId = nativeId;
         
     | 
| 
       24 
24 
     | 
    
         
             
                _defineProperty(this, "mapperId", null);
         
     | 
| 
      
 25 
     | 
    
         
            +
                _defineProperty(this, "picture", void 0);
         
     | 
| 
      
 26 
     | 
    
         
            +
                _defineProperty(this, "recorderA", void 0);
         
     | 
| 
      
 27 
     | 
    
         
            +
                _defineProperty(this, "recorderB", void 0);
         
     | 
| 
      
 28 
     | 
    
         
            +
                _defineProperty(this, "currentRecorder", void 0);
         
     | 
| 
      
 29 
     | 
    
         
            +
                this.recorderA = new ReanimatedRecorder(Skia);
         
     | 
| 
      
 30 
     | 
    
         
            +
                this.recorderB = new ReanimatedRecorder(Skia);
         
     | 
| 
      
 31 
     | 
    
         
            +
                this.currentRecorder = this.recorderA;
         
     | 
| 
      
 32 
     | 
    
         
            +
                this.picture = Skia.Picture.MakePicture(null);
         
     | 
| 
       25 
33 
     | 
    
         
             
              }
         
     | 
| 
       26 
34 
     | 
    
         
             
              redraw() {
         
     | 
| 
       27 
35 
     | 
    
         
             
                if (this.mapperId !== null) {
         
     | 
| 
         @@ -30,25 +38,29 @@ class NativeReanimatedContainer extends Container { 
     | 
|
| 
       30 
38 
     | 
    
         
             
                if (this.unmounted) {
         
     | 
| 
       31 
39 
     | 
    
         
             
                  return;
         
     | 
| 
       32 
40 
     | 
    
         
             
                }
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                // Swap to the next recorder (double buffering)
         
     | 
| 
      
 43 
     | 
    
         
            +
                const recorder = this.currentRecorder;
         
     | 
| 
      
 44 
     | 
    
         
            +
                this.currentRecorder = this.currentRecorder === this.recorderA ? this.recorderB : this.recorderA;
         
     | 
| 
       33 
45 
     | 
    
         
             
                const {
         
     | 
| 
       34 
46 
     | 
    
         
             
                  nativeId,
         
     | 
| 
       35 
     | 
    
         
            -
                   
     | 
| 
      
 47 
     | 
    
         
            +
                  picture
         
     | 
| 
       36 
48 
     | 
    
         
             
                } = this;
         
     | 
| 
       37 
     | 
    
         
            -
                 
     | 
| 
      
 49 
     | 
    
         
            +
                recorder.reset();
         
     | 
| 
       38 
50 
     | 
    
         
             
                visit(recorder, this.root);
         
     | 
| 
       39 
51 
     | 
    
         
             
                const sharedValues = recorder.getSharedValues();
         
     | 
| 
       40 
52 
     | 
    
         
             
                const sharedRecorder = recorder.getRecorder();
         
     | 
| 
       41 
53 
     | 
    
         
             
                Rea.runOnUI(() => {
         
     | 
| 
       42 
54 
     | 
    
         
             
                  "worklet";
         
     | 
| 
       43 
55 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                  nativeDrawOnscreen(nativeId, sharedRecorder);
         
     | 
| 
      
 56 
     | 
    
         
            +
                  nativeDrawOnscreen(nativeId, sharedRecorder, picture);
         
     | 
| 
       45 
57 
     | 
    
         
             
                })();
         
     | 
| 
       46 
58 
     | 
    
         
             
                if (sharedValues.length > 0) {
         
     | 
| 
       47 
59 
     | 
    
         
             
                  this.mapperId = Rea.startMapper(() => {
         
     | 
| 
       48 
60 
     | 
    
         
             
                    "worklet";
         
     | 
| 
       49 
61 
     | 
    
         | 
| 
       50 
62 
     | 
    
         
             
                    sharedRecorder.applyUpdates(sharedValues);
         
     | 
| 
       51 
     | 
    
         
            -
                    nativeDrawOnscreen(nativeId, sharedRecorder);
         
     | 
| 
      
 63 
     | 
    
         
            +
                    nativeDrawOnscreen(nativeId, sharedRecorder, picture);
         
     | 
| 
       52 
64 
     | 
    
         
             
                  }, sharedValues);
         
     | 
| 
       53 
65 
     | 
    
         
             
                }
         
     | 
| 
       54 
66 
     | 
    
         
             
              }
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"names":["Rea","HAS_REANIMATED_3","ReanimatedRecorder","Container","StaticContainer","visit","nativeDrawOnscreen","nativeId","recorder","picture","play","SkiaViewApi","setJsiProperty","NativeReanimatedContainer","constructor","Skia","_defineProperty","redraw","mapperId","stopMapper","unmounted","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","createContainer"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\nconst nativeDrawOnscreen = (nativeId: number 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"names":["Rea","HAS_REANIMATED_3","ReanimatedRecorder","Container","StaticContainer","visit","nativeDrawOnscreen","nativeId","recorder","picture","play","SkiaViewApi","setJsiProperty","NativeReanimatedContainer","constructor","Skia","_defineProperty","recorderA","recorderB","currentRecorder","Picture","MakePicture","redraw","mapperId","stopMapper","unmounted","reset","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","createContainer"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkPicture } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\nconst nativeDrawOnscreen = (\n  nativeId: number,\n  recorder: JsiRecorder,\n  picture: SkPicture\n) => {\n  \"worklet\";\n\n  //const start = performance.now();\n  recorder.play(picture);\n  //const end = performance.now();\n  //console.log(\"Recording time: \", end - start);\n  SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nclass NativeReanimatedContainer extends Container {\n  private mapperId: number | null = null;\n  private picture: SkPicture;\n  private recorderA: ReanimatedRecorder;\n  private recorderB: ReanimatedRecorder;\n  private currentRecorder: ReanimatedRecorder;\n\n  constructor(\n    Skia: Skia,\n    private nativeId: number\n  ) {\n    super(Skia);\n    this.recorderA = new ReanimatedRecorder(Skia);\n    this.recorderB = new ReanimatedRecorder(Skia);\n    this.currentRecorder = this.recorderA;\n    this.picture = Skia.Picture.MakePicture(null)!;\n  }\n\n  redraw() {\n    if (this.mapperId !== null) {\n      Rea.stopMapper(this.mapperId);\n    }\n    if (this.unmounted) {\n      return;\n    }\n\n    // Swap to the next recorder (double buffering)\n    const recorder = this.currentRecorder;\n    this.currentRecorder =\n      this.currentRecorder === this.recorderA ? this.recorderB : this.recorderA;\n\n    const { nativeId, picture } = this;\n    recorder.reset();\n    visit(recorder, this.root);\n    const sharedValues = recorder.getSharedValues();\n    const sharedRecorder = recorder.getRecorder();\n    Rea.runOnUI(() => {\n      \"worklet\";\n      nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n    })();\n    if (sharedValues.length > 0) {\n      this.mapperId = Rea.startMapper(() => {\n        \"worklet\";\n        sharedRecorder.applyUpdates(sharedValues);\n        nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n      }, sharedValues);\n    }\n  }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n  if (HAS_REANIMATED_3 && nativeId !== -1) {\n    return new NativeReanimatedContainer(Skia, nativeId);\n  } else {\n    return new StaticContainer(Skia, nativeId);\n  }\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SAASC,gBAAgB,QAAQ,sCAAsC;AAGvE,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,S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AAQ,CAAC,GAAG,IAAI;IAClCD,QAAQ,CAACkB,KAAK,CAAC,CAAC;IAChBrB,KAAK,CAACG,QAAQ,EAAE,IAAI,CAACmB,IAAI,CAAC;IAC1B,MAAMC,YAAY,GAAGpB,QAAQ,CAACqB,eAAe,CAAC,CAAC;IAC/C,MAAMC,cAAc,GAAGtB,QAAQ,CAACuB,WAAW,CAAC,CAAC;IAC7C/B,GAAG,CAACgC,OAAO,CAAC,MAAM;MAChB,SAAS;;MACT1B,kBAAkB,CAACC,QAAQ,EAAEuB,cAAc,EAAErB,OAAO,CAAC;IACvD,CAAC,CAAC,CAAC,CAAC;IACJ,IAAImB,YAAY,CAACK,MAAM,GAAG,CAAC,EAAE;MAC3B,IAAI,CAACV,QAAQ,GAAGvB,GAAG,CAACkC,WAAW,CAAC,MAAM;QACpC,SAAS;;QACTJ,cAAc,CAACK,YAAY,CAACP,YAAY,CAAC;QACzCtB,kBAAkB,CAACC,QAAQ,EAAEuB,cAAc,EAAErB,OAAO,CAAC;MACvD,CAAC,EAAEmB,YAAY,CAAC;IAClB;EACF;AACF;AAEA,OAAO,MAAMQ,eAAe,GAAGA,CAACrB,IAAU,EAAER,QAAgB,KAAK;EAC/D,IAAIN,gBAAgB,IAAIM,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,OAAO,IAAIM,yBAAyB,CAACE,IAAI,EAAER,QAAQ,CAAC;EACtD,CAAC,MAAM;IACL,OAAO,IAAIH,eAAe,CAACW,IAAI,EAAER,QAAQ,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
         
     | 
| 
         @@ -10,6 +10,7 @@ export declare class ReanimatedRecorder implements BaseRecorder { 
     | 
|
| 
       10 
10 
     | 
    
         
             
                private values;
         
     | 
| 
       11 
11 
     | 
    
         
             
                private recorder;
         
     | 
| 
       12 
12 
     | 
    
         
             
                constructor(Skia: Skia);
         
     | 
| 
      
 13 
     | 
    
         
            +
                reset(): void;
         
     | 
| 
       13 
14 
     | 
    
         
             
                private processAnimationValues;
         
     | 
| 
       14 
15 
     | 
    
         
             
                getRecorder(): JsiRecorder;
         
     | 
| 
       15 
16 
     | 
    
         
             
                getSharedValues(): SharedValue<unknown>[];
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","processAnimationValues","props","Object","values","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n  PaintProps,\n  NodeType,\n  BlurMaskFilterProps,\n  CTMProps,\n  BoxProps,\n  BoxShadowProps,\n  ImageProps,\n  CircleProps,\n  PointsProps,\n  PathProps,\n  RectProps,\n  RoundedRectProps,\n  OvalProps,\n  LineProps,\n  PatchProps,\n  VerticesProps,\n  DiffRectProps,\n  TextProps,\n  TextPathProps,\n  TextBlobProps,\n  GlyphsProps,\n  PictureProps,\n  ImageSVGProps,\n  ParagraphProps,\n  AtlasProps,\n  SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n  private values = new Set<SharedValue<unknown>>();\n  private recorder: JsiRecorder;\n\n  constructor(Skia: Skia) {\n    this.recorder = Skia.Recorder();\n  }\n\n  private processAnimationValues(props?: Record<string, unknown>) {\n    if (!props) {\n      return;\n    }\n    Object.values(props).forEach((value) => {\n      if (isSharedValue(value) && !this.values.has(value)) {\n        // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n        // @ts-expect-error\n        value.name = `variable${this.values.size}`;\n        this.values.add(value as SharedValue<unknown>);\n      }\n    });\n  }\n\n  getRecorder() {\n    return this.recorder;\n  }\n\n  getSharedValues() {\n    return Array.from(this.values);\n  }\n\n  saveGroup(): void {\n    this.recorder.saveGroup();\n  }\n\n  restoreGroup(): void {\n    this.recorder.restoreGroup();\n  }\n\n  savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n    this.processAnimationValues(props);\n    this.recorder.savePaint(props, standalone);\n  }\n\n  restorePaint(): void {\n    this.recorder.restorePaint();\n  }\n\n  restorePaintDeclaration(): void {\n    this.recorder.restorePaintDeclaration();\n  }\n\n  materializePaint(): void {\n    this.recorder.materializePaint();\n  }\n\n  pushPathEffect(\n    pathEffectType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushPathEffect(pathEffectType, props);\n  }\n\n  pushImageFilter(\n    imageFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushImageFilter(imageFilterType, props);\n  }\n\n  pushColorFilter(\n    colorFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushColorFilter(colorFilterType, props);\n  }\n\n  pushShader(\n    shaderType: NodeType,\n    props: AnimatedProps<unknown>,\n    children: number\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushShader(shaderType, props, children);\n  }\n\n  pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.pushBlurMaskFilter(props);\n  }\n\n  composePathEffect(): void {\n    this.recorder.composePathEffect();\n  }\n\n  composeColorFilter(): void {\n    this.recorder.composeColorFilter();\n  }\n\n  composeImageFilter(): void {\n    this.recorder.composeImageFilter();\n  }\n\n  saveCTM(props: AnimatedProps<CTMProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.saveCTM(props);\n  }\n\n  restoreCTM(): void {\n    this.recorder.restoreCTM();\n  }\n\n  drawPaint(): void {\n    this.recorder.drawPaint();\n  }\n\n  saveLayer(): void {\n    this.recorder.saveLayer();\n  }\n\n  saveBackdropFilter(): void {\n    this.recorder.saveBackdropFilter();\n  }\n\n  drawBox(\n    boxProps: AnimatedProps<BoxProps>,\n    shadows: {\n      props: BoxShadowProps;\n    }[]\n  ): void {\n    this.processAnimationValues(boxProps);\n    shadows.forEach((shadow) => {\n      this.processAnimationValues(\n        shadow.props as AnimatedProps<BoxShadowProps>\n      );\n    });\n    this.recorder.drawBox(\n      boxProps,\n      // TODO: Fix this type BaseRecorder.drawBox()\n      // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n      // @ts-expect-error\n      shadows.map((s) => s.props)\n    );\n  }\n\n  drawImage(props: AnimatedProps<ImageProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawImage(props);\n  }\n\n  drawCircle(props: AnimatedProps<CircleProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawCircle(props);\n  }\n\n  drawPoints(props: AnimatedProps<PointsProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPoints(props);\n  }\n\n  drawPath(props: AnimatedProps<PathProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPath(props);\n  }\n\n  drawRect(props: AnimatedProps<RectProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawRect(props);\n  }\n\n  drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawRRect(props);\n  }\n\n  drawOval(props: AnimatedProps<OvalProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawOval(props);\n  }\n\n  drawLine(props: AnimatedProps<LineProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawLine(props);\n  }\n\n  drawPatch(props: AnimatedProps<PatchProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPatch(props);\n  }\n\n  drawVertices(props: AnimatedProps<VerticesProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawVertices(props);\n  }\n\n  drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawDiffRect(props);\n  }\n\n  drawText(props: AnimatedProps<TextProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawText(props);\n  }\n\n  drawTextPath(props: AnimatedProps<TextPathProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawTextPath(props);\n  }\n\n  drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawTextBlob(props);\n  }\n\n  drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawGlyphs(props);\n  }\n\n  drawPicture(props: AnimatedProps<PictureProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPicture(props);\n  }\n\n  drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawImageSVG(props);\n  }\n\n  drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawParagraph(props);\n  }\n\n  drawAtlas(props: AnimatedProps<AtlasProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawAtlas(props);\n  }\n\n  drawSkottie(props: AnimatedProps<SkottieProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawSkottie(props);\n  }\n}\n"],"mappings":";;;AAgCA,SAASA,aAAa,QAAQ,UAAU;;AAExC;AACA;AAC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,CAACiE,SAAS,CAAC9D,KAAK,CAAC;EAChC;EAEA+D,WAAWA,CAAC/D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAACkE,WAAW,CAAC/D,KAAK,CAAC;EAClC;AACF","ignoreList":[]}
         
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","reset","values","clear","processAnimationValues","props","Object","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n  PaintProps,\n  NodeType,\n  BlurMaskFilterProps,\n  CTMProps,\n  BoxProps,\n  BoxShadowProps,\n  ImageProps,\n  CircleProps,\n  PointsProps,\n  PathProps,\n  RectProps,\n  RoundedRectProps,\n  OvalProps,\n  LineProps,\n  PatchProps,\n  VerticesProps,\n  DiffRectProps,\n  TextProps,\n  TextPathProps,\n  TextBlobProps,\n  GlyphsProps,\n  PictureProps,\n  ImageSVGProps,\n  ParagraphProps,\n  AtlasProps,\n  SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n  private values = new Set<SharedValue<unknown>>();\n  private recorder: JsiRecorder;\n\n  constructor(Skia: Skia) {\n    this.recorder = Skia.Recorder();\n  }\n\n  reset() {\n    this.values.clear();\n    this.recorder.reset();\n  }\n\n  private processAnimationValues(props?: Record<string, unknown>) {\n    if (!props) {\n      return;\n    }\n    Object.values(props).forEach((value) => {\n      if (isSharedValue(value) && !this.values.has(value)) {\n        // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n        // @ts-expect-error\n        value.name = `variable${this.values.size}`;\n        this.values.add(value as SharedValue<unknown>);\n      }\n    });\n  }\n\n  getRecorder() {\n    return this.recorder;\n  }\n\n  getSharedValues() {\n    return Array.from(this.values);\n  }\n\n  saveGroup(): void {\n    this.recorder.saveGroup();\n  }\n\n  restoreGroup(): void {\n    this.recorder.restoreGroup();\n  }\n\n  savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n    this.processAnimationValues(props);\n    this.recorder.savePaint(props, standalone);\n  }\n\n  restorePaint(): void {\n    this.recorder.restorePaint();\n  }\n\n  restorePaintDeclaration(): void {\n    this.recorder.restorePaintDeclaration();\n  }\n\n  materializePaint(): void {\n    this.recorder.materializePaint();\n  }\n\n  pushPathEffect(\n    pathEffectType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushPathEffect(pathEffectType, props);\n  }\n\n  pushImageFilter(\n    imageFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushImageFilter(imageFilterType, props);\n  }\n\n  pushColorFilter(\n    colorFilterType: NodeType,\n    props: AnimatedProps<unknown>\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushColorFilter(colorFilterType, props);\n  }\n\n  pushShader(\n    shaderType: NodeType,\n    props: AnimatedProps<unknown>,\n    children: number\n  ): void {\n    this.processAnimationValues(props);\n    this.recorder.pushShader(shaderType, props, children);\n  }\n\n  pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.pushBlurMaskFilter(props);\n  }\n\n  composePathEffect(): void {\n    this.recorder.composePathEffect();\n  }\n\n  composeColorFilter(): void {\n    this.recorder.composeColorFilter();\n  }\n\n  composeImageFilter(): void {\n    this.recorder.composeImageFilter();\n  }\n\n  saveCTM(props: AnimatedProps<CTMProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.saveCTM(props);\n  }\n\n  restoreCTM(): void {\n    this.recorder.restoreCTM();\n  }\n\n  drawPaint(): void {\n    this.recorder.drawPaint();\n  }\n\n  saveLayer(): void {\n    this.recorder.saveLayer();\n  }\n\n  saveBackdropFilter(): void {\n    this.recorder.saveBackdropFilter();\n  }\n\n  drawBox(\n    boxProps: AnimatedProps<BoxProps>,\n    shadows: {\n      props: BoxShadowProps;\n    }[]\n  ): void {\n    this.processAnimationValues(boxProps);\n    shadows.forEach((shadow) => {\n      this.processAnimationValues(\n        shadow.props as AnimatedProps<BoxShadowProps>\n      );\n    });\n    this.recorder.drawBox(\n      boxProps,\n      // TODO: Fix this type BaseRecorder.drawBox()\n      // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n      // @ts-expect-error\n      shadows.map((s) => s.props)\n    );\n  }\n\n  drawImage(props: AnimatedProps<ImageProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawImage(props);\n  }\n\n  drawCircle(props: AnimatedProps<CircleProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawCircle(props);\n  }\n\n  drawPoints(props: AnimatedProps<PointsProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPoints(props);\n  }\n\n  drawPath(props: AnimatedProps<PathProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPath(props);\n  }\n\n  drawRect(props: AnimatedProps<RectProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawRect(props);\n  }\n\n  drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawRRect(props);\n  }\n\n  drawOval(props: AnimatedProps<OvalProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawOval(props);\n  }\n\n  drawLine(props: AnimatedProps<LineProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawLine(props);\n  }\n\n  drawPatch(props: AnimatedProps<PatchProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPatch(props);\n  }\n\n  drawVertices(props: AnimatedProps<VerticesProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawVertices(props);\n  }\n\n  drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawDiffRect(props);\n  }\n\n  drawText(props: AnimatedProps<TextProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawText(props);\n  }\n\n  drawTextPath(props: AnimatedProps<TextPathProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawTextPath(props);\n  }\n\n  drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawTextBlob(props);\n  }\n\n  drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawGlyphs(props);\n  }\n\n  drawPicture(props: AnimatedProps<PictureProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawPicture(props);\n  }\n\n  drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawImageSVG(props);\n  }\n\n  drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawParagraph(props);\n  }\n\n  drawAtlas(props: AnimatedProps<AtlasProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawAtlas(props);\n  }\n\n  drawSkottie(props: AnimatedProps<SkottieProps>): void {\n    this.processAnimationValues(props);\n    this.recorder.drawSkottie(props);\n  }\n}\n"],"mappings":";;;AAgCA,SAASA,aAAa,QAAQ,UAAU;;AAExC;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,CAAyB;EAItDC,WAAWA,CAACC,IAAU,EAAE;IAAAC,eAAA,iBAHP,IAAIC,GAAG,CAAuB,CAAC;IAAAD,eAAA;IAI9C,IAAI,CAACE,QAAQ,GAAGH,IAAI,CAACI,QAAQ,CAAC,CAAC;EACjC;EAEAC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC;IACnB,IAAI,CAACJ,QAAQ,CAACE,KAAK,CAAC,CAAC;EACvB;EAEQG,sBAAsBA,CAACC,KAA+B,EAAE;IAC9D,IAAI,CAACA,KAAK,EAAE;MACV;IACF;IACAC,MAAM,CAACJ,MAAM,CAACG,KAAK,CAAC,CAACE,OAAO,CAAEC,KAAK,IAAK;MACtC,IAAIf,aAAa,CAACe,KAAK,CAAC,IAAI,CAAC,IAAI,CAACN,MAAM,CAACO,GAAG,CAACD,KAAK,CAAC,EAAE;QACnD;QACA;QACAA,KAAK,CAACE,IAAI,GAAG,WAAW,IAAI,CAACR,MAAM,CAACS,IAAI,EAAE;QAC1C,IAAI,CAACT,MAAM,CAACU,GAAG,CAACJ,KAA6B,CAAC;MAChD;IACF,CAAC,CAAC;EACJ;EAEAK,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACd,QAAQ;EACtB;EAEAe,eAAeA,CAAA,EAAG;IAChB,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACd,MAAM,CAAC;EAChC;EAEAe,SAASA,CAAA,EAAS;IAChB,IAAI,CAAClB,QAAQ,CAACkB,SAAS,CAAC,CAAC;EAC3B;EAEAC,YAAYA,CAAA,EAAS;IACnB,IAAI,CAACnB,QAAQ,CAACmB,YAAY,CAAC,CAAC;EAC9B;EAEAC,SAASA,CAACd,KAAgC,EAAEe,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,CAAC5D,KAAoC,EAAQ;IACxD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACkE,aAAa,CAAC5D,KAAK,CAAC;EACpC;EAEA6D,SAASA,CAAC7D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACmE,SAAS,CAAC7D,KAAK,CAAC;EAChC;EAEA8D,WAAWA,CAAC9D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACoE,WAAW,CAAC9D,KAAK,CAAC;EAClC;AACF","ignoreList":[]}
         
     | 
| 
         @@ -4,7 +4,12 @@ import _StaticContainer = require("./StaticContainer"); 
     | 
|
| 
       4 
4 
     | 
    
         
             
            declare class NativeReanimatedContainer extends _StaticContainer.Container {
         
     | 
| 
       5 
5 
     | 
    
         
             
                constructor(Skia: any, nativeId: any);
         
     | 
| 
       6 
6 
     | 
    
         
             
                nativeId: any;
         
     | 
| 
      
 7 
     | 
    
         
            +
                recorderA: _ReanimatedRecorder.ReanimatedRecorder;
         
     | 
| 
      
 8 
     | 
    
         
            +
                recorderB: _ReanimatedRecorder.ReanimatedRecorder;
         
     | 
| 
      
 9 
     | 
    
         
            +
                currentRecorder: _ReanimatedRecorder.ReanimatedRecorder;
         
     | 
| 
      
 10 
     | 
    
         
            +
                picture: any;
         
     | 
| 
       7 
11 
     | 
    
         
             
                redraw(): void;
         
     | 
| 
       8 
12 
     | 
    
         
             
                mapperId: any;
         
     | 
| 
       9 
13 
     | 
    
         
             
            }
         
     | 
| 
      
 14 
     | 
    
         
            +
            import _ReanimatedRecorder = require("./Recorder/ReanimatedRecorder");
         
     | 
| 
       10 
15 
     | 
    
         
             
            export {};
         
     | 
| 
         @@ -3,8 +3,13 @@ import { StaticContainer } from "./StaticContainer"; 
     | 
|
| 
       3 
3 
     | 
    
         
             
            declare class NativeReanimatedContainer extends Container {
         
     | 
| 
       4 
4 
     | 
    
         
             
                constructor(Skia: any, nativeId: any);
         
     | 
| 
       5 
5 
     | 
    
         
             
                nativeId: any;
         
     | 
| 
      
 6 
     | 
    
         
            +
                recorderA: ReanimatedRecorder;
         
     | 
| 
      
 7 
     | 
    
         
            +
                recorderB: ReanimatedRecorder;
         
     | 
| 
      
 8 
     | 
    
         
            +
                currentRecorder: ReanimatedRecorder;
         
     | 
| 
      
 9 
     | 
    
         
            +
                picture: any;
         
     | 
| 
       6 
10 
     | 
    
         
             
                redraw(): void;
         
     | 
| 
       7 
11 
     | 
    
         
             
                mapperId: any;
         
     | 
| 
       8 
12 
     | 
    
         
             
            }
         
     | 
| 
       9 
13 
     | 
    
         
             
            import { Container } from "./StaticContainer";
         
     | 
| 
      
 14 
     | 
    
         
            +
            import { ReanimatedRecorder } from "./Recorder/ReanimatedRecorder";
         
     | 
| 
       10 
15 
     | 
    
         
             
            export {};
         
     | 
| 
         @@ -4,5 +4,5 @@ export interface PictureFactory { 
     | 
|
| 
       4 
4 
     | 
    
         
             
                 * Returns an SkPicture which has been serialized previously to the given bytes.
         
     | 
| 
       5 
5 
     | 
    
         
             
                 * @param bytes
         
     | 
| 
       6 
6 
     | 
    
         
             
                 */
         
     | 
| 
       7 
     | 
    
         
            -
                MakePicture(bytes: Uint8Array | ArrayBuffer): SkPicture | null;
         
     | 
| 
      
 7 
     | 
    
         
            +
                MakePicture(bytes: Uint8Array | ArrayBuffer | null): SkPicture | null;
         
     | 
| 
       8 
8 
     | 
    
         
             
            }
         
     | 
| 
         @@ -48,6 +48,7 @@ export interface BaseRecorder { 
     | 
|
| 
       48 
48 
     | 
    
         
             
                drawAtlas(props: AnimatedProps<AtlasProps>): void;
         
     | 
| 
       49 
49 
     | 
    
         
             
            }
         
     | 
| 
       50 
50 
     | 
    
         
             
            export interface JsiRecorder extends BaseRecorder {
         
     | 
| 
       51 
     | 
    
         
            -
                play():  
     | 
| 
      
 51 
     | 
    
         
            +
                play(picture: SkPicture): void;
         
     | 
| 
       52 
52 
     | 
    
         
             
                applyUpdates(variables: SharedValue<unknown>[]): void;
         
     | 
| 
      
 53 
     | 
    
         
            +
                reset(): void;
         
     | 
| 
       53 
54 
     | 
    
         
             
            }
         
     | 
| 
         @@ -5,6 +5,10 @@ import "../views/api"; 
     | 
|
| 
       5 
5 
     | 
    
         
             
            declare class NativeReanimatedContainer extends Container {
         
     | 
| 
       6 
6 
     | 
    
         
             
                private nativeId;
         
     | 
| 
       7 
7 
     | 
    
         
             
                private mapperId;
         
     | 
| 
      
 8 
     | 
    
         
            +
                private picture;
         
     | 
| 
      
 9 
     | 
    
         
            +
                private recorderA;
         
     | 
| 
      
 10 
     | 
    
         
            +
                private recorderB;
         
     | 
| 
      
 11 
     | 
    
         
            +
                private currentRecorder;
         
     | 
| 
       8 
12 
     | 
    
         
             
                constructor(Skia: Skia, nativeId: number);
         
     | 
| 
       9 
13 
     | 
    
         
             
                redraw(): void;
         
     | 
| 
       10 
14 
     | 
    
         
             
            }
         
     | 
| 
         @@ -10,6 +10,7 @@ export declare class ReanimatedRecorder implements BaseRecorder { 
     | 
|
| 
       10 
10 
     | 
    
         
             
                private values;
         
     | 
| 
       11 
11 
     | 
    
         
             
                private recorder;
         
     | 
| 
       12 
12 
     | 
    
         
             
                constructor(Skia: Skia);
         
     | 
| 
      
 13 
     | 
    
         
            +
                reset(): void;
         
     | 
| 
       13 
14 
     | 
    
         
             
                private processAnimationValues;
         
     | 
| 
       14 
15 
     | 
    
         
             
                getRecorder(): JsiRecorder;
         
     | 
| 
       15 
16 
     | 
    
         
             
                getSharedValues(): SharedValue<unknown>[];
         
     | 
    
        package/package.json
    CHANGED
    
    
| 
         @@ -5,5 +5,5 @@ export interface PictureFactory { 
     | 
|
| 
       5 
5 
     | 
    
         
             
               * Returns an SkPicture which has been serialized previously to the given bytes.
         
     | 
| 
       6 
6 
     | 
    
         
             
               * @param bytes
         
     | 
| 
       7 
7 
     | 
    
         
             
               */
         
     | 
| 
       8 
     | 
    
         
            -
              MakePicture(bytes: Uint8Array | ArrayBuffer): SkPicture | null;
         
     | 
| 
      
 8 
     | 
    
         
            +
              MakePicture(bytes: Uint8Array | ArrayBuffer | null): SkPicture | null;
         
     | 
| 
       9 
9 
     | 
    
         
             
            }
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import Rea from "../external/reanimated/ReanimatedProxy";
         
     | 
| 
       2 
     | 
    
         
            -
            import type { Skia } from "../skia/types";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import type { Skia, SkPicture } from "../skia/types";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { HAS_REANIMATED_3 } from "../external/reanimated/renderHelpers";
         
     | 
| 
       4 
4 
     | 
    
         
             
            import type { JsiRecorder } from "../skia/types/Recorder";
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
         @@ -10,11 +10,15 @@ import { visit } from "./Recorder/Visitor"; 
     | 
|
| 
       10 
10 
     | 
    
         
             
            import "../skia/NativeSetup";
         
     | 
| 
       11 
11 
     | 
    
         
             
            import "../views/api";
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            const nativeDrawOnscreen = ( 
     | 
| 
      
 13 
     | 
    
         
            +
            const nativeDrawOnscreen = (
         
     | 
| 
      
 14 
     | 
    
         
            +
              nativeId: number,
         
     | 
| 
      
 15 
     | 
    
         
            +
              recorder: JsiRecorder,
         
     | 
| 
      
 16 
     | 
    
         
            +
              picture: SkPicture
         
     | 
| 
      
 17 
     | 
    
         
            +
            ) => {
         
     | 
| 
       14 
18 
     | 
    
         
             
              "worklet";
         
     | 
| 
       15 
19 
     | 
    
         | 
| 
       16 
20 
     | 
    
         
             
              //const start = performance.now();
         
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
      
 21 
     | 
    
         
            +
              recorder.play(picture);
         
     | 
| 
       18 
22 
     | 
    
         
             
              //const end = performance.now();
         
     | 
| 
       19 
23 
     | 
    
         
             
              //console.log("Recording time: ", end - start);
         
     | 
| 
       20 
24 
     | 
    
         
             
              SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
         
     | 
| 
         @@ -22,12 +26,20 @@ const nativeDrawOnscreen = (nativeId: number, recorder: JsiRecorder) => { 
     | 
|
| 
       22 
26 
     | 
    
         | 
| 
       23 
27 
     | 
    
         
             
            class NativeReanimatedContainer extends Container {
         
     | 
| 
       24 
28 
     | 
    
         
             
              private mapperId: number | null = null;
         
     | 
| 
      
 29 
     | 
    
         
            +
              private picture: SkPicture;
         
     | 
| 
      
 30 
     | 
    
         
            +
              private recorderA: ReanimatedRecorder;
         
     | 
| 
      
 31 
     | 
    
         
            +
              private recorderB: ReanimatedRecorder;
         
     | 
| 
      
 32 
     | 
    
         
            +
              private currentRecorder: ReanimatedRecorder;
         
     | 
| 
       25 
33 
     | 
    
         | 
| 
       26 
34 
     | 
    
         
             
              constructor(
         
     | 
| 
       27 
35 
     | 
    
         
             
                Skia: Skia,
         
     | 
| 
       28 
36 
     | 
    
         
             
                private nativeId: number
         
     | 
| 
       29 
37 
     | 
    
         
             
              ) {
         
     | 
| 
       30 
38 
     | 
    
         
             
                super(Skia);
         
     | 
| 
      
 39 
     | 
    
         
            +
                this.recorderA = new ReanimatedRecorder(Skia);
         
     | 
| 
      
 40 
     | 
    
         
            +
                this.recorderB = new ReanimatedRecorder(Skia);
         
     | 
| 
      
 41 
     | 
    
         
            +
                this.currentRecorder = this.recorderA;
         
     | 
| 
      
 42 
     | 
    
         
            +
                this.picture = Skia.Picture.MakePicture(null)!;
         
     | 
| 
       31 
43 
     | 
    
         
             
              }
         
     | 
| 
       32 
44 
     | 
    
         | 
| 
       33 
45 
     | 
    
         
             
              redraw() {
         
     | 
| 
         @@ -37,20 +49,26 @@ class NativeReanimatedContainer extends Container { 
     | 
|
| 
       37 
49 
     | 
    
         
             
                if (this.unmounted) {
         
     | 
| 
       38 
50 
     | 
    
         
             
                  return;
         
     | 
| 
       39 
51 
     | 
    
         
             
                }
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                 
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                // Swap to the next recorder (double buffering)
         
     | 
| 
      
 54 
     | 
    
         
            +
                const recorder = this.currentRecorder;
         
     | 
| 
      
 55 
     | 
    
         
            +
                this.currentRecorder =
         
     | 
| 
      
 56 
     | 
    
         
            +
                  this.currentRecorder === this.recorderA ? this.recorderB : this.recorderA;
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                const { nativeId, picture } = this;
         
     | 
| 
      
 59 
     | 
    
         
            +
                recorder.reset();
         
     | 
| 
       42 
60 
     | 
    
         
             
                visit(recorder, this.root);
         
     | 
| 
       43 
61 
     | 
    
         
             
                const sharedValues = recorder.getSharedValues();
         
     | 
| 
       44 
62 
     | 
    
         
             
                const sharedRecorder = recorder.getRecorder();
         
     | 
| 
       45 
63 
     | 
    
         
             
                Rea.runOnUI(() => {
         
     | 
| 
       46 
64 
     | 
    
         
             
                  "worklet";
         
     | 
| 
       47 
     | 
    
         
            -
                  nativeDrawOnscreen(nativeId, sharedRecorder);
         
     | 
| 
      
 65 
     | 
    
         
            +
                  nativeDrawOnscreen(nativeId, sharedRecorder, picture);
         
     | 
| 
       48 
66 
     | 
    
         
             
                })();
         
     | 
| 
       49 
67 
     | 
    
         
             
                if (sharedValues.length > 0) {
         
     | 
| 
       50 
68 
     | 
    
         
             
                  this.mapperId = Rea.startMapper(() => {
         
     | 
| 
       51 
69 
     | 
    
         
             
                    "worklet";
         
     | 
| 
       52 
70 
     | 
    
         
             
                    sharedRecorder.applyUpdates(sharedValues);
         
     | 
| 
       53 
     | 
    
         
            -
                    nativeDrawOnscreen(nativeId, sharedRecorder);
         
     | 
| 
      
 71 
     | 
    
         
            +
                    nativeDrawOnscreen(nativeId, sharedRecorder, picture);
         
     | 
| 
       54 
72 
     | 
    
         
             
                  }, sharedValues);
         
     | 
| 
       55 
73 
     | 
    
         
             
                }
         
     | 
| 
       56 
74 
     | 
    
         
             
              }
         
     | 
| 
         @@ -44,6 +44,11 @@ export class ReanimatedRecorder implements BaseRecorder { 
     | 
|
| 
       44 
44 
     | 
    
         
             
                this.recorder = Skia.Recorder();
         
     | 
| 
       45 
45 
     | 
    
         
             
              }
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
              reset() {
         
     | 
| 
      
 48 
     | 
    
         
            +
                this.values.clear();
         
     | 
| 
      
 49 
     | 
    
         
            +
                this.recorder.reset();
         
     | 
| 
      
 50 
     | 
    
         
            +
              }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
       47 
52 
     | 
    
         
             
              private processAnimationValues(props?: Record<string, unknown>) {
         
     | 
| 
       48 
53 
     | 
    
         
             
                if (!props) {
         
     | 
| 
       49 
54 
     | 
    
         
             
                  return;
         
     |