Skip to content

Commit 9b2c034

Browse files
committed
fix: svg display issues
1 parent dd2acd0 commit 9b2c034

File tree

36 files changed

+276
-139
lines changed

36 files changed

+276
-139
lines changed

CanvasNative.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
22

33
s.name = "CanvasNative"
44

5-
s.version = "1.0.0-alpha.0"
5+
s.version = "1.0.0-alpha.1"
66

77
s.summary = "A Canvas library"
88

packages/canvas/SVG/SVG.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class Svg extends View {
135135
__redraw() {
136136
if (this.__attachedToDom) {
137137
const domCopy = this._dom.valueOf();
138+
const serialized = this._serializer.serializeToString(domCopy);
138139
const width = domCopy.documentElement.getAttribute('width');
139140
const height = domCopy.documentElement.getAttribute('height');
140141
if (width === 'auto') {
@@ -143,15 +144,23 @@ export class Svg extends View {
143144
if (height === 'auto') {
144145
domCopy.documentElement.setAttribute('height', `${this.getMeasuredHeight()}px`);
145146
}
146-
const serialized = this._serializer.serializeToString(domCopy);
147147
if (serialized !== initialSVG) {
148148
this.src = serialized;
149149
}
150150
}
151151
}
152152

153-
createNativeView(): Object {
153+
onLoaded() {
154+
super.onLoaded();
154155
this.__attachedToDom = true;
156+
}
157+
158+
onUnloaded() {
159+
this.__attachedToDom = false;
160+
super.onUnloaded();
161+
}
162+
163+
createNativeView(): Object {
155164
return this._svg;
156165
}
157166

packages/canvas/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/canvas",
3-
"version": "1.0.0-alpha.0",
3+
"version": "1.0.0-alpha.1",
44
"description": "DOM Canvas API for NativeScript",
55
"main": "index",
66
"typings": "index.d.ts",
@@ -31,5 +31,9 @@
3131
"license": "Apache-2.0",
3232
"homepage": "https://github.com/NativeScript/canvas",
3333
"readmeFilename": "README.md",
34-
"bootstrapper": "@nativescript/plugin-seed"
34+
"bootstrapper": "@nativescript/plugin-seed",
35+
"dependencies": {
36+
"xmldom": "~0.6.0",
37+
"@nativescript-community/gesturehandler": "0.1.45"
38+
}
3539
}

packages/canvas/platforms/android/include.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ allprojects {
66
}
77

88
dependencies {
9-
implementation 'org.nativescript:canvas:1.0.0-alpha.0'
9+
implementation 'org.nativescript:canvas:1.0.0-alpha.1'
1010
}

packages/canvas/platforms/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ use_frameworks!
22
platform :ios, '11.0'
33
#pod 'CanvasNative' , '~> 1.0.0.alpha.0'
44
#pod 'CanvasNative', :path => "$(SRCROOT)/../../../../../"
5-
pod 'CanvasNative', :git => 'https://github.com/NativeScript/canvas.git', :tag => '1.0.0-alpha.0'
5+
pod 'CanvasNative', :git => 'https://github.com/NativeScript/canvas.git', :tag => '1.0.0-alpha.1'
66

packages/canvas/src-native/canvas-android/.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/canvas/src-native/canvas-android/.idea/deploymentTargetDropDown.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/canvas/src-native/canvas-android/.idea/gradle.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/canvas/src-native/canvas-android/.idea/misc.xml

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/canvas/src-native/canvas-android/.idea/runConfigurations.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)