mirror of
https://github.com/kusti8/proton-native.git
synced 2026-05-15 14:15:50 -06:00
parent
9fbc83ec36
commit
178c0903b3
2 changed files with 28 additions and 2 deletions
|
|
@ -33,6 +33,8 @@ render(<Example />);
|
|||
|
||||
_Not all fonts support all possible options_
|
||||
|
||||
* [x](#x) (only in a top level text component)
|
||||
* [y](#y) (only in a top level text component)
|
||||
* [fontSize](#fontsize)
|
||||
* [fontFamily](#fontfamily)
|
||||
* [color](#color)
|
||||
|
|
@ -126,3 +128,19 @@ Wheter the text should be aligned to the left, center or right. **Works only on
|
|||
| **Type** | **Required** |
|
||||
| ------------------------------- | ------------ |
|
||||
| enum('left', 'center', 'right') | false |
|
||||
|
||||
### x
|
||||
|
||||
The x coordinate of the text's top left corner. (Only in a top level text component.)
|
||||
|
||||
| **Type** | **Required** | **Default** |
|
||||
| ----------------------------- | ------------ | ----------- |
|
||||
| number | string (number) | false | 0 |
|
||||
|
||||
### y
|
||||
|
||||
The y coordinate of the text's top left corner. (Only in a top level text component.)
|
||||
|
||||
| **Type** | **Required** | **Default** |
|
||||
| ----------------------------- | ------------ | ----------- |
|
||||
| number | string (number) | false | 0 |
|
||||
|
|
|
|||
|
|
@ -853,6 +853,7 @@ Area.Text = class AreaText extends AreaComponent {
|
|||
libui.textItalic.normal,
|
||||
libui.textStretch.normal
|
||||
);
|
||||
|
||||
const layout = new libui.DrawTextLayout(
|
||||
this.str,
|
||||
font,
|
||||
|
|
@ -867,8 +868,8 @@ Area.Text = class AreaText extends AreaComponent {
|
|||
p
|
||||
.getContext()
|
||||
.text(
|
||||
this.parseParent(this.props.x || 0, p, false),
|
||||
this.parseParent(this.props.y || 0, p, true),
|
||||
this.parseParent(this.props.x, p, false),
|
||||
this.parseParent(this.props.y, p, true),
|
||||
layout
|
||||
);
|
||||
|
||||
|
|
@ -900,6 +901,13 @@ function areaProp(props, propName, componentName) {
|
|||
|
||||
Area.Text.propTypes = {
|
||||
children: PropTypes.oneOfType([areaProp, PropTypes.arrayOf(areaProp)]),
|
||||
x: PropTypes.number,
|
||||
y: PropTypes.number,
|
||||
};
|
||||
|
||||
Area.Text.defaultProps = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
};
|
||||
|
||||
export default Area;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue