Inflaters

Overview

In mobile development, creating responsive and dynamic user interfaces is a fundamental challenge. Developers typically rely on various layout patterns to organize and present content effectively. However, as applications grow in complexity, there's a growing need for UIs that can adapt in real time without requiring app updates.

Key challenges include:

  • Dynamically reordering components

  • Adding new components on the fly

  • Changing layout or placement without releasing a new version

The Flash framework addresses these needs by leveraging JSON-based layout configurations sent from the server.

To support these dynamic capabilities and maintain a robust UI system, we introduce Inflaters. Inflaters are responsible for understanding and rendering the JSON-based layout data received from the server. They are core components in the Flash system that enable powerful layout-driven configurations, such as reordering components or adding new ones dynamically.

This document explores Inflaters in more detail.


Available Layouts in Mobile App Development

Common layout types in mobile apps include:

  • Tab layouts

  • Stack layouts

  • List layouts

  • Scroll layouts

These help structure content and enhance user experience. However, adapting these layouts dynamically based on server data is where the real challenge lies.


Dynamic Layout Creation with Inflaters

Inflaters are responsible for interpreting the layout structure defined in server responses and rendering components accordingly. This allows UIs to be updated or changed remotely—without the need for app redeployment.

Flash provides several generic inflaters:

  • TabLayoutInflater: Renders child components as tabs

  • StackLayoutInflater: Renders components in a vertical stack

  • ListInflater: Renders components in a scrollable list (vertical, horizontal, or nested)

  • ScrollInflater: Renders components inside a scrollable container

These inflaters enable the Flash Client SDK to support flexible, layout-driven UIs across a variety of use cases.


Usage of Inflaters in a Component

As explained in the Flash Components section, every Flash-compatible component manages its own configuration. Inflaters play a key role when it comes to enabling dynamic layout capabilities, such as reordering elements or adding new ones.

Components that require any of these layout capabilities should use inflaters to interpret and apply the layout configuration provided by the server. The specific inflater used depends on the desired layout behavior.

To demonstrate this, we walk through an example of enhancing SportsListComponent using ListInflater, enabling it to support reordering and component insertion.

Example: Regular FlatList Component

Example: SportsListComponent Flash-Compatible with ListInflater

Example Implementation of ListInflater

To illustrate how inflaters work, let's look at an example of a ListInflater.

Type Definitions


Input Props and Data Binding Transformation

components

Inflaters receive a list of components from the server as part of the layout configuration. These components define the structure and content that should be rendered dynamically.

Data Prop

Data from existing APIs is transformed to match the format expected by inflaters. This transformation ensures that inflaters can properly associate data with each component and render them accordingly.

Style Prop

The style prop applies styling to the parent container of the inflater. This enables layout-level styling while maintaining flexibility for child components.

Overrides Prop

The overrides prop allows components to override specific layout or style properties of nested children. This adds a layer of customization on top of the default configuration.


Nested Scrollable Items

Inflaters also support nested scrollable elements. If a child item needs to scroll (horizontally or vertically), its layout should include the appropriate configuration from the server. This enables complex nested structures—like scrollable carousels inside a vertical list.


Inflater Implementations

Below is a summary of the current inflater types supported by the Flash framework:

  • ListInflater: Uses FlatList to dynamically render lists of child components.

  • ScrollInflater: Uses ScrollView to enable vertical or horizontal scrolling of child components.

  • TabInflater: Organizes child components into swipeable or clickable tabs.

  • StackInflater: Renders components in a vertically stacked format.

These inflaters provide the flexibility required to design dynamic, data-driven layouts with minimal hardcoding.

Last updated