<-- Back

Horizontal button captions cut off on Android native mobile applications

Issue

The caption of a horizontal Button widget in a native mobile app is cut off on some Android devices. Only the first few words of the caption display, and the rest of the caption is cut off.

Environment

  • Studio Pro v17.0.0 and older
  • Studio Pro v11.12.8 and older

Cause

The Button widget in native mobile apps does not restrict the caption to a single line. On the affected Android devices, the caption text wraps or is clipped inside the button, and the remaining text is not displayed. Changes to the button styling, such as flexShrink and minHeight in custom-variables.js, do not resolve the behavior.

Solution / Workaround

Mendix is working on changes that render the button caption on a single line by default, with the option to override this behavior through custom styling. These changes are set to be released in Studio Pro versions 11.18.0 and 11.12.9. As a workaround in the meantime, add the numberOfLines property to the compiled Button widget file in the Studio Pro installation folder to force the caption onto a single line:

  1. Close Studio Pro.
  2. Open the tools\node\node_modules\mendix\widgets\native\Button.js file in the Studio Pro installation folder (the folder that contains studiopro.exe).
  3. Find the line that declares the Text component: return jsx(Text,{testID:`${name}$caption`...
  4. Add numberOfLines:1, after the testID property: jsx(Text,{testID:`${name}$caption`, numberOfLines:1,...
  5. Save the file, open Studio Pro, and rebuild the native app.

The numberOfLines property truncates a caption that does not fit on a single line. The change applies only to the edited Studio Pro installation.

Internal information related

  • 286281
  • MOO-2483
  • C07BE6K6F5L/p1788527487287579

Additional information

Mendix documentation: Button Properties

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.