Skip to content

Commit a566884

Browse files
authored
fix: correct undefined toString function and nullable path variable (#97)
* fix: iOS release `toString()` build failure * fix: RN 0.77,x android nullability issue of `path.getString()`
1 parent 92b8878 commit a566884

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

android/src/main/java/com/sourcetoad/reactnativesketchcanvas/RNTSketchCanvasManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ class RNTSketchCanvasViewManager :
133133
if (path != null) {
134134
for (i in 0 until path.size()) {
135135
val coor =
136-
path.getString(i).split(",".toRegex()).dropLastWhile { it.isEmpty() }
137-
.toTypedArray()
138-
if (pointPath != null) {
136+
path.getString(i)?.split(",".toRegex())?.dropLastWhile { it.isEmpty() }
137+
?.toTypedArray()
138+
if (coor != null && pointPath != null) {
139139
pointPath.add(PointF(coor[0].toFloat(), coor[1].toFloat()))
140140
}
141141
}

ios/RNSketchCanvasViewComponent.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ -(void)prepareForRecycle {
7373

7474
- (NSDictionary*)RNTSketchCanvasTextStructToDict:(const RNTSketchCanvasTextStruct&)txt {
7575
return @{
76-
@"text": RCTNSStringFromString(toString(txt.text)),
76+
@"text": RCTNSStringFromString(txt.text),
7777
@"font": RCTNSStringFromString(txt.font),
7878
@"fontSize": @(txt.fontSize),
7979
@"fontColor": @(txt.fontColor),

0 commit comments

Comments
 (0)