feat:complete the implement of JSX
This commit is contained in:
@@ -4,7 +4,7 @@ import { Scroller } from "./scroller";
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
import { layoutConfig } from "../util/layoutconfig";
|
||||
|
||||
export class Refreshable extends Superview {
|
||||
export class Refreshable extends Superview implements JSX.ElementChildrenAttribute {
|
||||
|
||||
content!: View
|
||||
|
||||
@@ -42,6 +42,15 @@ export class Refreshable extends Superview {
|
||||
this.dirtyProps.header = ((this.header || {}) as any).viewId
|
||||
return super.toModel()
|
||||
}
|
||||
|
||||
set innerElement(e: View | [View, View]) {
|
||||
if (e instanceof View) {
|
||||
this.content = e
|
||||
} else {
|
||||
this.header = e[0]
|
||||
this.content = e[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function refreshable(config: Partial<Refreshable>) {
|
||||
|
@@ -28,7 +28,7 @@ export function scroller(content: View, config?: Partial<Scroller>) {
|
||||
}
|
||||
|
||||
|
||||
export class Scroller extends Superview {
|
||||
export class Scroller extends Superview implements JSX.ElementChildrenAttribute {
|
||||
content!: View
|
||||
|
||||
@Property
|
||||
@@ -64,4 +64,8 @@ export class Scroller extends Superview {
|
||||
scrollBy(context: BridgeContext, offset: { x: number, y: number }, animated?: boolean) {
|
||||
return this.nativeChannel(context, "scrollBy")({ offset, animated })
|
||||
}
|
||||
|
||||
set innerElement(e: View) {
|
||||
this.content = e
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ export enum TruncateAt {
|
||||
Clip = 3,
|
||||
}
|
||||
|
||||
export class Text extends View {
|
||||
export class Text extends View implements JSX.ElementChildrenAttribute {
|
||||
@Property
|
||||
text?: string
|
||||
|
||||
@@ -67,6 +67,10 @@ export class Text extends View {
|
||||
|
||||
@Property
|
||||
truncateAt?: TruncateAt
|
||||
|
||||
set innerElement(e: string) {
|
||||
this.text = e
|
||||
}
|
||||
}
|
||||
|
||||
export function text(config: Partial<Text>) {
|
||||
|
Reference in New Issue
Block a user