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.

FlexboxLayout does not work properly in ActionBar

See original GitHub issue

The code in xml is as follows:

<Page.actionBar>

			<ActionBar>
				<ActionBar.titleView>
					<FlexboxLayout flexDirection="row" justifyContent="space-between">
						<Label text="leftIcon" />
						<Label text="middleText" />
						<Label text="rightIcon" />
					</FlexboxLayout>
				 </ActionBar.titleView>
			</ActionBar>
    </Page.actionBar>

The 3 labels are shown side by side which is not what justifyContent=“space-between” means.

more info:

  1. development machine: Windows 10 64bit
  2. target platform: android
  3. cli version: 3.2.1
  4. Cross-platform modules: 3.2.0
  5. Runtime: 3.2.0
  6. Plugin: no plugin used.

Thank you.

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
tsonevncommented, Oct 10, 2017

Hi @bigradish, To be able to set the needed position of the label as you wish: one of the label to be left aligned second one on the right and third, in the middle, you could use a combination of WrapLayout and DockLayout. For example:

XML

<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
   <Page.actionBar>

			<ActionBar>  

				<WrapLayout>
					<DockLayout class="layoutclass" height="70" style.backgroundColor="lightgray" stretchLastChild="true">
						<Label padding="20" text="leftl" dock="left" backgroundColor="red"/>
						<Label padding="20" text="right" dock="right" backgroundColor="blue"/>
						<Label  marginLeft="20" marginRight="20" text="center" dock="bottom" backgroundColor="yellow"/>
					</DockLayout>
				</WrapLayout>
			</ActionBar>
    </Page.actionBar>
    <StackLayout class="p-20">
        <Label text="Tap the button" class="h1 text-center"/>
        <Button text="TAP" tap="{{ onTap }}" class="btn btn-primary btn-active"/>
        <Label text="{{ message }}" class="h2 text-center" textWrap="true"/>
    </StackLayout>
</Page>

CSS

DockLayout{
    width:100%;
}
0reactions
vallemarcommented, May 10, 2020

This still doesn’t work, do you know anything about this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

FlexBoxLayout align-self:flex-end not working in nativescript-vue
I don't understand this, in web flexbox it works for me, and since I set flex direction to row all my child items...
Read more >
FlexboxLayout does not work properly in ActionBar
FlexboxLayout does not work properly in ActionBar · 1. development machine: Windows 10 64bit · 2. target platform: android · 3. cli version:...
Read more >
Build flexible layouts with FlexboxLayout
At Google I/O last year we announced ConstraintLayout, which enables you to build complex layouts while maintaining a flat view hierarchy. It is...
Read more >
FlexboxLayout - NativeScript-Vue
This property has no effect when the flex container has only one line. Valid values: flex-start (lines are packed to the start of...
Read more >
FlexboxLayout – Part 1 - Styling Android
In May 2016 a new project was pushed to the official Google Github repo named flexbox-layout. It is an Android layout manager which...
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