From b9be9b4322a3893b93ee5cd4f7aa3f44ed56acb7 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Tue, 3 Feb 2026 22:46:21 +0100 Subject: [PATCH 1/4] fix: children as props --- data/components.json | 20 ++ example/app/testing-grounds/progress.tsx | 6 + .../live-activities/BasicLiveActivityUI.tsx | 57 ++--- .../testing-grounds/TestingGroundsScreen.tsx | 7 + .../components/ComponentsScreen.tsx | 19 +- .../progress/ProgressTestingScreen.tsx | 218 ++++++++++++++++++ generator/generators/kotlin-parameters.ts | 4 +- generator/generators/swift-parameters.ts | 4 +- .../Parameters/GaugeParameters.swift | 15 -- .../Parameters/GroupBoxParameters.swift | 5 +- .../LinearProgressViewParameters.swift | 5 - .../Generated/Parameters/MaskParameters.swift | 5 +- package.json | 6 +- src/jsx/props/CircularProgressView.ts | 6 + src/jsx/props/LinearProgressView.ts | 4 + 15 files changed, 301 insertions(+), 80 deletions(-) create mode 100644 example/app/testing-grounds/progress.tsx create mode 100644 example/screens/testing-grounds/progress/ProgressTestingScreen.tsx diff --git a/data/components.json b/data/components.json index 328a014..9e8e858 100644 --- a/data/components.json +++ b/data/components.json @@ -539,6 +539,16 @@ "type": "component", "optional": true, "description": "Custom thumb component to display at progress position" + }, + "label": { + "type": "component", + "optional": true, + "description": "Label content for the progress indicator" + }, + "currentValueLabel": { + "type": "component", + "optional": true, + "description": "Custom text for current value label" } } }, @@ -587,6 +597,16 @@ "type": "number", "optional": true, "description": "Width of the stroke line" + }, + "label": { + "type": "component", + "optional": true, + "description": "Label content for the progress indicator" + }, + "currentValueLabel": { + "type": "component", + "optional": true, + "description": "Custom text for current value label" } } }, diff --git a/example/app/testing-grounds/progress.tsx b/example/app/testing-grounds/progress.tsx new file mode 100644 index 0000000..9baee4d --- /dev/null +++ b/example/app/testing-grounds/progress.tsx @@ -0,0 +1,6 @@ +import React from 'react' +import ProgressTestingScreen from '~/screens/testing-grounds/progress/ProgressTestingScreen' + +export default function ProgressPage() { + return +} diff --git a/example/components/live-activities/BasicLiveActivityUI.tsx b/example/components/live-activities/BasicLiveActivityUI.tsx index 097ec09..d264848 100644 --- a/example/components/live-activities/BasicLiveActivityUI.tsx +++ b/example/components/live-activities/BasicLiveActivityUI.tsx @@ -4,50 +4,19 @@ import { Voltra } from 'voltra' export function BasicLiveActivityUI() { return ( - - - - - - NEW - - - - - Hello, Voltra! - - - Welcome to your first Live Activity. - - + Downloading...} + // currentValueLabel={75%} + /> + 50/100} + /> ) } diff --git a/example/screens/testing-grounds/TestingGroundsScreen.tsx b/example/screens/testing-grounds/TestingGroundsScreen.tsx index 95faf98..c546097 100644 --- a/example/screens/testing-grounds/TestingGroundsScreen.tsx +++ b/example/screens/testing-grounds/TestingGroundsScreen.tsx @@ -34,6 +34,13 @@ const TESTING_GROUNDS_SECTIONS = [ 'Learn about static, relative, and absolute positioning modes. See how left, top, and zIndex properties work with visual examples.', route: '/testing-grounds/positioning', }, + { + id: 'progress', + title: 'Progress Indicators', + description: + 'Explore linear and circular progress indicators. Test determinate, indeterminate, and timer-based modes with custom labels and styling.', + route: '/testing-grounds/progress', + }, { id: 'components', title: 'Components', diff --git a/example/screens/testing-grounds/components/ComponentsScreen.tsx b/example/screens/testing-grounds/components/ComponentsScreen.tsx index 40b3861..6eb06fd 100644 --- a/example/screens/testing-grounds/components/ComponentsScreen.tsx +++ b/example/screens/testing-grounds/components/ComponentsScreen.tsx @@ -150,10 +150,21 @@ const COMPONENTS_DATA = [ title: 'Progress Components', description: 'Linear and circular progress indicators for showing completion states.', renderExample: () => ( - - - - + + + Downloading...} + currentValueLabel={75%} + /> + Uptime} + currentValueLabel={45%} + style={{ width: 60, height: 60 }} + /> ), diff --git a/example/screens/testing-grounds/progress/ProgressTestingScreen.tsx b/example/screens/testing-grounds/progress/ProgressTestingScreen.tsx new file mode 100644 index 0000000..ded935e --- /dev/null +++ b/example/screens/testing-grounds/progress/ProgressTestingScreen.tsx @@ -0,0 +1,218 @@ +import { useRouter } from 'expo-router' +import React, { useState } from 'react' +import { ScrollView, StyleSheet, Text, useColorScheme, View } from 'react-native' +import { Voltra } from 'voltra' +import { VoltraWidgetPreview } from 'voltra/client' + +import { Button } from '~/components/Button' +import { Card } from '~/components/Card' + +export default function ProgressTestingScreen() { + const router = useRouter() + const colorScheme = useColorScheme() + + // State for simple controls + const [progressValue, setProgressValue] = useState(65) + const [timerEndAt] = useState(Date.now() + 600000) // 10 minutes from now + + const widgetPreviewStyle = { + borderRadius: 16, + backgroundColor: colorScheme === 'light' ? 'rgba(0, 0, 0, 0.4)' : 'rgba(255, 255, 255, 0.8)', + } + + return ( + + + Progress Testing + + Test VoltraLinearProgressView and VoltraCircularProgressView with new label and currentValueLabel support. + + + {/* 1. Linear Progress Showcase */} + + Linear Progress Variants + + + + {/* Standard determinate */} + Standard Linear} + currentValueLabel={{progressValue}%} + /> + + {/* Custom styled determinate */} + Custom Styled} + currentValueLabel={ + + + {progressValue} of 100 + + } + /> + + {/* Timer-based linear */} + Timer Linear} + currentValueLabel={} + /> + + + + + + {/* 2. Circular Progress Showcase */} + + Circular Progress Variants + + + + Uptime} + currentValueLabel={ + + {progressValue}% + + } + style={{ width: 80, height: 80 }} + /> + + + + + + + + } + currentValueLabel={} + style={{ width: 60, height: 60 }} + /> + + + + + + {/* 3. Real-world Examples */} + + Complex Combinations + + + + + + + + Downloading Assets... + + } + currentValueLabel={ + + + {(progressValue * 1.2).toFixed(1)} MB of 120 MB + + + + {progressValue}% + + + } + /> + + + + + + + } + style={{ width: 60, height: 60 }} + /> + + Goal Reached! + You completed your daily rings. + + + + + + + + {/* Controls */} + + Interactive Controls + + Progress: {progressValue}% + +