Skip to content

bug(android): VoltraAndroid.Text ignores maxLines/numberOfLines in non-bitmap renderer #139

@hsravat-4590

Description

@hsravat-4590

Summary

VoltraAndroid.Text does not honor line limits (maxLines prop and style numberOfLines) when rendered through the non-bitmap Android text path.

Repro

  1. Render an Android widget text node with either:
    • maxLines={1} on VoltraAndroid.Text, or
    • style={{ numberOfLines: 1 }}
  2. Provide long text that should truncate.
  3. Observe text is not line-limited in normal text renderer.

Expected

Android text should respect line limits consistently, same as button/input components and bitmap text renderer.

Actual

Line limits are ignored in RenderText normal path.

Root cause

RenderText in packages/voltra/android/src/main/java/voltra/glance/renderers/TextAndImageRenderers.kt called:

  • Text(text = text, modifier = finalModifier, style = glanceTextStyle)
    without passing maxLines, and did not reconcile maxLines with style lineLimit.

Proposed fix

  • Compute effective line limit with priority:
    1. maxLines prop
    2. style numberOfLines (mapped to lineLimit)
    3. default Int.MAX_VALUE
  • Pass maxLines to Glance Text(...)
  • Apply same line limit in bitmap rendering path for consistency.

Notes

A patch implementing this is on branch fix/android-text-line-limits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions