diff --git a/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java b/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java
index c06c9c00..334bf1d8 100644
--- a/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java
+++ b/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java
@@ -101,7 +101,11 @@ public class DoricNativeDriver implements IDoricDriver {
if (object == contextId) {
continue;
}
- stringBuilder.append(object.toString()).append(",");
+ if (object == null) {
+ stringBuilder.append("null").append(",");
+ } else {
+ stringBuilder.append(object.toString()).append(",");
+ }
}
final String anchorName = stringBuilder.toString();
final DoricPerformanceProfile finalProfile = profile;
diff --git a/doric-demo/src/TSXDemo.tsx b/doric-demo/src/TSXDemo.tsx
index 508ea7da..e5c650fe 100644
--- a/doric-demo/src/TSXDemo.tsx
+++ b/doric-demo/src/TSXDemo.tsx
@@ -1,51 +1,138 @@
import {
jsx,
VLayout,
+ HLayout,
Panel,
Gravity,
Group,
layoutConfig,
Text,
createRef,
+ Color,
+ loge,
} from "doric";
-function createFragment() {
- return (
- <>
-
-
- >
- );
-}
-
@Entry
class Counter extends Panel {
build(root: Group) {
- const fragments = createFragment();
- const ref = createRef();
- let count = 0;
+ root.backgroundColor = Color.BLACK;
+ const hour1Ref = createRef();
+ const hour2Ref = createRef();
+ const min1Ref = createRef();
+ const min2Ref = createRef();
+ const sec1Ref = createRef();
+ const sec2Ref = createRef();
+ const comm1Ref = createRef();
+ const comm2Ref = createRef();
+
-
- {`${count}`}
-
- {
- count++;
- ref.current.text = `${count}`;
- }}
- >
- {fragments}
- {fragments}
- {[0, 1, 2, 3].map((i) => (
-
- ))}
+
+
+ 0
+
+
+ 0
+
+
+ :
+
+
+ 0
+
+
+ 0
+
+
+ :
+
+
+ 0
+
+
+ 0
+
+
;
+
+ this.addOnRenderFinishedCallback(async () => {
+ const width = await root.getWidth(this.context);
+ [
+ hour1Ref,
+ hour2Ref,
+ comm1Ref,
+ min1Ref,
+ min2Ref,
+ comm2Ref,
+ sec1Ref,
+ sec2Ref,
+ ].forEach((e) => {
+ e.current.apply({
+ border: undefined,
+ textSize: width / 10,
+ });
+ });
+ });
+ setInterval(() => {
+ const time = new Date();
+ hour1Ref.current.text = `${Math.floor(time.getHours() / 10)}`;
+ hour2Ref.current.text = `${Math.floor(time.getHours() % 10)}`;
+
+ min1Ref.current.text = `${Math.floor(time.getMinutes() / 10)}`;
+ min2Ref.current.text = `${Math.floor(time.getMinutes() % 10)}`;
+
+ sec1Ref.current.text = `${Math.floor(time.getSeconds() / 10)}`;
+ sec2Ref.current.text = `${Math.floor(time.getSeconds() % 10)}`;
+ }, 100);
}
}