Mobile
Components

Core Components

smarty.SmartResourceList

Render items listing with dynamic options.

Example in layout.json

{
  "component": "smarty.SmartResourceList",
  "props": {
    "key": "smarty.SmartResourceList",
    "hasFilter": true,
    "module_name": "blog",
    "resource_name": "blog",
    "actionName": "viewAll",
    "extraItemProps": {
      "alignment": "right"
    },
    "skeletonComponent": {
      "component": "skeleton.blog.blog"
    },
    "emptyComponent": {
      "component": "ui.EmptyList",
      "props": {
        "label": "no_blogs_found",
        "action": {
          "label": "add_new_item",
          "sub_label": "start_adding_new_items_by_create_new_stuffs",
          "value": "addItem",
          "params": {
            "module_name": "blog",
            "resource_name": "blog"
          },
          "showWhen": ["and", ["truthy", "acl.blog.blog.create"]]
        }
      }
    }
  }
}

Properties

NameTypeDefaultDescription
module_namestringName of the module.
resource_namestringName of the resource.
actionNamestringThe name of the action when calling the API backend. This requires module_name and resource_name.
startReloadbooleanfalseWhether to reload the list items initially.
dataSourceobjectThe data source object.
deprecatedDataSourceobjectThe deprecated data source object.
dataSourceApiVersionstringThe API version of the data source.
limitnumberThe limit on the number of items in the list.
canLoadMorebooleantrueWhether more items can be loaded into the list.
useAnimationbooleanfalseWhether to use GestureHandlerFlatList from react-native-gesture-handler (opens in a new tab).
useNavigationScrollHeaderbooleanfalseWhether to use FlatList from react-native-reanimated (opens in a new tab).
useBottomSheetFlatListbooleanfalseWhether to use BottomSheetFlatList from @gorhom/bottom-sheet (opens in a new tab).
skeletonComponentobjectThe component to display while loading data from the API.

smarty.SmartTabs

Render tab view.

Example in layout.json

{
  "component": "smarty.SmartTabs",
  "props": {
    "key": "smarty.SmartTabs",
    "tabsRefreshEnabled": true,
    "headerComponent": {
      "component": "ui.UserHeaderInfoBlock",
      "props": {
        "key": "ui.UserHeaderInfoBlock",
        "module_name": "user",
        "resource_name": "user",
        "actionName": "viewItem"
      }
    },
    "tabs": [
      {
        "component": "smarty.SmartResourceList",
        "props": {
          "title": "blog",
          "module_name": "blog",
          "resource_name": "blog",
          "actionName": "viewAll",
          "skeletonComponent": {
            "component": "skeleton.blog.blog"
          },
          "emptyComponent": {
            "component": "ui.EmptyList",
            "props": {
              "label": "no_blogs_found"
            }
          }
        }
      }
    ],
    "showOneTab": false,
    "tabBarStyle": {
      "width": "auto"
    }
  }
}

Properties

NameTypeDefaultDescription
tabsRefreshEnabledbooleanfalseAllow to refresh each tab separately.
tabBarStyleviewStyleStyle for the tab bar container.
tabContainerStyleviewStyleStyle for the tab container .
tabsArray<SomeComponent>The array of tab components. Must be a child of SmartTabs component.
isFullbooleanThe object that contains API data source for the component. Must be a child of SmartTabs component.
showOneTabbooleantrueShow only one tab at a time. If set to false, all tabs will be shown.
scrollEnabledbooleantrueEnable or disable scroll for the tab bar. If set to false, the tab bar will not be scrollable.
headerComponentReactComponentComponent for the header of the tab bar. Must be a child of SmartTabs component.
tabBarComponentReactComponentui.SmartTabsTabBarComponent for the tab bar. Must be a child of SmartTabs component.

smarty.SmartListBlock

This block represents a list of items related to the current module. It is used to display a list of items with various properties and actions.

Example in layout.json

{
  "component": "smarty.SmartListBlock",
  "props": {
    "key": "smarty.SmartListBlock",
    "horizontal": true,
    "title": "similar_blogs",
    "itemView": "item.blog.blog.Similar",
    "moduleName": "blog",
    "resourceName": "blog",
    "actionName": "viewSimilar",
    "limit": 10,
    "customAction": {
      "key": "viewAll",
      "icon": "angle-right",
      "router": "viewItemListing",
      "headerTitleForActionScreen": "similar_blogs"
    }
  }
}

Properties

NameTypeDefaultDescription
moduleNamestringName of the module.(required)
resourceNamestringName of the resource.(required)
actionNamestringThe name of the action when calling the API backend.(required)
itemViewstringName of the component that will be used to render each item in the list. Must be a component that is registered in the ui module.(required)
limitnumberThe limit on the number of items in the list.
horizontalbooleanWhether to show the list in a horizontal or vertical orientation.
customActionobjectThe custom action object that will be used to render the custom action button.
canLoadMorebooleanfalseWhether more items can be loaded into the list.

smarty.SmartScrollIntab

This component will render a scrollable content in a tab. It is used to display a scrollable content when use SmartTabs.

Example in layout.json

{
  "component": "smarty.SmartScrollIntab",
  "props": {
    "key": "smarty.SmartScrollIntab",
    "components": [
      {
        "component": "ui.ProfileInformationBlock",
        "props": {
          "key": "ui.ProfileInformationBlock",
          "title": "information"
        }
      }
    ]
  }
}

Properties

NameTypeDefaultDescription
tabsArray<SomeComponent>The array of tab components. Must be a child of SmartScrollIntab component.

ui.ModuleHeader

Header for home listing.

Example in layout.json

{
  "component": "ui.ModuleHeader",
  "props": {
    "key": "ui.ModuleHeader",
    "title": "all_blogs",
    "rightButtons": [
      {
        "component": "ui.HeaderRightButton",
        "props": {
          "key": "searchItem",
          "icon": "search-o",
          "value": "searchItem",
          "params": {
            "module_name": "blog",
            "resource_name": "blog"
          }
        }
      }
    ]
  }
}

Properties

NameTypeDefaultDescription
titlestringTitle of header. This is the text that will be displayed in the header.
isTitleOnlybooleanfalseIf set to true, only the title will be displayed in the header.
rightButtons<ReactComponent>Display view right header. This can be an array of components or a single component. Example: { "component": "ui.HeaderRightButton", "props": { ... } }

ui.HeaderItemDetail

Header for detail item.

Example in layout.json

{
  "component": "ui.HeaderItemDetail",
  "props": {
    "key": "ui.HeaderItemDetail",
    "title": "blog",
    "menuName": "detailActionMenu"
  }
}

Properties

NameTypeDefaultDescription
titlestringTitle of header. This is the text that will be displayed in the header.
isTitleOnlybooleanfalseIf set to true, only the title will be displayed in the header.
menuNamestringdetailActionMenuName of the menu to be used for actions related to the detail view.
backbooleantrueIf set to true, a back button will be displayed on the left side of the header.
rightButtons<ReactComponent>Display view right header. This can be an array of components or a single component. Example: { "component": "ui.HeaderRightButton", "props": { ... } }

ui.SimpleHeader

Example in layout.json

{
  "component": "ui.SimpleHeader",
  "props": {
    "key": "ui.SimpleHeader",
    "title": "blog"
  }
}

Properties

NameTypeDefaultDescription
titlestringTitle of header. This is the text that will be displayed in the header.
rightButtons<ReactComponent>Display view right header. This can be an array of components or a single component. Example: { "component": "ui.HeaderRightButton", "props": { ... } }

ui.ItemTitle

Title field of an item.

Example

const [ItemTitle] = jsxBackend.all(['ui.ItemTitle']);
 
<ItemTitle title={item.title} item={item} />;

Properties

NameTypeDefaultDescription
titlestringtitle of the item.(required)
fontWeightstringboldName of the resource.
presetstringh1The name of the action when calling the API backend.
styleTextStyleOptional styles to be applied to the Text component.
itemobjectThe data object representing the item. This object should contain all the necessary properties and methods related to the item.

ui.ItemPricing

Pricing field of an item.

Example

const [ItemPricing] = jsxBackend.all(['ui.ItemPricing']);
 
<ItemPricing item={item} />;

Properties

NameTypeDefaultDescription
itemobjectThis object should contain a required property called price. It represents the data object related to the item.

ui.ItemPendingStatus

Field that shows the status of the item, which can be 'approved' or 'decline'. When item has extra.can_approve, it will show two button to approve and decline the item.

Example

const [ItemPendingStatus] = jsxBackend.all(['ui.ItemPendingStatus']);
 
<ItemPendingStatus item={item} />;

Properties

NameTypeDefaultDescription
itemobjectThis object should contain a required property called is_pending. It represents the data object related to the item.

ui.ItemHtmlContent

Field that shows the content of the item in HTML format.

Example

const [ItemHtmlContent] = jsxBackend.all(['ui.ItemHtmlContent']);
 
<ItemHtmlContent text={item.text} containerWidth={100} noBorder={true} />;

Properties

NameTypeDefaultDescription
textstringThe html content of the item.(required)
noBorderbooleantrueIf set to true, the component will not have a border.
containerWidthnumber0The width of the container that will be used to render the component.

ui.ItemExternalLink

Field that shows the status of the item, which can be 'approved' or 'decline'. When item has extra.can_approve, it will show two button to approve and decline the item.

Example

const [ItemExternalLink] = jsxBackend.all(['ui.ItemExternalLink']);
 
<ItemExternalLink item={item} />;

Properties

NameTypeDefaultDescription
fontSizenumbersmallThe font size of the external link. Can be a number (e.g. 14) or a string (e.g. 'small').
styleViewStyleOptional containerStyle to be applied to component that displays the external link.
itemobjectThis object should contain a required property called external_link. It represents the data object related to the item.

ui.ItemAuthor

Field that shows the author of the item.

Example

const [ItemAuthor] = jsxBackend.all(['ui.ItemAuthor']);
 
<ItemAuthor
  user={item.user}
  date={item.creation_date}
  owner={owner}
  numberOfLines={2}
  privacy={item?.privacy}
/>;

Properties

NameTypeDefaultDescription
userobjectThe user object associated with the item.
datestringThe creation date of the item.
ownerobjectThe owner of the item.
numberOfLinesnumberNumber of lines to display.
privacyobjectPrivacy settings of the item, determining visibility and access permissions.

ui.ItemCategories

Field that shows the categories of the item.

Example

const [ItemCategories] = jsxBackend.all(['ui.ItemCategories']);
 
<ItemCategories
  categories={categories}
  separator={separator}
  showLabel={showLabel}
  numberOfLines={numberOfLines}
  textTransform={textTransform}
  styles={styles}
  label={label}
  isActive={isActive}
  onPress={onPress}
/>;

Properties

NameTypeDefaultDescription
categoriesobjectThe categories object associated with the item.
separatorstring,The separator to use between each category.
showLabelbooleantrueWhether to show the category label.
stylesobjectOptional styles to be applied to the category container.
labelstringcategories_colonOptional label to be used for the category.
isActivebooleanfalseWhether the category is active.
onPressfunctionFunction to be called when a category is pressed.
numberOfLinesnumber0Number of lines to display.

ui.ItemTags

Field that shows the tags of the item.

Example

const [ItemTags] = jsxBackend.all(['ui.ItemTags']);
 
<ItemTags
  label={'topics_colon'}
  tags={item.tags}
  module_name={item.module_name}
  resource_name={item.resource_name}
  styles={styles}
/>;

Properties

NameTypeDefaultDescription
labelstringtopics_colonOptional label to be used for the tags.
tagsarrayThe tags object associated with the item.
module_namestringThe name of the module associated with the item.
resource_namestringThe name of the resource associated with the item.
stylesViewStyleOptional styles to be applied to the tags container.

ui.ItemExtraInfo

Field that shows the infor of the item.

Example

const [ItemExtraInfo] = jsxBackend.all(['ui.ItemExtraInfo']);
 
<ItemExtraInfo
  label={`${i18n.formatMessage({ id: 'year' })}: `}
  content={item.year}
/>;

Properties

NameTypeDefaultDescription
labelstringOptional label to be used for the extra info.
contentstringThe extra info content associated with the item.

ui.ItemFormatDate

Field that shows the date of the item.

Example

const [ItemFormatDate] = jsxBackend.all(['ui.ItemFormatDate']);
 
<ItemFormatDate
  value={'new Date()'}
  styles={styles}
  format="MMMM DD, yyyy"
  phrase="last_update_on_time"
/>;

Properties

NameTypeDefaultDescription
valuestringThe date value to be formatted.
formatstringllllThe date format to be used. See https://date-fns.org/docs/format (opens in a new tab).
phrasestringThe phrase to be used for the date.
stylesTextStyleThe text style to be applied to the formatted date.

ui.ItemReactionBar

Field that shows the reaction bar of the item.

Example

const [ItemReactionBar] = jsxBackend.all(['ui.ItemReactionBar']);
 
<ItemReactionBar item={item} />;

Properties

NameTypeDefaultDescription
itemobjectThe item object associated with the reaction bar. Must have one of the following properties:
extra.can_share or extra.can_like or extra.can_comment
columnContentStyleViewStyleThe style to be applied to the reaction bar container.

ui.ItemLocation

Field that shows the location of the item.

Example

const [ItemLocation] = jsxBackend.all(['ui.ItemLocation']);
 
<ItemLocation item={item} />;

Properties

NameTypeDefaultDescription
itemobjectThe item object associated with the location. Must have one of the following properties:
location.address - The location address.
containerStyleViewStyleThe style to be applied to the container of the location field.
fontSizestringsmallThe font size of the location text.
colorstringlightThe color of the location text.