Skip to main content
Version: 7.2.0

Wrapping Content in Apps

Smartface framework provides an alternative method for wrapping own content of the parent view.

This method can be useful when the size of the view must be calculated dynamically. According to the specified Font size and family, sizeOfString method returns calculated height and width of the object. In addition, you should pass the text and the maxWidth parameters to the sizeOfString method. You can see the sample code below:

JavaScript
const wrapContent = Font.create(Font.DEFAULT, 16, Font.NORMAL).sizeOfString(
yourText,
yourMaxWidth
);

console.log(
"Height of string " +
wrapContent.height +
" width of string " +
wrapContent.width
);

For more information, you can refer to the API reference docs