Displaying text using label components
The UILabel component can be used to display text.
Step 1
Make sure your activity references the correct view component.
import { view } from "./view";
class MainActivity extends PageViewComponent.with(view) {
// ... activity methods
}
Step 2 (JSX)
Add a label somewhere in your view, and add the text between the <label>
and </label>
tags.
// view.tsx
export default (
<cell>
<centerrow>
<label>Text goes here</label>
</centerrow>
</cell>
);
Alternative (without JSX)
Use the static UILabel.withText()
method to create a component factory for a label that contains given text.
// view.ts
export default UICell.with(
UICenterRow.with(UILabel.withText("Text goes here"))
);