Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions demo/backend/_includes/macros/tabbar-top/index.xml.njk
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{% macro tabbar_top(tabs) %}
<select-single id="tab-bar" name="tab-bar" style="tabbar-top-select">
<view style="tabbar-top-container">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching from select-single to view is the likely cause of the UI jankiness seen in your captured video when switching over to a tab that wasn't already loaded. Can the navigation actions be performed on the select behavior?

{% for tab in tabs -%}
<option
value="{{ tab.id }}"
style="tabbar-top-item"
{% if tab.selected %}
selected="true"
{% endif %}
<view
href-style="tabbar-top-item{% if tab.selected %} tabbar-top-item-selected{% endif %}"
action="navigate"
href="#{{ tab.id }}"
>
<behavior trigger="deselect" action="hide" target="{{ tab.id }}" />
<behavior trigger="select" action="show" target="{{ tab.id }}" />
<text style="tabbar-top-label">{{ tab.label }}</text>
</option>
</view>
{%- endfor %}
</select-single>
</view>
{% endmacro %}
17 changes: 10 additions & 7 deletions demo/backend/_includes/macros/tabbar-top/styles.xml.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<style
id="tabbar-top-select"
id="tabbar-top-container"
backgroundColor="#eee"
borderRadius="12"
flexDirection="row"
Expand All @@ -17,19 +17,22 @@
flex="1"
padding="8"
justifyContent="center"
>
<modifier selected="true">
<style
/>
<style
id="tabbar-top-item-selected"
backgroundColor="white"
elevation="2"
shadowColor="black"
shadowOffsetX="0"
shadowOffsetY="2"
shadowOpacity="0.1"
shadowRadius="2"
/>
</modifier>
</style>
/>
<style
id="tabbar-top-item-link"
alignItems="stretch"
flex="1"
/>
<style
id="tabbar-top-label"
fontSize="16"
Expand Down
17 changes: 17 additions & 0 deletions demo/backend/advanced/case-studies.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
permalink: "/advanced/case-studies.xml"
hv_title: "Advanced"
hv_tab_id: "advanced"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "case-studies-route", label: "Case Studies", selected: true},
{id: "community-route", label: "Community"}
]) }}
{% include './case-studies/content.xml.njk' %}
{% endblock %}
17 changes: 17 additions & 0 deletions demo/backend/advanced/community.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
permalink: "/advanced/community.xml"
hv_title: "Advanced"
hv_tab_id: "advanced"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "case-studies-route", label: "Case Studies"},
{id: "community-route", label: "Community", selected: true}
]) }}
{% include './community/content.xml.njk' %}
{% endblock %}
18 changes: 18 additions & 0 deletions demo/backend/advanced/community/elements/top-tabbar/index.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
permalink: "/advanced/community/elements/top-tabbar/index.xml"
tags: "Advanced/Community/Elements"
hv_title: "Top Tab Bar"
hv_button_behavior: "back"
---
{# Example tab navigator inside a stack navigator #}
<doc xmlns="https://hyperview.org/hyperview">
<navigator id="custom-stack" type="stack">
<nav-route id="custom-top-tabs-route">
<navigator id="custom-top-tabs-navigator" type="tab">
<nav-route id="custom-top-tabs-tab-1" href="/hyperview/public/advanced/community/elements/top-tabbar/tab-1.xml"/>
<nav-route id="custom-top-tabs-tab-2" href="/hyperview/public/advanced/community/elements/top-tabbar/tab-2.xml" selected="true"/>
<nav-route id="custom-top-tabs-tab-3" href="/hyperview/public/advanced/community/elements/top-tabbar/tab-3.xml"/>
</navigator>
</nav-route>
</navigator>
</doc>
19 changes: 19 additions & 0 deletions demo/backend/advanced/community/elements/top-tabbar/tab-1.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
permalink: "/advanced/community/elements/top-tabbar/tab-1.xml"
hv_title: "Tab Navigator - Tab 1"
hv_button_behavior: "back"
---
{% from 'macros/description/index.xml.njk' import description %}
{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}
{% extends 'templates/base.xml.njk' %}

{% block container %}
{{ tabbar_top([
{id: "custom-top-tabs-tab-1", label: "Tab 1", selected: true},
{id: "custom-top-tabs-tab-2", label: "Tab 2"},
{id: "custom-top-tabs-tab-3", label: "Tab 3"}
]) }}
<view scroll="true">
{{ description('This is the content for tab 1.') }}
</view>
{% endblock %}
19 changes: 19 additions & 0 deletions demo/backend/advanced/community/elements/top-tabbar/tab-2.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
permalink: "/advanced/community/elements/top-tabbar/tab-2.xml"
hv_title: "Tab Navigator - Tab 2"
hv_button_behavior: "back"
---
{% from 'macros/description/index.xml.njk' import description %}
{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}
{% extends 'templates/base.xml.njk' %}

{% block container %}
{{ tabbar_top([
{id: "custom-top-tabs-tab-1", label: "Tab 1"},
{id: "custom-top-tabs-tab-2", label: "Tab 2", selected: true},
{id: "custom-top-tabs-tab-3", label: "Tab 3"}
]) }}
<view scroll="true">
{{ description('This is the content for tab 2.') }}
</view>
{% endblock %}
19 changes: 19 additions & 0 deletions demo/backend/advanced/community/elements/top-tabbar/tab-3.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
permalink: "/advanced/community/elements/top-tabbar/tab-3.xml"
hv_title: "Tab Navigator - Tab 3"
hv_button_behavior: "back"
---
{% from 'macros/description/index.xml.njk' import description %}
{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}
{% extends 'templates/base.xml.njk' %}

{% block container %}
{{ tabbar_top([
{id: "custom-top-tabs-tab-1", label: "Tab 1"},
{id: "custom-top-tabs-tab-2", label: "Tab 2"},
{id: "custom-top-tabs-tab-3", label: "Tab 3", selected: true}
]) }}
<view scroll="true">
{{ description('This is the content for tab 3.') }}
</view>
{% endblock %}
30 changes: 14 additions & 16 deletions demo/backend/advanced/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
permalink: "/advanced/index.xml"
hv_title: "Advanced"
hv_tab_id: "advanced"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}
{% extends 'templates/root.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}
{% from 'macros/tabbar-top-tab/index.xml.njk' import tabbar_top_tab %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "tab-case-studies", label: "Case Studies", selected: true},
{id: "tab-community", label: "Community"}
]) }}
{% call tabbar_top_tab("tab-case-studies", true) -%}
{% include './case-studies/content.xml.njk' %}
{%- endcall -%}
{% call tabbar_top_tab("tab-community") -%}
{% include './community/content.xml.njk' %}
{%- endcall -%}
{% block root %}
<doc xmlns="https://hyperview.org/hyperview">
<navigator id="advanced-nested-tabs" type="tab">
<nav-route
id="case-studies-route"
href="/hyperview/public/advanced/case-studies.xml"
/>
<nav-route
id="community-route"
href="/hyperview/public/advanced/community.xml"
/>
</navigator>
</doc>
{% endblock %}
17 changes: 17 additions & 0 deletions demo/backend/behaviors/advanced.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
permalink: "/behaviors/advanced.xml"
hv_title: "Behaviors"
hv_tab_id: "behaviors"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "basic-route", label: "Basic"},
{id: "advanced-behaviors-route", label: "Advanced", selected: true}
]) }}
{% include './advanced/content.xml.njk' %}
{% endblock %}
17 changes: 17 additions & 0 deletions demo/backend/behaviors/basic.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
permalink: "/behaviors/basic.xml"
hv_title: "Behaviors"
hv_tab_id: "behaviors"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "basic-route", label: "Basic", selected: true},
{id: "advanced-behaviors-route", label: "Advanced"}
]) }}
{% include './basic/content.xml.njk' %}
{% endblock %}
17 changes: 0 additions & 17 deletions demo/backend/behaviors/content.xml.njk

This file was deleted.

18 changes: 16 additions & 2 deletions demo/backend/behaviors/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
permalink: "/behaviors/index.xml"
hv_title: "Behaviors"
hv_tab_id: "behaviors"
hv_button_behavior: "none"
---
{% include './content.xml.njk' %}
{% extends 'templates/root.xml.njk' %}

{% block root %}
<doc xmlns="https://hyperview.org/hyperview">
<navigator id="behaviors-nested-tabs" type="tab">
<nav-route
id="basic-route"
href="/hyperview/public/behaviors/basic.xml"
/>
<nav-route
id="advanced-behaviors-route"
href="/hyperview/public/behaviors/advanced.xml"
/>
</navigator>
</doc>
{% endblock %}
17 changes: 17 additions & 0 deletions demo/backend/navigation/behaviors.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
permalink: "/navigation/behaviors.xml"
hv_title: "Navigation"
hv_tab_id: "navigation"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "navigation-behaviors-route", label: "Behaviors", selected: true},
{id: "navigator-route", label: "Navigator"}
]) }}
{% include './behaviors/content.xml.njk' %}
{% endblock %}
30 changes: 14 additions & 16 deletions demo/backend/navigation/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
permalink: "/navigation/index.xml"
hv_title: "Navigation"
hv_tab_id: "navigation"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}
{% extends 'templates/root.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}
{% from 'macros/tabbar-top-tab/index.xml.njk' import tabbar_top_tab %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "tab-behaviors", label: "Behaviors", selected: true},
{id: "tab-navigator", label: "Navigator"}
]) }}
{% call tabbar_top_tab("tab-behaviors", true) -%}
{% include './behaviors/content.xml.njk' %}
{%- endcall -%}
{% call tabbar_top_tab("tab-navigator") -%}
{% include './navigator/content.xml.njk' %}
{%- endcall -%}
{% block root %}
<doc xmlns="https://hyperview.org/hyperview">
<navigator id="navigation-nested-tabs" type="tab">
<nav-route
id="navigation-behaviors-route"
href="/hyperview/public/navigation/behaviors.xml"
/>
<nav-route
id="navigator-route"
href="/hyperview/public/navigation/navigator.xml"
/>
</navigator>
</doc>
{% endblock %}
17 changes: 17 additions & 0 deletions demo/backend/navigation/navigator.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
permalink: "/navigation/navigator.xml"
hv_title: "Navigation"
hv_tab_id: "navigation"
hv_button_behavior: "none"
---
{% extends 'templates/tab-route.xml.njk' %}

{% from 'macros/tabbar-top/index.xml.njk' import tabbar_top %}

{% block tab_route_content %}
{{ tabbar_top([
{id: "navigation-behaviors-route", label: "Behaviors"},
{id: "navigator-route", label: "Navigator", selected: true}
]) }}
{% include './navigator/content.xml.njk' %}
{% endblock %}
Loading