UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

113 lines (99 loc) 2.3 kB
const { fieldsGroup } = require("../utils"); const { generateFieldsFromDefaults, toSnakeCase } = require("../_internals"); const { progressBarFields } = require("../keys"); const DEFAULT_POSITION = "on_top_of_image"; const BOTTOM_OF_CELL_POSITION = "bottom_of_cell"; function mobileProgressBar({ enable, hideUnwatched, totalBarColor, totalBarCornerRadius, progressBarColor, progressBarCornerRadius, height, marginTop, marginRight, marginBottom, marginLeft, position, }) { const label = "progress_bar"; const fields = generateFieldsFromDefaults( label, { enable, hideUnwatched, totalBarColor, totalBarCornerRadius, progressBarColor, progressBarCornerRadius, height, marginTop, marginRight, marginBottom, marginLeft, position: toSnakeCase(position.default), }, progressBarFields({ defaultPosition: DEFAULT_POSITION, useBottomOfCell: position.useBottomOfCell, bottomOfCellPosition: BOTTOM_OF_CELL_POSITION, textLabels: position.textLabels || [], }) ); const folded = false; return fieldsGroup("Progress Bar", "", fields, folded); } function tvProgressBar({ enable, hideUnwatched, totalBarColor, totalBarCornerRadius, progressBarColor, progressBarCornerRadius, height, marginTop, marginRight, marginBottom, marginLeft, position, }) { const label = "progress_bar"; const fields = generateFieldsFromDefaults( label, { enable, hideUnwatched, totalBarColor, totalBarCornerRadius, progressBarColor, progressBarCornerRadius, height, marginTop, marginRight, marginBottom, marginLeft, position: toSnakeCase(position.default), }, progressBarFields({ defaultPosition: DEFAULT_POSITION, useBottomOfCell: position.useBottomOfCell, bottomOfCellPosition: BOTTOM_OF_CELL_POSITION, textLabels: position.textLabels || [], }) ); const folded = false; return fieldsGroup( "Progress Bar", "", // [...fields, ...timeRemainingLabelFonts, ...watchedLabelFonts], fields, folded ); } module.exports = { mobileProgressBar, tvProgressBar, DEFAULT_POSITION, BOTTOM_OF_CELL_POSITION, };