Skip to content

Commit

Permalink
feat(runtime): add FormattedString and Span
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 committed Apr 25, 2020
1 parent 4976309 commit c0de02e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/test/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ function useInterval(cb, ms) {

const app = createApp({
render() {
return h({
template: `<Label verticalAlignment="middle" textAlignment="center"><FormattedString>
<Span text="Cool" />
<Span text="is" color="red" fontWeight="bold"/>
<Span text="Cool" color="blue" textDecoration="underline"/>
</FormattedString></Label>`,
})
return h('GridLayout', h(ListViewComp))
return h(Comp)

Expand Down
8 changes: 8 additions & 0 deletions packages/runtime/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ if (!__TEST__) {
}
}
)
registerElement(
'FormattedString',
() => require('@nativescript/core').FormattedString
)
registerElement(
'Image',
() => require('@nativescript/core').Image
Expand Down Expand Up @@ -292,6 +296,10 @@ if (!__TEST__) {
}
}
)
registerElement(
'Span',
() => require('@nativescript/core').Span,
)
registerElement(
'Switch',
() => require('@nativescript/core').Switch,
Expand Down

0 comments on commit c0de02e

Please sign in to comment.