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:
- Close Studio Pro.
- Open the tools\node\node_modules\mendix\widgets\native\Button.js file in the Studio Pro installation folder (the folder that contains studiopro.exe).
- Find the line that declares the
Textcomponent:return jsx(Text,{testID:`${name}$caption`... - Add
numberOfLines:1,after thetestIDproperty:jsx(Text,{testID:`${name}$caption`, numberOfLines:1,... - 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
0 Comments