@shopify/react-native-skia 0.1.229 → 0.1.230
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/jni/JniLoad.cpp +0 -2
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaModule.java +0 -1
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +7 -12
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +1 -1
- package/cpp/api/JsiSkApi.h +4 -1
- package/cpp/api/JsiSkParagraph.h +15 -0
- package/cpp/api/JsiSkParagraphBuilder.h +3 -32
- package/cpp/api/JsiSkParagraphBuilderFactory.h +54 -0
- package/cpp/rnskia/RNSkJsiViewApi.h +0 -52
- package/cpp/rnskia/RNSkManager.cpp +0 -6
- package/cpp/rnskia/RNSkView.h +2 -91
- package/cpp/rnskia/dom/JsiDomApi.h +0 -9
- package/lib/commonjs/animation/index.d.ts +0 -3
- package/lib/commonjs/animation/index.js +0 -39
- package/lib/commonjs/animation/index.js.map +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +1 -2
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +0 -6
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/Node.d.ts +0 -3
- package/lib/commonjs/dom/nodes/Node.js +0 -5
- package/lib/commonjs/dom/nodes/Node.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/index.d.ts +0 -1
- package/lib/commonjs/dom/nodes/drawings/index.js +0 -13
- package/lib/commonjs/dom/nodes/drawings/index.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +0 -4
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +0 -1
- package/lib/commonjs/dom/types/NodeType.js +0 -1
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +1 -2
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/index.d.ts +0 -1
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -4
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +2 -21
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Container.d.ts +1 -3
- package/lib/commonjs/renderer/Container.js +4 -6
- package/lib/commonjs/renderer/Container.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +1 -6
- package/lib/commonjs/renderer/HostComponents.js +0 -3
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +2 -23
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/Reconciler.d.ts +1 -5
- package/lib/commonjs/renderer/Reconciler.js +3 -18
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/renderer/components/index.d.ts +0 -1
- package/lib/commonjs/renderer/components/index.js +0 -13
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/renderer/index.d.ts +0 -1
- package/lib/commonjs/renderer/index.js +0 -13
- package/lib/commonjs/renderer/index.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.d.ts +1 -8
- package/lib/commonjs/renderer/processors/Animations/Animations.js +0 -44
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/types/Paragraph/Paragraph.d.ts +23 -0
- package/lib/commonjs/skia/types/Paragraph/Paragraph.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraph.d.ts +3 -0
- package/lib/commonjs/skia/web/JsiSkParagraph.js +12 -0
- package/lib/commonjs/skia/web/JsiSkParagraph.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraphBuilderFactory.js +5 -2
- package/lib/commonjs/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.d.ts +0 -7
- package/lib/commonjs/views/SkiaBaseWebView.js +0 -17
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.d.ts +0 -7
- package/lib/commonjs/views/SkiaDomView.js +3 -14
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +4 -14
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.d.ts +0 -7
- package/lib/commonjs/views/SkiaPictureView.js +3 -14
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaViewNativeId.d.ts +3 -0
- package/lib/commonjs/views/SkiaViewNativeId.js +11 -0
- package/lib/commonjs/views/SkiaViewNativeId.js.map +1 -0
- package/lib/commonjs/views/index.d.ts +0 -2
- package/lib/commonjs/views/index.js +0 -26
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +2 -15
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/animation/index.d.ts +0 -3
- package/lib/module/animation/index.js +0 -3
- package/lib/module/animation/index.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +1 -2
- package/lib/module/dom/nodes/JsiSkDOM.js +1 -7
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/Node.d.ts +0 -3
- package/lib/module/dom/nodes/Node.js +0 -5
- package/lib/module/dom/nodes/Node.js.map +1 -1
- package/lib/module/dom/nodes/drawings/index.d.ts +0 -1
- package/lib/module/dom/nodes/drawings/index.js +0 -1
- package/lib/module/dom/nodes/drawings/index.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +0 -4
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +0 -1
- package/lib/module/dom/types/NodeType.js +0 -1
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +1 -2
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/index.d.ts +0 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mock/index.js +1 -4
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +2 -20
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Container.d.ts +1 -3
- package/lib/module/renderer/Container.js +4 -6
- package/lib/module/renderer/Container.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +1 -6
- package/lib/module/renderer/HostComponents.js +0 -3
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +3 -23
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/Reconciler.d.ts +1 -5
- package/lib/module/renderer/Reconciler.js +3 -16
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/renderer/components/index.d.ts +0 -1
- package/lib/module/renderer/components/index.js +0 -1
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/renderer/index.d.ts +0 -1
- package/lib/module/renderer/index.js +0 -1
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.d.ts +1 -8
- package/lib/module/renderer/processors/Animations/Animations.js +0 -28
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/types/Paragraph/Paragraph.d.ts +23 -0
- package/lib/module/skia/types/Paragraph/Paragraph.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraph.d.ts +3 -0
- package/lib/module/skia/web/JsiSkParagraph.js +12 -0
- package/lib/module/skia/web/JsiSkParagraph.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js +5 -2
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.d.ts +0 -7
- package/lib/module/views/SkiaBaseWebView.js +0 -17
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.d.ts +0 -7
- package/lib/module/views/SkiaDomView.js +2 -13
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +4 -13
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.d.ts +0 -7
- package/lib/module/views/SkiaPictureView.js +2 -13
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaViewNativeId.d.ts +3 -0
- package/lib/module/views/SkiaViewNativeId.js +4 -0
- package/lib/module/views/SkiaViewNativeId.js.map +1 -0
- package/lib/module/views/index.d.ts +0 -2
- package/lib/module/views/index.js +0 -2
- package/lib/module/views/index.js.map +1 -1
- package/lib/module/views/types.d.ts +2 -15
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/animation/index.d.ts +0 -3
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +1 -2
- package/lib/typescript/src/dom/nodes/Node.d.ts +0 -3
- package/lib/typescript/src/dom/nodes/drawings/index.d.ts +0 -1
- package/lib/typescript/src/dom/types/Drawings.d.ts +0 -4
- package/lib/typescript/src/dom/types/NodeType.d.ts +0 -1
- package/lib/typescript/src/dom/types/SkDOM.d.ts +1 -2
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/renderer/Container.d.ts +1 -3
- package/lib/typescript/src/renderer/HostComponents.d.ts +1 -6
- package/lib/typescript/src/renderer/Reconciler.d.ts +1 -5
- package/lib/typescript/src/renderer/components/index.d.ts +0 -1
- package/lib/typescript/src/renderer/index.d.ts +0 -1
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +1 -8
- package/lib/typescript/src/skia/types/Paragraph/Paragraph.d.ts +23 -0
- package/lib/typescript/src/skia/web/JsiSkParagraph.d.ts +3 -0
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +0 -7
- package/lib/typescript/src/views/SkiaDomView.d.ts +0 -7
- package/lib/typescript/src/views/SkiaPictureView.d.ts +0 -7
- package/lib/typescript/src/views/SkiaViewNativeId.d.ts +3 -0
- package/lib/typescript/src/views/index.d.ts +0 -2
- package/lib/typescript/src/views/types.d.ts +2 -15
- package/package.json +1 -1
- package/src/animation/index.ts +0 -3
- package/src/dom/nodes/JsiSkDOM.ts +0 -12
- package/src/dom/nodes/Node.ts +0 -5
- package/src/dom/nodes/drawings/index.ts +0 -1
- package/src/dom/types/Drawings.ts +0 -5
- package/src/dom/types/NodeType.ts +0 -1
- package/src/dom/types/SkDOM.ts +0 -4
- package/src/index.ts +0 -1
- package/src/mock/index.ts +0 -3
- package/src/renderer/Canvas.tsx +3 -21
- package/src/renderer/Container.tsx +1 -4
- package/src/renderer/HostComponents.ts +0 -13
- package/src/renderer/HostConfig.ts +3 -24
- package/src/renderer/Reconciler.tsx +1 -19
- package/src/renderer/components/index.ts +0 -1
- package/src/renderer/index.ts +0 -1
- package/src/renderer/processors/Animations/Animations.ts +1 -51
- package/src/skia/types/Paragraph/Paragraph.ts +25 -0
- package/src/skia/web/JsiSkParagraph.ts +11 -0
- package/src/skia/web/JsiSkParagraphBuilderFactory.ts +9 -3
- package/src/views/SkiaBaseWebView.tsx +0 -19
- package/src/views/SkiaDomView.tsx +1 -13
- package/src/views/SkiaDomView.web.tsx +1 -6
- package/src/views/SkiaPictureView.tsx +1 -13
- package/src/views/SkiaViewNativeId.ts +1 -0
- package/src/views/index.ts +0 -2
- package/src/views/types.ts +2 -26
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +0 -44
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawViewManager.java +0 -34
- package/cpp/rnskia/RNSkAnimation.h +0 -65
- package/cpp/rnskia/RNSkValueApi.h +0 -72
- package/cpp/rnskia/dom/base/JsiDependencyManager.h +0 -297
- package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +0 -127
- package/cpp/rnskia/dom/props/DrawingProp.h +0 -35
- package/cpp/rnskia/values/RNSkClockValue.h +0 -140
- package/cpp/rnskia/values/RNSkComputedValue.h +0 -104
- package/cpp/rnskia/values/RNSkReadonlyValue.h +0 -166
- package/cpp/rnskia/values/RNSkValue.h +0 -116
- package/ios/RNSkia-iOS/SkiaDrawView.h +0 -7
- package/ios/RNSkia-iOS/SkiaDrawView.mm +0 -72
- package/ios/RNSkia-iOS/SkiaDrawViewManager.h +0 -7
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +0 -50
- package/lib/commonjs/animation/decay/decay.d.ts +0 -2
- package/lib/commonjs/animation/decay/decay.js +0 -42
- package/lib/commonjs/animation/decay/decay.js.map +0 -1
- package/lib/commonjs/animation/decay/index.d.ts +0 -1
- package/lib/commonjs/animation/decay/index.js +0 -14
- package/lib/commonjs/animation/decay/index.js.map +0 -1
- package/lib/commonjs/animation/decay/runDecay.d.ts +0 -10
- package/lib/commonjs/animation/decay/runDecay.js +0 -48
- package/lib/commonjs/animation/decay/runDecay.js.map +0 -1
- package/lib/commonjs/animation/decay/types.d.ts +0 -21
- package/lib/commonjs/animation/decay/types.js +0 -6
- package/lib/commonjs/animation/decay/types.js.map +0 -1
- package/lib/commonjs/animation/spring/Spring.d.ts +0 -65
- package/lib/commonjs/animation/spring/Spring.js +0 -77
- package/lib/commonjs/animation/spring/Spring.js.map +0 -1
- package/lib/commonjs/animation/spring/functions/index.d.ts +0 -1
- package/lib/commonjs/animation/spring/functions/index.js +0 -14
- package/lib/commonjs/animation/spring/functions/index.js.map +0 -1
- package/lib/commonjs/animation/spring/functions/spring.d.ts +0 -10
- package/lib/commonjs/animation/spring/functions/spring.js +0 -94
- package/lib/commonjs/animation/spring/functions/spring.js.map +0 -1
- package/lib/commonjs/animation/spring/index.d.ts +0 -3
- package/lib/commonjs/animation/spring/index.js +0 -30
- package/lib/commonjs/animation/spring/index.js.map +0 -1
- package/lib/commonjs/animation/spring/runSpring.d.ts +0 -19
- package/lib/commonjs/animation/spring/runSpring.js +0 -35
- package/lib/commonjs/animation/spring/runSpring.js.map +0 -1
- package/lib/commonjs/animation/spring/types.d.ts +0 -6
- package/lib/commonjs/animation/spring/types.js +0 -2
- package/lib/commonjs/animation/spring/types.js.map +0 -1
- package/lib/commonjs/animation/spring/useSpring.d.ts +0 -13
- package/lib/commonjs/animation/spring/useSpring.js +0 -27
- package/lib/commonjs/animation/spring/useSpring.js.map +0 -1
- package/lib/commonjs/animation/timing/Easing.d.ts +0 -19
- package/lib/commonjs/animation/timing/Easing.js +0 -108
- package/lib/commonjs/animation/timing/Easing.js.map +0 -1
- package/lib/commonjs/animation/timing/createTiming.d.ts +0 -17
- package/lib/commonjs/animation/timing/createTiming.js +0 -55
- package/lib/commonjs/animation/timing/createTiming.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/bezier.d.ts +0 -1
- package/lib/commonjs/animation/timing/functions/bezier.js +0 -147
- package/lib/commonjs/animation/timing/functions/bezier.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/getResolvedParams.d.ts +0 -7
- package/lib/commonjs/animation/timing/functions/getResolvedParams.js +0 -52
- package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/index.d.ts +0 -4
- package/lib/commonjs/animation/timing/functions/index.js +0 -54
- package/lib/commonjs/animation/timing/functions/index.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/timing.d.ts +0 -17
- package/lib/commonjs/animation/timing/functions/timing.js +0 -50
- package/lib/commonjs/animation/timing/functions/timing.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/types.d.ts +0 -7
- package/lib/commonjs/animation/timing/functions/types.js +0 -2
- package/lib/commonjs/animation/timing/functions/types.js.map +0 -1
- package/lib/commonjs/animation/timing/index.d.ts +0 -4
- package/lib/commonjs/animation/timing/index.js +0 -38
- package/lib/commonjs/animation/timing/index.js.map +0 -1
- package/lib/commonjs/animation/timing/runTiming.d.ts +0 -19
- package/lib/commonjs/animation/timing/runTiming.js +0 -36
- package/lib/commonjs/animation/timing/runTiming.js.map +0 -1
- package/lib/commonjs/animation/timing/useLoop.d.ts +0 -11
- package/lib/commonjs/animation/timing/useLoop.js +0 -25
- package/lib/commonjs/animation/timing/useLoop.js.map +0 -1
- package/lib/commonjs/animation/timing/useTiming.d.ts +0 -13
- package/lib/commonjs/animation/timing/useTiming.js +0 -67
- package/lib/commonjs/animation/timing/useTiming.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.js +0 -28
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.js.map +0 -1
- package/lib/commonjs/renderer/DependencyManager.d.ts +0 -46
- package/lib/commonjs/renderer/DependencyManager.js +0 -185
- package/lib/commonjs/renderer/DependencyManager.js.map +0 -1
- package/lib/commonjs/renderer/components/Drawing.d.ts +0 -8
- package/lib/commonjs/renderer/components/Drawing.js +0 -22
- package/lib/commonjs/renderer/components/Drawing.js.map +0 -1
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.d.ts +0 -8
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.js +0 -16
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.js.map +0 -1
- package/lib/commonjs/values/api.d.ts +0 -26
- package/lib/commonjs/values/api.js +0 -55
- package/lib/commonjs/values/api.js.map +0 -1
- package/lib/commonjs/values/api.web.d.ts +0 -2
- package/lib/commonjs/values/api.web.js +0 -18
- package/lib/commonjs/values/api.web.js.map +0 -1
- package/lib/commonjs/values/hooks/index.d.ts +0 -4
- package/lib/commonjs/values/hooks/index.js +0 -58
- package/lib/commonjs/values/hooks/index.js.map +0 -1
- package/lib/commonjs/values/hooks/useClockValue.d.ts +0 -9
- package/lib/commonjs/values/hooks/useClockValue.js +0 -30
- package/lib/commonjs/values/hooks/useClockValue.js.map +0 -1
- package/lib/commonjs/values/hooks/useComputedValue.d.ts +0 -11
- package/lib/commonjs/values/hooks/useComputedValue.js +0 -32
- package/lib/commonjs/values/hooks/useComputedValue.js.map +0 -1
- package/lib/commonjs/values/hooks/useValue.d.ts +0 -10
- package/lib/commonjs/values/hooks/useValue.js +0 -26
- package/lib/commonjs/values/hooks/useValue.js.map +0 -1
- package/lib/commonjs/values/hooks/useValueEffect.d.ts +0 -10
- package/lib/commonjs/values/hooks/useValueEffect.js +0 -25
- package/lib/commonjs/values/hooks/useValueEffect.js.map +0 -1
- package/lib/commonjs/values/index.d.ts +0 -4
- package/lib/commonjs/values/index.js +0 -58
- package/lib/commonjs/values/index.js.map +0 -1
- package/lib/commonjs/values/selector.d.ts +0 -14
- package/lib/commonjs/values/selector.js +0 -24
- package/lib/commonjs/values/selector.js.map +0 -1
- package/lib/commonjs/values/types.d.ts +0 -63
- package/lib/commonjs/values/types.js +0 -2
- package/lib/commonjs/values/types.js.map +0 -1
- package/lib/commonjs/values/web/RNSkAnimation.d.ts +0 -9
- package/lib/commonjs/values/web/RNSkAnimation.js +0 -46
- package/lib/commonjs/values/web/RNSkAnimation.js.map +0 -1
- package/lib/commonjs/values/web/RNSkClockValue.d.ts +0 -13
- package/lib/commonjs/values/web/RNSkClockValue.js +0 -75
- package/lib/commonjs/values/web/RNSkClockValue.js.map +0 -1
- package/lib/commonjs/values/web/RNSkComputedValue.d.ts +0 -10
- package/lib/commonjs/values/web/RNSkComputedValue.js +0 -59
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +0 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.d.ts +0 -12
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +0 -51
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +0 -1
- package/lib/commonjs/values/web/RNSkValue.d.ts +0 -14
- package/lib/commonjs/values/web/RNSkValue.js +0 -73
- package/lib/commonjs/values/web/RNSkValue.js.map +0 -1
- package/lib/commonjs/values/web/api.d.ts +0 -2
- package/lib/commonjs/values/web/api.js +0 -31
- package/lib/commonjs/values/web/api.js.map +0 -1
- package/lib/commonjs/values/web/index.d.ts +0 -1
- package/lib/commonjs/values/web/index.js +0 -19
- package/lib/commonjs/values/web/index.js.map +0 -1
- package/lib/commonjs/views/SkiaView.d.ts +0 -35
- package/lib/commonjs/views/SkiaView.js +0 -139
- package/lib/commonjs/views/SkiaView.js.map +0 -1
- package/lib/commonjs/views/SkiaView.web.d.ts +0 -7
- package/lib/commonjs/views/SkiaView.web.js +0 -30
- package/lib/commonjs/views/SkiaView.web.js.map +0 -1
- package/lib/commonjs/views/useDrawCallback.d.ts +0 -8
- package/lib/commonjs/views/useDrawCallback.js +0 -23
- package/lib/commonjs/views/useDrawCallback.js.map +0 -1
- package/lib/module/animation/decay/decay.d.ts +0 -2
- package/lib/module/animation/decay/decay.js +0 -33
- package/lib/module/animation/decay/decay.js.map +0 -1
- package/lib/module/animation/decay/index.d.ts +0 -1
- package/lib/module/animation/decay/index.js +0 -2
- package/lib/module/animation/decay/index.js.map +0 -1
- package/lib/module/animation/decay/runDecay.d.ts +0 -10
- package/lib/module/animation/decay/runDecay.js +0 -38
- package/lib/module/animation/decay/runDecay.js.map +0 -1
- package/lib/module/animation/decay/types.d.ts +0 -21
- package/lib/module/animation/decay/types.js +0 -2
- package/lib/module/animation/decay/types.js.map +0 -1
- package/lib/module/animation/spring/Spring.d.ts +0 -65
- package/lib/module/animation/spring/Spring.js +0 -69
- package/lib/module/animation/spring/Spring.js.map +0 -1
- package/lib/module/animation/spring/functions/index.d.ts +0 -1
- package/lib/module/animation/spring/functions/index.js +0 -2
- package/lib/module/animation/spring/functions/index.js.map +0 -1
- package/lib/module/animation/spring/functions/spring.d.ts +0 -10
- package/lib/module/animation/spring/functions/spring.js +0 -85
- package/lib/module/animation/spring/functions/spring.js.map +0 -1
- package/lib/module/animation/spring/index.d.ts +0 -3
- package/lib/module/animation/spring/index.js +0 -4
- package/lib/module/animation/spring/index.js.map +0 -1
- package/lib/module/animation/spring/runSpring.d.ts +0 -19
- package/lib/module/animation/spring/runSpring.js +0 -24
- package/lib/module/animation/spring/runSpring.js.map +0 -1
- package/lib/module/animation/spring/types.d.ts +0 -6
- package/lib/module/animation/spring/types.js +0 -2
- package/lib/module/animation/spring/types.js.map +0 -1
- package/lib/module/animation/spring/useSpring.d.ts +0 -13
- package/lib/module/animation/spring/useSpring.js +0 -16
- package/lib/module/animation/spring/useSpring.js.map +0 -1
- package/lib/module/animation/timing/Easing.d.ts +0 -19
- package/lib/module/animation/timing/Easing.js +0 -98
- package/lib/module/animation/timing/Easing.js.map +0 -1
- package/lib/module/animation/timing/createTiming.d.ts +0 -17
- package/lib/module/animation/timing/createTiming.js +0 -49
- package/lib/module/animation/timing/createTiming.js.map +0 -1
- package/lib/module/animation/timing/functions/bezier.d.ts +0 -1
- package/lib/module/animation/timing/functions/bezier.js +0 -141
- package/lib/module/animation/timing/functions/bezier.js.map +0 -1
- package/lib/module/animation/timing/functions/getResolvedParams.d.ts +0 -7
- package/lib/module/animation/timing/functions/getResolvedParams.js +0 -48
- package/lib/module/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/module/animation/timing/functions/index.d.ts +0 -4
- package/lib/module/animation/timing/functions/index.js +0 -5
- package/lib/module/animation/timing/functions/index.js.map +0 -1
- package/lib/module/animation/timing/functions/timing.d.ts +0 -17
- package/lib/module/animation/timing/functions/timing.js +0 -41
- package/lib/module/animation/timing/functions/timing.js.map +0 -1
- package/lib/module/animation/timing/functions/types.d.ts +0 -7
- package/lib/module/animation/timing/functions/types.js +0 -2
- package/lib/module/animation/timing/functions/types.js.map +0 -1
- package/lib/module/animation/timing/index.d.ts +0 -4
- package/lib/module/animation/timing/index.js +0 -5
- package/lib/module/animation/timing/index.js.map +0 -1
- package/lib/module/animation/timing/runTiming.d.ts +0 -19
- package/lib/module/animation/timing/runTiming.js +0 -26
- package/lib/module/animation/timing/runTiming.js.map +0 -1
- package/lib/module/animation/timing/useLoop.d.ts +0 -11
- package/lib/module/animation/timing/useLoop.js +0 -16
- package/lib/module/animation/timing/useLoop.js.map +0 -1
- package/lib/module/animation/timing/useTiming.d.ts +0 -13
- package/lib/module/animation/timing/useTiming.js +0 -57
- package/lib/module/animation/timing/useTiming.js.map +0 -1
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.js +0 -17
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.js.map +0 -1
- package/lib/module/renderer/DependencyManager.d.ts +0 -46
- package/lib/module/renderer/DependencyManager.js +0 -174
- package/lib/module/renderer/DependencyManager.js.map +0 -1
- package/lib/module/renderer/components/Drawing.d.ts +0 -8
- package/lib/module/renderer/components/Drawing.js +0 -11
- package/lib/module/renderer/components/Drawing.js.map +0 -1
- package/lib/module/specs/SkiaDrawViewNativeComponent.d.ts +0 -8
- package/lib/module/specs/SkiaDrawViewNativeComponent.js +0 -4
- package/lib/module/specs/SkiaDrawViewNativeComponent.js.map +0 -1
- package/lib/module/values/api.d.ts +0 -26
- package/lib/module/values/api.js +0 -48
- package/lib/module/values/api.js.map +0 -1
- package/lib/module/values/api.web.d.ts +0 -2
- package/lib/module/values/api.web.js +0 -7
- package/lib/module/values/api.web.js.map +0 -1
- package/lib/module/values/hooks/index.d.ts +0 -4
- package/lib/module/values/hooks/index.js +0 -5
- package/lib/module/values/hooks/index.js.map +0 -1
- package/lib/module/values/hooks/useClockValue.d.ts +0 -9
- package/lib/module/values/hooks/useClockValue.js +0 -20
- package/lib/module/values/hooks/useClockValue.js.map +0 -1
- package/lib/module/values/hooks/useComputedValue.d.ts +0 -11
- package/lib/module/values/hooks/useComputedValue.js +0 -21
- package/lib/module/values/hooks/useComputedValue.js.map +0 -1
- package/lib/module/values/hooks/useValue.d.ts +0 -10
- package/lib/module/values/hooks/useValue.js +0 -16
- package/lib/module/values/hooks/useValue.js.map +0 -1
- package/lib/module/values/hooks/useValueEffect.d.ts +0 -10
- package/lib/module/values/hooks/useValueEffect.js +0 -16
- package/lib/module/values/hooks/useValueEffect.js.map +0 -1
- package/lib/module/values/index.d.ts +0 -4
- package/lib/module/values/index.js +0 -5
- package/lib/module/values/index.js.map +0 -1
- package/lib/module/values/selector.d.ts +0 -14
- package/lib/module/values/selector.js +0 -15
- package/lib/module/values/selector.js.map +0 -1
- package/lib/module/values/types.d.ts +0 -63
- package/lib/module/values/types.js +0 -2
- package/lib/module/values/types.js.map +0 -1
- package/lib/module/values/web/RNSkAnimation.d.ts +0 -9
- package/lib/module/values/web/RNSkAnimation.js +0 -36
- package/lib/module/values/web/RNSkAnimation.js.map +0 -1
- package/lib/module/values/web/RNSkClockValue.d.ts +0 -13
- package/lib/module/values/web/RNSkClockValue.js +0 -65
- package/lib/module/values/web/RNSkClockValue.js.map +0 -1
- package/lib/module/values/web/RNSkComputedValue.d.ts +0 -10
- package/lib/module/values/web/RNSkComputedValue.js +0 -49
- package/lib/module/values/web/RNSkComputedValue.js.map +0 -1
- package/lib/module/values/web/RNSkReadonlyValue.d.ts +0 -12
- package/lib/module/values/web/RNSkReadonlyValue.js +0 -42
- package/lib/module/values/web/RNSkReadonlyValue.js.map +0 -1
- package/lib/module/values/web/RNSkValue.d.ts +0 -14
- package/lib/module/values/web/RNSkValue.js +0 -63
- package/lib/module/values/web/RNSkValue.js.map +0 -1
- package/lib/module/values/web/api.d.ts +0 -2
- package/lib/module/values/web/api.js +0 -19
- package/lib/module/values/web/api.js.map +0 -1
- package/lib/module/values/web/index.d.ts +0 -1
- package/lib/module/values/web/index.js +0 -2
- package/lib/module/values/web/index.js.map +0 -1
- package/lib/module/views/SkiaView.d.ts +0 -35
- package/lib/module/views/SkiaView.js +0 -119
- package/lib/module/views/SkiaView.js.map +0 -1
- package/lib/module/views/SkiaView.web.d.ts +0 -7
- package/lib/module/views/SkiaView.web.js +0 -20
- package/lib/module/views/SkiaView.web.js.map +0 -1
- package/lib/module/views/useDrawCallback.d.ts +0 -8
- package/lib/module/views/useDrawCallback.js +0 -14
- package/lib/module/views/useDrawCallback.js.map +0 -1
- package/lib/typescript/src/animation/decay/decay.d.ts +0 -2
- package/lib/typescript/src/animation/decay/index.d.ts +0 -1
- package/lib/typescript/src/animation/decay/runDecay.d.ts +0 -10
- package/lib/typescript/src/animation/decay/types.d.ts +0 -21
- package/lib/typescript/src/animation/spring/Spring.d.ts +0 -65
- package/lib/typescript/src/animation/spring/functions/index.d.ts +0 -1
- package/lib/typescript/src/animation/spring/functions/spring.d.ts +0 -10
- package/lib/typescript/src/animation/spring/index.d.ts +0 -3
- package/lib/typescript/src/animation/spring/runSpring.d.ts +0 -19
- package/lib/typescript/src/animation/spring/types.d.ts +0 -6
- package/lib/typescript/src/animation/spring/useSpring.d.ts +0 -13
- package/lib/typescript/src/animation/timing/Easing.d.ts +0 -19
- package/lib/typescript/src/animation/timing/createTiming.d.ts +0 -17
- package/lib/typescript/src/animation/timing/functions/bezier.d.ts +0 -1
- package/lib/typescript/src/animation/timing/functions/getResolvedParams.d.ts +0 -7
- package/lib/typescript/src/animation/timing/functions/index.d.ts +0 -4
- package/lib/typescript/src/animation/timing/functions/timing.d.ts +0 -17
- package/lib/typescript/src/animation/timing/functions/types.d.ts +0 -7
- package/lib/typescript/src/animation/timing/index.d.ts +0 -4
- package/lib/typescript/src/animation/timing/runTiming.d.ts +0 -19
- package/lib/typescript/src/animation/timing/useLoop.d.ts +0 -11
- package/lib/typescript/src/animation/timing/useTiming.d.ts +0 -13
- package/lib/typescript/src/dom/nodes/drawings/CustomDrawingNode.d.ts +0 -8
- package/lib/typescript/src/renderer/DependencyManager.d.ts +0 -46
- package/lib/typescript/src/renderer/components/Drawing.d.ts +0 -8
- package/lib/typescript/src/specs/SkiaDrawViewNativeComponent.d.ts +0 -8
- package/lib/typescript/src/values/api.d.ts +0 -26
- package/lib/typescript/src/values/api.web.d.ts +0 -2
- package/lib/typescript/src/values/hooks/index.d.ts +0 -4
- package/lib/typescript/src/values/hooks/useClockValue.d.ts +0 -9
- package/lib/typescript/src/values/hooks/useComputedValue.d.ts +0 -11
- package/lib/typescript/src/values/hooks/useValue.d.ts +0 -10
- package/lib/typescript/src/values/hooks/useValueEffect.d.ts +0 -10
- package/lib/typescript/src/values/index.d.ts +0 -4
- package/lib/typescript/src/values/selector.d.ts +0 -14
- package/lib/typescript/src/values/types.d.ts +0 -63
- package/lib/typescript/src/values/web/RNSkAnimation.d.ts +0 -9
- package/lib/typescript/src/values/web/RNSkClockValue.d.ts +0 -13
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +0 -10
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +0 -12
- package/lib/typescript/src/values/web/RNSkValue.d.ts +0 -14
- package/lib/typescript/src/values/web/api.d.ts +0 -2
- package/lib/typescript/src/values/web/index.d.ts +0 -1
- package/lib/typescript/src/views/SkiaView.d.ts +0 -35
- package/lib/typescript/src/views/SkiaView.web.d.ts +0 -7
- package/lib/typescript/src/views/useDrawCallback.d.ts +0 -8
- package/src/animation/decay/decay.ts +0 -35
- package/src/animation/decay/index.ts +0 -1
- package/src/animation/decay/runDecay.ts +0 -40
- package/src/animation/decay/types.ts +0 -24
- package/src/animation/spring/Spring.ts +0 -61
- package/src/animation/spring/functions/index.ts +0 -1
- package/src/animation/spring/functions/spring.ts +0 -86
- package/src/animation/spring/index.ts +0 -3
- package/src/animation/spring/runSpring.ts +0 -40
- package/src/animation/spring/types.ts +0 -6
- package/src/animation/spring/useSpring.ts +0 -31
- package/src/animation/timing/Easing.ts +0 -102
- package/src/animation/timing/createTiming.ts +0 -62
- package/src/animation/timing/functions/bezier.ts +0 -165
- package/src/animation/timing/functions/getResolvedParams.ts +0 -50
- package/src/animation/timing/functions/index.ts +0 -4
- package/src/animation/timing/functions/timing.ts +0 -44
- package/src/animation/timing/functions/types.ts +0 -8
- package/src/animation/timing/index.ts +0 -4
- package/src/animation/timing/runTiming.ts +0 -36
- package/src/animation/timing/useLoop.ts +0 -21
- package/src/animation/timing/useTiming.ts +0 -71
- package/src/dom/nodes/drawings/CustomDrawingNode.ts +0 -21
- package/src/renderer/DependencyManager.tsx +0 -196
- package/src/renderer/components/Drawing.tsx +0 -12
- package/src/specs/SkiaDrawViewNativeComponent.ts +0 -10
- package/src/values/api.ts +0 -61
- package/src/values/api.web.ts +0 -5
- package/src/values/hooks/index.ts +0 -4
- package/src/values/hooks/useClockValue.ts +0 -21
- package/src/values/hooks/useComputedValue.ts +0 -24
- package/src/values/hooks/useValue.ts +0 -17
- package/src/values/hooks/useValueEffect.ts +0 -18
- package/src/values/index.ts +0 -4
- package/src/values/selector.ts +0 -24
- package/src/values/types.ts +0 -73
- package/src/values/web/RNSkAnimation.ts +0 -33
- package/src/values/web/RNSkClockValue.ts +0 -58
- package/src/values/web/RNSkComputedValue.ts +0 -49
- package/src/values/web/RNSkReadonlyValue.ts +0 -38
- package/src/values/web/RNSkValue.ts +0 -57
- package/src/values/web/api.ts +0 -33
- package/src/values/web/index.ts +0 -1
- package/src/views/SkiaView.tsx +0 -111
- package/src/views/SkiaView.web.tsx +0 -22
- package/src/views/useDrawCallback.ts +0 -19
@@ -1,297 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include "JsiHostObject.h"
|
4
|
-
|
5
|
-
#include "RNSkPlatformContext.h"
|
6
|
-
|
7
|
-
#include "JsiDomNode.h"
|
8
|
-
|
9
|
-
#include <map>
|
10
|
-
#include <memory>
|
11
|
-
#include <set>
|
12
|
-
#include <string>
|
13
|
-
#include <utility>
|
14
|
-
#include <vector>
|
15
|
-
|
16
|
-
namespace RNSkia {
|
17
|
-
|
18
|
-
static PropId PropNameSelector = JsiPropId::get("selector");
|
19
|
-
static PropId PropNameValue = JsiPropId::get("value");
|
20
|
-
|
21
|
-
class JsiDependencyManager
|
22
|
-
: public JsiHostObject,
|
23
|
-
public std::enable_shared_from_this<JsiDependencyManager> {
|
24
|
-
public:
|
25
|
-
JsiDependencyManager(std::shared_ptr<RNSkPlatformContext> context,
|
26
|
-
jsi::Runtime &runtime,
|
27
|
-
const jsi::Value ®isterValuesCallback)
|
28
|
-
: _registerValuesCallback(std::make_shared<jsi::Object>(
|
29
|
-
registerValuesCallback.asObject(runtime))),
|
30
|
-
JsiHostObject() {}
|
31
|
-
|
32
|
-
~JsiDependencyManager() { unsubscribeAll(); }
|
33
|
-
|
34
|
-
/**
|
35
|
-
Call to unsubscribe all value listeners from the given node based on the
|
36
|
-
current list of subscriptions for the node. This function is typically called
|
37
|
-
when the node is unmounted or when one or more properties have changed. NOTE:
|
38
|
-
In this implementation we call unsubscribe directly without going through the
|
39
|
-
JSI method - but the method is kept for compatibility with the JS
|
40
|
-
implementation
|
41
|
-
*/
|
42
|
-
JSI_HOST_FUNCTION(unsubscribeNode) {
|
43
|
-
// (node: Node<unknown>)
|
44
|
-
auto node =
|
45
|
-
getArgumentAsHostObject<JsiDomNode>(runtime, arguments, count, 0);
|
46
|
-
unsubscribeNode(node.get());
|
47
|
-
return jsi::Value::undefined();
|
48
|
-
}
|
49
|
-
|
50
|
-
/**
|
51
|
-
Adds listeners to the provided values so that the node is notified when a
|
52
|
-
value changes.
|
53
|
-
*/
|
54
|
-
JSI_HOST_FUNCTION(subscribeNode) {
|
55
|
-
// subscribeNode<P>(node: Node<unknown>, props: AnimatedProps<P>)
|
56
|
-
auto node =
|
57
|
-
getArgumentAsHostObject<JsiDomNode>(runtime, arguments, count, 0);
|
58
|
-
auto nextProps = getArgumentAsObject(runtime, arguments, count, 1);
|
59
|
-
|
60
|
-
// Save unsubscribe callbacks
|
61
|
-
std::vector<
|
62
|
-
std::pair<std::shared_ptr<RNSkReadonlyValue>, std::function<void()>>>
|
63
|
-
unsubscribers;
|
64
|
-
|
65
|
-
// Enumerate registered keys for the given node to only handle known
|
66
|
-
// properties
|
67
|
-
node->getPropsContainer()->enumerateMappedProps(
|
68
|
-
[&](const PropId key, const std::vector<NodeProp *> &propMapping) {
|
69
|
-
auto jsValue = nextProps.getProperty(runtime, key);
|
70
|
-
JsiValue nativeValue(runtime, jsValue);
|
71
|
-
|
72
|
-
if (isAnimatedValue(nativeValue)) {
|
73
|
-
// Handle Skia Animation Values
|
74
|
-
auto animatedValue = getAnimatedValue(nativeValue);
|
75
|
-
auto unsubscribe = animatedValue->addListener(
|
76
|
-
[animatedValue, propMapping](jsi::Runtime &runtime) {
|
77
|
-
// Get value from animation value
|
78
|
-
auto nextJsValue = animatedValue->getCurrent(runtime);
|
79
|
-
// Update all props that listens to this animation value
|
80
|
-
for (auto &prop : propMapping) {
|
81
|
-
prop->updateValue(runtime, nextJsValue);
|
82
|
-
}
|
83
|
-
});
|
84
|
-
|
85
|
-
// Save unsubscribe methods
|
86
|
-
unsubscribers.push_back(std::make_pair(animatedValue, unsubscribe));
|
87
|
-
|
88
|
-
} else if (isSelector(nativeValue)) {
|
89
|
-
// Handle Skia Animation Value Selectors
|
90
|
-
auto animatedValue = std::dynamic_pointer_cast<RNSkReadonlyValue>(
|
91
|
-
nativeValue.getValue(PropNameValue).getAsHostObject());
|
92
|
-
|
93
|
-
auto selector =
|
94
|
-
nativeValue.getValue(PropNameSelector).getAsFunction();
|
95
|
-
// Add subscription to animated value in selector
|
96
|
-
auto unsubscribe = animatedValue->addListener(
|
97
|
-
[nativeValue, propMapping, selector = std::move(selector),
|
98
|
-
animatedValue](jsi::Runtime &runtime) {
|
99
|
-
// Get value from animation value
|
100
|
-
jsi::Value jsValue = animatedValue->getCurrent(runtime);
|
101
|
-
// Call selector to transform new value
|
102
|
-
auto selectedJsValue =
|
103
|
-
selector(runtime, jsi::Value::null(), &jsValue, 1);
|
104
|
-
// Update all props that listens to this animation value
|
105
|
-
for (auto &prop : propMapping) {
|
106
|
-
prop->updateValue(runtime, selectedJsValue);
|
107
|
-
}
|
108
|
-
});
|
109
|
-
|
110
|
-
// Save unsubscribe methods
|
111
|
-
unsubscribers.push_back(std::make_pair(animatedValue, unsubscribe));
|
112
|
-
}
|
113
|
-
});
|
114
|
-
|
115
|
-
// Now let's store the subscription info
|
116
|
-
_subscriptions.emplace(node.get(), unsubscribers);
|
117
|
-
|
118
|
-
// Set callback for unsubscribing
|
119
|
-
node->setDisposeCallback([node, weakSelf = weak_from_this()]() {
|
120
|
-
auto self = weakSelf.lock();
|
121
|
-
if (self) {
|
122
|
-
self->unsubscribeNode(node.get());
|
123
|
-
}
|
124
|
-
});
|
125
|
-
|
126
|
-
return jsi::Value::undefined();
|
127
|
-
}
|
128
|
-
|
129
|
-
/**
|
130
|
-
Called when the hosting container is mounted or updated. This ensures that we
|
131
|
-
have a ref to the underlying SkiaView so that we can registers redraw
|
132
|
-
listeners on values used in the current View automatically.
|
133
|
-
*/
|
134
|
-
JSI_HOST_FUNCTION(update) {
|
135
|
-
if (_unregisterValues != nullptr) {
|
136
|
-
// unregisterValues is a pointer to unsubscribing to the automatic
|
137
|
-
// re-render when a value change
|
138
|
-
_unregisterValues->asFunction(runtime).call(runtime,
|
139
|
-
jsi::Value::undefined(), 0);
|
140
|
-
_unregisterValues = nullptr;
|
141
|
-
}
|
142
|
-
|
143
|
-
// Now let's create connection between view and unique values
|
144
|
-
std::set<std::shared_ptr<RNSkReadonlyValue>> uniqueValues;
|
145
|
-
|
146
|
-
for (auto &nodeSub : _subscriptions) {
|
147
|
-
for (auto &sub : nodeSub.second) {
|
148
|
-
if (uniqueValues.count(sub.first) == 0) {
|
149
|
-
uniqueValues.emplace(sub.first);
|
150
|
-
}
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
// Copy to args
|
155
|
-
auto array = jsi::Array(runtime, uniqueValues.size());
|
156
|
-
size_t i = 0;
|
157
|
-
for (auto &el : uniqueValues) {
|
158
|
-
array.setValueAtIndex(runtime, i++,
|
159
|
-
jsi::Object::createFromHostObject(runtime, el));
|
160
|
-
}
|
161
|
-
|
162
|
-
// Call JS registerValues callback
|
163
|
-
auto func = _registerValuesCallback->asFunction(runtime);
|
164
|
-
_unregisterValues = std::make_shared<jsi::Object>(
|
165
|
-
func.call(runtime, array, 1).asObject(runtime));
|
166
|
-
|
167
|
-
return jsi::Value::undefined();
|
168
|
-
}
|
169
|
-
|
170
|
-
/**
|
171
|
-
Called when the hosting container is unmounted or recreated. This ensures
|
172
|
-
that we remove all subscriptions to Skia values so that we don't have any
|
173
|
-
listeners left after the component is removed.
|
174
|
-
|
175
|
-
* Called when the hosting container is unmounted or recreated. This ensures
|
176
|
-
that we remove
|
177
|
-
* all subscriptions to Skia values so that we don't have any listeners left
|
178
|
-
after
|
179
|
-
* the component is removed.
|
180
|
-
*/
|
181
|
-
JSI_HOST_FUNCTION(remove) {
|
182
|
-
if (_unregisterValues != nullptr) {
|
183
|
-
// unregisterValues is a pointer to unsubscribing to the automatic
|
184
|
-
// re-render when a value change
|
185
|
-
_unregisterValues->asFunction(runtime).call(runtime,
|
186
|
-
jsi::Value::undefined(), 0);
|
187
|
-
_unregisterValues = nullptr;
|
188
|
-
}
|
189
|
-
|
190
|
-
unsubscribeAll();
|
191
|
-
|
192
|
-
_registerValuesCallback = nullptr;
|
193
|
-
|
194
|
-
return jsi::Value::undefined();
|
195
|
-
}
|
196
|
-
|
197
|
-
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiDependencyManager, unsubscribeNode),
|
198
|
-
JSI_EXPORT_FUNC(JsiDependencyManager, subscribeNode),
|
199
|
-
JSI_EXPORT_FUNC(JsiDependencyManager, update),
|
200
|
-
JSI_EXPORT_FUNC(JsiDependencyManager, remove))
|
201
|
-
|
202
|
-
/**
|
203
|
-
Constructor to add to the Api object
|
204
|
-
*/
|
205
|
-
static const jsi::HostFunctionType
|
206
|
-
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
207
|
-
return JSI_HOST_FUNCTION_LAMBDA {
|
208
|
-
// Params: registerValues: (values: Array<SkiaValue<unknown>>) => () =>
|
209
|
-
// void
|
210
|
-
auto obj = std::make_shared<JsiDependencyManager>(context, runtime,
|
211
|
-
arguments[0]);
|
212
|
-
|
213
|
-
return jsi::Object::createFromHostObject(runtime, std::move(obj));
|
214
|
-
};
|
215
|
-
}
|
216
|
-
|
217
|
-
private:
|
218
|
-
/**
|
219
|
-
Removes all subscriptions
|
220
|
-
*/
|
221
|
-
void unsubscribeAll() {
|
222
|
-
// Unregister all nodes
|
223
|
-
std::vector<JsiDomNode *> tmp;
|
224
|
-
tmp.reserve(_subscriptions.size());
|
225
|
-
for (auto &subInfo : _subscriptions) {
|
226
|
-
tmp.push_back(subInfo.first);
|
227
|
-
}
|
228
|
-
for (auto &node : tmp) {
|
229
|
-
unsubscribeNode(node);
|
230
|
-
}
|
231
|
-
|
232
|
-
// Clear all subscriptions
|
233
|
-
_subscriptions.clear();
|
234
|
-
}
|
235
|
-
|
236
|
-
/**
|
237
|
-
Unsubscribes from a given node
|
238
|
-
*/
|
239
|
-
void unsubscribeNode(JsiDomNode *node) {
|
240
|
-
if (_subscriptions.count(node) > 0) {
|
241
|
-
auto subscriptions = _subscriptions.at(node);
|
242
|
-
for (auto &p : subscriptions) {
|
243
|
-
p.second();
|
244
|
-
}
|
245
|
-
|
246
|
-
// Remove node's subscriptions
|
247
|
-
_subscriptions.erase(node);
|
248
|
-
|
249
|
-
// Remove node's callback to avoid keeping
|
250
|
-
// cyclic dependencies between dep manager and the node
|
251
|
-
node->setDisposeCallback(nullptr);
|
252
|
-
}
|
253
|
-
}
|
254
|
-
/**
|
255
|
-
Returns true if the given value is a HostObject and it inherits from
|
256
|
-
RNSkReadonlyValue.
|
257
|
-
*/
|
258
|
-
bool isAnimatedValue(JsiValue &value) {
|
259
|
-
return value.getType() == PropType::HostObject &&
|
260
|
-
std::dynamic_pointer_cast<RNSkReadonlyValue>(
|
261
|
-
value.getAsHostObject()) != nullptr;
|
262
|
-
}
|
263
|
-
|
264
|
-
/**
|
265
|
-
Returns the RNSkReadonlyValue pointer for a value that is an Animated value
|
266
|
-
*/
|
267
|
-
std::shared_ptr<RNSkReadonlyValue> getAnimatedValue(JsiValue &value) {
|
268
|
-
return std::dynamic_pointer_cast<RNSkReadonlyValue>(
|
269
|
-
value.getAsHostObject());
|
270
|
-
}
|
271
|
-
|
272
|
-
/**
|
273
|
-
Returns true if the value is a selector. A Selector is a JS object that has
|
274
|
-
two properties, the selector and the the value. The selector is a function
|
275
|
-
that is used to transform the value - which is an animated skia value.
|
276
|
-
*/
|
277
|
-
bool isSelector(JsiValue &value) {
|
278
|
-
// Handling selectors is rather easy, we just add
|
279
|
-
// a listener on the selector's callback and then we'll do the javascript
|
280
|
-
// resolving in the callback (which will always be on the Javascript
|
281
|
-
// thread)!
|
282
|
-
if (value.getType() == PropType::Object) {
|
283
|
-
if (value.hasValue(PropNameSelector) && value.hasValue(PropNameValue)) {
|
284
|
-
return true;
|
285
|
-
}
|
286
|
-
}
|
287
|
-
return false;
|
288
|
-
}
|
289
|
-
|
290
|
-
std::shared_ptr<jsi::Object> _registerValuesCallback;
|
291
|
-
std::shared_ptr<jsi::Object> _unregisterValues;
|
292
|
-
std::map<JsiDomNode *,
|
293
|
-
std::vector<std::pair<std::shared_ptr<RNSkReadonlyValue>,
|
294
|
-
std::function<void()>>>>
|
295
|
-
_subscriptions;
|
296
|
-
};
|
297
|
-
} // namespace RNSkia
|
@@ -1,127 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include "DrawingProp.h"
|
4
|
-
#include "JsiDomDrawingNode.h"
|
5
|
-
|
6
|
-
#include "JsiSkCanvas.h"
|
7
|
-
#include "JsiSkPaint.h"
|
8
|
-
|
9
|
-
#include <memory>
|
10
|
-
#include <mutex>
|
11
|
-
#include <utility>
|
12
|
-
|
13
|
-
namespace RNSkia {
|
14
|
-
|
15
|
-
class JsiCustomDrawingNode : public JsiDomDrawingNode,
|
16
|
-
public JsiDomNodeCtor<JsiCustomDrawingNode> {
|
17
|
-
public:
|
18
|
-
explicit JsiCustomDrawingNode(std::shared_ptr<RNSkPlatformContext> context)
|
19
|
-
: JsiDomDrawingNode(context, "skCustomDrawing") {}
|
20
|
-
|
21
|
-
protected:
|
22
|
-
void draw(DrawingContext *context) override {
|
23
|
-
if (_drawing != nullptr) {
|
24
|
-
|
25
|
-
// Only repaint the picture IF we did not get to the draw function
|
26
|
-
// from a redrawRequest after creating the picture!
|
27
|
-
if (!_inRedrawCycle || _drawingProp->isChanged()) {
|
28
|
-
|
29
|
-
float scaledWidth = context->getScaledWidth();
|
30
|
-
float scaledHeight = context->getScaledHeight();
|
31
|
-
auto paint = context->getPaint();
|
32
|
-
auto platformContext = getContext();
|
33
|
-
auto requestRedraw = context->getRequestRedraw();
|
34
|
-
|
35
|
-
// Create/set the paint/canvas wrappers
|
36
|
-
if (_jsiPaint == nullptr) {
|
37
|
-
_jsiPaint = std::make_shared<JsiSkPaint>(getContext(), *paint);
|
38
|
-
} else {
|
39
|
-
_jsiPaint->fromPaint(*paint);
|
40
|
-
}
|
41
|
-
|
42
|
-
if (_jsiCanvas == nullptr) {
|
43
|
-
_jsiCanvas = std::make_shared<JsiSkCanvas>(getContext());
|
44
|
-
}
|
45
|
-
|
46
|
-
// Run rendering on the javascript thread
|
47
|
-
getContext()->runOnJavascriptThread([this, platformContext,
|
48
|
-
requestRedraw, scaledWidth,
|
49
|
-
scaledHeight]() {
|
50
|
-
// Get the runtime
|
51
|
-
auto runtime = platformContext->getJsRuntime();
|
52
|
-
|
53
|
-
// Create the picture recorder
|
54
|
-
SkPictureRecorder recorder;
|
55
|
-
SkRTreeFactory factory;
|
56
|
-
SkCanvas *canvas =
|
57
|
-
recorder.beginRecording(scaledWidth, scaledHeight, &factory);
|
58
|
-
|
59
|
-
auto jsiCanvas =
|
60
|
-
std::make_shared<JsiSkCanvas>(platformContext, canvas);
|
61
|
-
|
62
|
-
// Create context wrapper
|
63
|
-
auto jsiCtx = jsi::Object(*runtime);
|
64
|
-
jsiCtx.setProperty(
|
65
|
-
*runtime, "paint",
|
66
|
-
jsi::Object::createFromHostObject(*runtime, this->_jsiPaint));
|
67
|
-
|
68
|
-
jsiCtx.setProperty(
|
69
|
-
*runtime, "canvas",
|
70
|
-
jsi::Object::createFromHostObject(*runtime, jsiCanvas));
|
71
|
-
|
72
|
-
std::array<jsi::Value, 1> args;
|
73
|
-
args[0] = std::move(jsiCtx);
|
74
|
-
|
75
|
-
// Draw
|
76
|
-
_drawing(*runtime, jsi::Value::undefined(),
|
77
|
-
static_cast<const jsi::Value *>(args.data()), 1);
|
78
|
-
|
79
|
-
auto picture = recorder.finishRecordingAsPicture();
|
80
|
-
{
|
81
|
-
// Lock access to the picture property's setter
|
82
|
-
std::lock_guard<std::mutex> lock(_pictureLock);
|
83
|
-
this->_drawingProp->setPicture(picture);
|
84
|
-
}
|
85
|
-
|
86
|
-
// Ask view to redraw itself
|
87
|
-
_inRedrawCycle = true;
|
88
|
-
requestRedraw();
|
89
|
-
});
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
if (_drawingProp->isSet()) {
|
94
|
-
std::lock_guard<std::mutex> lock(_pictureLock);
|
95
|
-
context->getCanvas()->drawPicture(_drawingProp->getDerivedValue());
|
96
|
-
_inRedrawCycle = false;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
void defineProperties(NodePropsContainer *container) override {
|
101
|
-
JsiDomDrawingNode::defineProperties(container);
|
102
|
-
|
103
|
-
NotifyNeedRenderCallback cb =
|
104
|
-
std::bind(&JsiCustomDrawingNode::notifyPictureNeeded, this,
|
105
|
-
std::placeholders::_1);
|
106
|
-
|
107
|
-
_drawingProp = container->defineProperty<DrawingProp>("drawing", cb);
|
108
|
-
}
|
109
|
-
|
110
|
-
private:
|
111
|
-
void notifyPictureNeeded(jsi::HostFunctionType drawing) {
|
112
|
-
_drawing = drawing;
|
113
|
-
}
|
114
|
-
|
115
|
-
jsi::HostFunctionType _drawing;
|
116
|
-
|
117
|
-
DrawingProp *_drawingProp;
|
118
|
-
|
119
|
-
std::array<jsi::Value, 1> _argsCache;
|
120
|
-
std::shared_ptr<JsiSkPaint> _jsiPaint;
|
121
|
-
std::shared_ptr<JsiSkCanvas> _jsiCanvas;
|
122
|
-
|
123
|
-
std::atomic<bool> _inRedrawCycle = {false};
|
124
|
-
std::mutex _pictureLock;
|
125
|
-
};
|
126
|
-
|
127
|
-
} // namespace RNSkia
|
@@ -1,35 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include "DerivedNodeProp.h"
|
4
|
-
|
5
|
-
#include "JsiSkFont.h"
|
6
|
-
|
7
|
-
#include <memory>
|
8
|
-
|
9
|
-
namespace RNSkia {
|
10
|
-
|
11
|
-
using NotifyNeedRenderCallback =
|
12
|
-
std::function<void(jsi::HostFunctionType drawing)>;
|
13
|
-
|
14
|
-
class DrawingProp : public DerivedSkProp<SkPicture> {
|
15
|
-
public:
|
16
|
-
DrawingProp(PropId name, NotifyNeedRenderCallback notifyPictureNeeded,
|
17
|
-
const std::function<void(BaseNodeProp *)> &onChange)
|
18
|
-
: _notifyPictureNeeded(notifyPictureNeeded), DerivedSkProp<SkPicture>(
|
19
|
-
onChange) {
|
20
|
-
_drawingProp = defineProperty<NodeProp>(name);
|
21
|
-
}
|
22
|
-
|
23
|
-
void updateDerivedValue() override {
|
24
|
-
auto drawingFunc = _drawingProp->value().getAsFunction();
|
25
|
-
_notifyPictureNeeded(drawingFunc);
|
26
|
-
}
|
27
|
-
|
28
|
-
void setPicture(sk_sp<SkPicture> picture) { setDerivedValue(picture); }
|
29
|
-
|
30
|
-
private:
|
31
|
-
NodeProp *_drawingProp;
|
32
|
-
NotifyNeedRenderCallback _notifyPictureNeeded;
|
33
|
-
};
|
34
|
-
|
35
|
-
} // namespace RNSkia
|
@@ -1,140 +0,0 @@
|
|
1
|
-
|
2
|
-
#pragma once
|
3
|
-
|
4
|
-
#include "RNSkPlatformContext.h"
|
5
|
-
#include "RNSkReadonlyValue.h"
|
6
|
-
#include <jsi/jsi.h>
|
7
|
-
|
8
|
-
#include <algorithm>
|
9
|
-
#include <chrono>
|
10
|
-
#include <functional>
|
11
|
-
#include <memory>
|
12
|
-
|
13
|
-
namespace RNSkia {
|
14
|
-
namespace jsi = facebook::jsi;
|
15
|
-
/**
|
16
|
-
Implements a readonly Value that is updated every time the screen is redrawn.
|
17
|
-
Its value will be the number of milliseconds since the animation value was
|
18
|
-
started.
|
19
|
-
*/
|
20
|
-
class RNSkClockValue : public RNSkReadonlyValue {
|
21
|
-
enum RNSkClockState { NotStarted = 0, Running = 1, Stopped = 2 };
|
22
|
-
|
23
|
-
public:
|
24
|
-
RNSkClockValue(std::shared_ptr<RNSkPlatformContext> platformContext,
|
25
|
-
size_t identifier, jsi::Runtime &runtime,
|
26
|
-
const jsi::Value *arguments, size_t count)
|
27
|
-
: RNSkReadonlyValue(platformContext), _runtime(runtime),
|
28
|
-
_identifier(identifier) {
|
29
|
-
// Start by updating to zero (start value)
|
30
|
-
update(_runtime, static_cast<double>(0));
|
31
|
-
}
|
32
|
-
|
33
|
-
virtual ~RNSkClockValue() { stopClock(); }
|
34
|
-
|
35
|
-
JSI_HOST_FUNCTION(start) {
|
36
|
-
startClock();
|
37
|
-
return jsi::Value::undefined();
|
38
|
-
}
|
39
|
-
|
40
|
-
JSI_HOST_FUNCTION(stop) {
|
41
|
-
stopClock();
|
42
|
-
return jsi::Value::undefined();
|
43
|
-
}
|
44
|
-
|
45
|
-
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(RNSkReadonlyValue, addListener),
|
46
|
-
JSI_EXPORT_FUNC(RNSkClockValue, start),
|
47
|
-
JSI_EXPORT_FUNC(RNSkClockValue, stop))
|
48
|
-
|
49
|
-
virtual void startClock() {
|
50
|
-
if (_state == RNSkClockState::Running) {
|
51
|
-
return;
|
52
|
-
}
|
53
|
-
|
54
|
-
auto now = std::chrono::high_resolution_clock::now();
|
55
|
-
if (_state == RNSkClockState::NotStarted) {
|
56
|
-
_start = now;
|
57
|
-
_stop = now;
|
58
|
-
}
|
59
|
-
|
60
|
-
// Subtract pause time from start
|
61
|
-
auto timeSinceStop = now - _stop;
|
62
|
-
_start += timeSinceStop;
|
63
|
-
|
64
|
-
_state = RNSkClockState::Running;
|
65
|
-
|
66
|
-
getContext()->beginDrawLoop(
|
67
|
-
_identifier, [weakSelf = weak_from_this()](bool invalidated) {
|
68
|
-
auto self = weakSelf.lock();
|
69
|
-
if (self) {
|
70
|
-
std::dynamic_pointer_cast<RNSkClockValue>(self)->notifyUpdate(
|
71
|
-
invalidated);
|
72
|
-
}
|
73
|
-
});
|
74
|
-
}
|
75
|
-
|
76
|
-
virtual void stopClock() {
|
77
|
-
if (_state == RNSkClockState::Running) {
|
78
|
-
_state = RNSkClockState::Stopped;
|
79
|
-
_stop = std::chrono::high_resolution_clock::now();
|
80
|
-
getContext()->endDrawLoop(_identifier);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
protected:
|
85
|
-
virtual void tick(jsi::Runtime &runtime, const jsi::Value &value) {
|
86
|
-
RNSkClockValue::update(runtime, value);
|
87
|
-
}
|
88
|
-
|
89
|
-
void notifyUpdate(bool invalidated) {
|
90
|
-
if (invalidated) {
|
91
|
-
stopClock();
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
|
95
|
-
if (_state != RNSkClockState::Running) {
|
96
|
-
return;
|
97
|
-
}
|
98
|
-
|
99
|
-
// Ensure we call any updates from the draw loop on the javascript thread
|
100
|
-
getContext()->runOnJavascriptThread(
|
101
|
-
// To ensure that this shared_ptr instance is not deallocated before we
|
102
|
-
// are done running the update lambda we pass a shared from this to the
|
103
|
-
// lambda scope.
|
104
|
-
[weakSelf = weak_from_this()]() {
|
105
|
-
auto self = weakSelf.lock();
|
106
|
-
if (self) {
|
107
|
-
auto selfClockValue =
|
108
|
-
std::dynamic_pointer_cast<RNSkClockValue>(self);
|
109
|
-
if (selfClockValue->getState() == RNSkClockState::Running) {
|
110
|
-
auto now = std::chrono::high_resolution_clock::now();
|
111
|
-
auto deltaFromStart =
|
112
|
-
std::chrono::duration_cast<std::chrono::milliseconds>(
|
113
|
-
now - selfClockValue->_start)
|
114
|
-
.count();
|
115
|
-
selfClockValue->tick(selfClockValue->_runtime,
|
116
|
-
static_cast<double>(deltaFromStart));
|
117
|
-
}
|
118
|
-
}
|
119
|
-
});
|
120
|
-
}
|
121
|
-
|
122
|
-
/**
|
123
|
-
Returns the draw identifier for the clock. This identifier is used
|
124
|
-
for the draw loop.
|
125
|
-
*/
|
126
|
-
size_t getIdentifier() { return _identifier; }
|
127
|
-
|
128
|
-
/**
|
129
|
-
Returns the state of the clock
|
130
|
-
*/
|
131
|
-
RNSkClockState getState() { return _state; }
|
132
|
-
|
133
|
-
jsi::Runtime &_runtime;
|
134
|
-
size_t _identifier;
|
135
|
-
std::chrono::time_point<std::chrono::steady_clock> _start;
|
136
|
-
std::chrono::time_point<std::chrono::steady_clock> _stop;
|
137
|
-
std::atomic<RNSkClockState> _state = {RNSkClockState::NotStarted};
|
138
|
-
};
|
139
|
-
|
140
|
-
} // namespace RNSkia
|
@@ -1,104 +0,0 @@
|
|
1
|
-
|
2
|
-
#pragma once
|
3
|
-
|
4
|
-
#include "RNSkPlatformContext.h"
|
5
|
-
#include "RNSkReadonlyValue.h"
|
6
|
-
#include <jsi/jsi.h>
|
7
|
-
|
8
|
-
#include <algorithm>
|
9
|
-
#include <chrono>
|
10
|
-
#include <functional>
|
11
|
-
#include <memory>
|
12
|
-
#include <vector>
|
13
|
-
|
14
|
-
namespace RNSkia {
|
15
|
-
namespace jsi = facebook::jsi;
|
16
|
-
|
17
|
-
/**
|
18
|
-
Creates a readonly value that depends on one or more other values. The derived
|
19
|
-
value has a callback function that is used to calculate the new value when any
|
20
|
-
of the dependencies change.
|
21
|
-
*/
|
22
|
-
class RNSkComputedValue : public RNSkReadonlyValue {
|
23
|
-
public:
|
24
|
-
RNSkComputedValue(std::shared_ptr<RNSkPlatformContext> platformContext,
|
25
|
-
jsi::Runtime &runtime, const jsi::Value *arguments,
|
26
|
-
size_t count)
|
27
|
-
: RNSkReadonlyValue(platformContext) {
|
28
|
-
// Verify input
|
29
|
-
if (!arguments[0].isObject() ||
|
30
|
-
!arguments[0].asObject(runtime).isFunction(runtime)) {
|
31
|
-
throw jsi::JSError(runtime,
|
32
|
-
"Expected callback function as first parameter");
|
33
|
-
}
|
34
|
-
|
35
|
-
if (!arguments[1].isObject() ||
|
36
|
-
!arguments[1].asObject(runtime).isArray(runtime)) {
|
37
|
-
throw jsi::JSError(runtime,
|
38
|
-
"Expected array of dependencies as second parameter");
|
39
|
-
}
|
40
|
-
|
41
|
-
// Get callback for calculating result
|
42
|
-
_callback = std::make_shared<jsi::Function>(
|
43
|
-
arguments[0].asObject(runtime).asFunction(runtime));
|
44
|
-
}
|
45
|
-
|
46
|
-
void invalidate() override {
|
47
|
-
RNSkReadonlyValue::invalidate();
|
48
|
-
|
49
|
-
// Unregister listeners
|
50
|
-
for (const auto &unsubscribe : _unsubscribers) {
|
51
|
-
unsubscribe();
|
52
|
-
}
|
53
|
-
_unsubscribers.clear();
|
54
|
-
}
|
55
|
-
|
56
|
-
void initializeDependencies(jsi::Runtime &runtime,
|
57
|
-
const jsi::Value *arguments, size_t count) {
|
58
|
-
// Save dependencies
|
59
|
-
std::vector<std::shared_ptr<RNSkReadonlyValue>> dependencies;
|
60
|
-
|
61
|
-
// Ensure that all dependencies are Values
|
62
|
-
auto deps = arguments[1].asObject(runtime).asArray(runtime);
|
63
|
-
const std::size_t size = deps.size(runtime);
|
64
|
-
dependencies.reserve(size);
|
65
|
-
for (size_t i = 0; i < size; ++i) {
|
66
|
-
auto dep = deps.getValueAtIndex(runtime, i);
|
67
|
-
if (!dep.isObject() || !dep.asObject(runtime).isHostObject(runtime)) {
|
68
|
-
continue;
|
69
|
-
}
|
70
|
-
auto value =
|
71
|
-
dep.asObject(runtime).asHostObject<RNSkReadonlyValue>(runtime);
|
72
|
-
if (value == nullptr) {
|
73
|
-
continue;
|
74
|
-
}
|
75
|
-
dependencies.push_back(value);
|
76
|
-
}
|
77
|
-
|
78
|
-
// register change handler on dependencies
|
79
|
-
_unsubscribers.reserve(_unsubscribers.size() + size);
|
80
|
-
for (const auto &dep : dependencies) {
|
81
|
-
_unsubscribers.push_back(dep->addListener([weakSelf = weak_from_this()](
|
82
|
-
jsi::Runtime &runtime) {
|
83
|
-
auto self = weakSelf.lock();
|
84
|
-
if (self) {
|
85
|
-
auto selfAsThis = std::dynamic_pointer_cast<RNSkComputedValue>(self);
|
86
|
-
selfAsThis->dependencyUpdated(runtime);
|
87
|
-
}
|
88
|
-
}));
|
89
|
-
}
|
90
|
-
|
91
|
-
// Set initial value
|
92
|
-
dependencyUpdated(runtime);
|
93
|
-
}
|
94
|
-
|
95
|
-
private:
|
96
|
-
void dependencyUpdated(jsi::Runtime &runtime) {
|
97
|
-
// Calculate new value
|
98
|
-
update(runtime, _callback->call(runtime, nullptr, 0));
|
99
|
-
}
|
100
|
-
|
101
|
-
std::shared_ptr<jsi::Function> _callback;
|
102
|
-
std::vector<std::function<void()>> _unsubscribers;
|
103
|
-
};
|
104
|
-
} // namespace RNSkia
|