question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested TextView text is not aligned correctly as expected

See original GitHub issue

Problem description

We create a TextView, position it in the right bound of its parent widget and don’t specify the width. Its size will be calculated according to the text size. Then we create another TextView that needs to be positioned between left bound and the previous TextView. In that case, the width of the right TextView is not calculated correctly.

Expected behavior

Create any widget between left bound and the right TextView must not affect to the width of the right TextView.

Environment

  • Tabris.js version: 2.1
  • Device: iPhone 6
  • OS: iOS 11.0

Code snippet

import {Composite, TextView, ui} from 'tabris';

new Composite({class: 'container', left: 0, right: 0, centerY: 0}).append(
  new TextView({
    class: 'right',
    text: 'Right text',
    right: 0, top: 0,
    background: 'rgba(255, 255, 0, 0.3)'
  }),
  new TextView({
    class: 'left',
    text: 'Left text',
    left: 0, top: 0, right: ['.right', 8],
    background: 'rgba(0, 255, 255, 0.3)'
  })
).appendTo(ui.contentView);

It works as expected in Android: first

The issue in iOS: second

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
karolszafranskicommented, Apr 20, 2017

Fixed in tabris-ios with a9491652142673e91c835426a59e6e268d5d05d9

simulator screen shot 20 apr 2017 16 57 17

0reactions
elshadsmcommented, Oct 19, 2017

However, I can reproduce the issue with Tabris.js 2.1.1 version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested View and Text vertical alignment issue. #31955 - GitHub
Nesting View inside Text adds lineHeight's marginBottom to View and when we add Text inside that View it doesn't gets aligned properly.
Read more >
Centering left-aligned-to-longest-TextView TextViews not ...
I want to create a layout where there are multiple lines with various lengths of text. All the texts are centered ...
Read more >
TextView - Android Developers
android:gravity, Specifies how to align the text by the view's x- and/or y-axis ... Whether or not the auto handwriting initiation is enabled...
Read more >
ConstraintLayout Tutorial for Android: Getting Started
Applying Alignment Constraints ... Select the Raze Galactic TextView and click on the right anchor and left anchor to delete those constraints.
Read more >
Aligning Children using Flexbox in React Native - Modus Create
In this article, we learn how to align children in React Native. ... StyleSheet, Text, View, Component } = React; class ReactLayouts extends ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found