feat: LVGL 8.4 upgrade, focus navigation, component API refactors, navigation/gateway demos, fix memory leak, and i18n#54
Open
sunnyswag wants to merge 62 commits intolvgl:masterfrom
Open
feat: LVGL 8.4 upgrade, focus navigation, component API refactors, navigation/gateway demos, fix memory leak, and i18n#54sunnyswag wants to merge 62 commits intolvgl:masterfrom
sunnyswag wants to merge 62 commits intolvgl:masterfrom
Conversation
…F and Image components
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…y point - Introduced option to build lvgljs as a static library. - Refactored engine initialization and execution into separate functions. - Updated CMakeLists.txt and Makefile to accommodate new build configurations. - Added main.cpp as the entry point for executable builds.
…esolution options
- Add GroupManager singleton to manage lv_group_t instances - Modify BasicComponent appendChild/removeChild to handle group membership - Add unregisterContainer call in BasicComponent destructor - Remove auto lv_group_add_obj from all component constructors (21 files) - Add setInGroup method to View component for JS binding - Add DefaultGroup constant in React layer - Add group prop support in View React component - Add onFocusedStyle support in CommonComponentApi - Add test case in test/group/1/index.jsx
- Introduced AddChildToDefGroup and AddCurToDefGroup symbols for group type management. - Updated View component to support groupType prop for specifying group behavior. - Modified GroupManager to handle new group types and improve child management. - Refactored BasicComponent methods to integrate with the new group system. - Updated documentation and examples to reflect changes in group handling.
…ality - Introduced a new navigation demo with five pages showcasing various UI components. - Implemented auto-focus behavior for buttons and interactive elements using the useAutoFocus hook. - Added components for lists, info display, controls, and a countdown timer. - Enhanced the BasicComponent class to support focus functionality for improved accessibility. - Updated styles and layout for a cohesive user experience across pages.
- Refactored component registration to use registerWithRef for improved ref handling. - Updated the View, Text, Image, Button, and other components to utilize the new registration method. - Simplified the ref assignment in the Page1List component for better readability and functionality.
- Upgraded React to version 16.14.0 and ensured consistent versioning for react-reconciler. - Refactored instance management in the reconciler to use Map for better performance and reliability. - Added cleanupInstance function to handle child component destruction and prevent memory leaks. - Introduced RootContainer class to manage child components with stable ordering semantics. - Improved text handling in the reconciler to support props for Text components.
- Added i18n functionality to the navigation demo, allowing for language switching between English and Chinese. - Integrated translation keys for all text elements across the demo pages. - Created separate JSON files for English and Chinese translations. - Introduced a LangSwitcher component for selecting the language. - Updated the App component to use I18nProvider for managing localization context.
- Refactored the messages handling in the I18nProvider to support dynamic loading of locale-specific messages. - Introduced caching for loaded messages to enhance performance and reduce redundant loading. - Updated the navigation demo to utilize the new message loading mechanism, ensuring proper fallback handling for translations. - Adjusted type definitions for better clarity and maintainability in the i18n module.
…ization - Updated React to version 18.3.1 and react-reconciler to version 0.29.2 for improved performance and features. - Refactored component finalization methods to ensure proper cleanup and memory management, including logging during component destruction. - Enhanced the cleanup process in the reconciler to prevent potential memory leaks by managing child instances more effectively. - Updated type definitions for better clarity and maintainability in the React integration.
…mponents - Eliminated the useAutoFocus hook to streamline focus handling. - Updated components to utilize autoFocus and addToFocusGroup props for improved focus management. - Refactored GroupManager to introduce addToFocusGroup and reorderFocusGroup methods for better focus group handling. - Removed deprecated groupType prop from View component and adjusted related logic in the reconciler. - Cleaned up unused imports and improved overall code clarity.
…ents - Eliminated the GroupManager class and its methods for managing focus groups. - Updated components to directly utilize lv_group_add_obj for focus management. - Removed related function definitions and imports from the View and component files. - Adjusted reconciler logic to remove obsolete focus group reordering functionality. - Enhanced focus handling by integrating autoFocus directly into component props.
… navigate directly
…, add LV_OBJ_FLAG_SCROLL_ON_FOCUS when invoke NativeCompAddToFocusGroup
This upgrade includes the fix for horizontal scroll-to-view bug: - fix(scroll): fix scroll to view to the left (commit 7c74f65) The bug caused focus_prev not working properly on horizontal scrollable containers (e.g., ViewPager with flex-row layout).
…roved focus management
- Set default scrollbar mode to off for the window instance to streamline UI experience.
…le components - Updated components including Arc, Button, Calendar, Canvas, Chart, Checkbox, Dropdownlist, GIF, Image, Input, Keyboard, Line, Mask, ProgressBar, Roller, Slider, Switch, Tabs, Text, Textarea, View, and Window to utilize setComponentProps for improved property management. - This change enhances consistency across components and simplifies the property setting logic.
This update reflects the latest changes in the lvgl dependency, ensuring compatibility and access to recent improvements.
…ency - Adjusted ProgressBar and Roller components to utilize reordered props for improved property management. - Modified MiscStyle type and its processing logic to reflect the new naming convention.
…t, and View components - Modified setProps in ButtonComp, TextComp, and ViewComp to accept UpdatePayload instead of newProps, enhancing property management. - Updated corresponding config files to align with the new setProps signature. - Introduced propDiffer utility to handle prop differences and streamline updates across components.
… components - Refactored setProps in various components including Arc, Calendar, Canvas, Chart, Checkbox, Dropdownlist, GIF, Image, Input, Keyboard, Line, Mask, ProgressBar, Roller, Slider, Switch, Tabs, Textarea, and Window to accept UpdatePayload instead of newProps. - Updated corresponding config files to align with the new setProps signature. - Enhanced property management and consistency across components by utilizing the propDiffer utility for handling prop differences.
- Updated language handling in index.tsx to correctly load JSON files based on locale. - Added new navigation icons for device info, device status, event log, and settings. - Modified Header component to accept a backIcon prop for improved navigation. - Adjusted styles for focused states and various components to ensure consistent UI experience. - Updated multiple pages to utilize new icons and enhance header functionality.
…ay demo - Updated index.tsx to load Japanese language JSON file based on locale. - Modified ListItem component to use translation function for titles. - Enhanced various pages to support localization and improved UI consistency. - Updated language settings to reflect direct language labels instead of translation keys.
…across multiple components - Removed "background-opacity" property from ListItem, CountdownSettingsPage, and DeviceInfoPage components for consistency. - Updated "arc-color" in CountdownSettingsPage to a darker shade for improved visibility. - Adjusted "background-color" in HomePage to a semi-transparent white for better UI aesthetics. - Enhanced color handling in color.ts to support 4-digit and 8-digit hex formats, including opacity extraction.
… styling across components - Updated ConfirmDialog, Header, ListItem, and various pages to use CreateStyle for defining styles. - Improved code consistency and readability by standardizing the style definition approach.
…ion strings - Implemented previous and next page navigation in LogDetailPage. - Added corresponding localization strings for English, Japanese, and Chinese. - Enhanced the user interface with new navigation items for improved usability.
…agination - Added focus group support to LogDetailPage for improved navigation. - Updated pagination logic to use constants for better readability. - Included focus group initialization in the render bootstrap process. - Refactored LogDetailPage to remove deprecated navigation components and streamline the UI.
…c in LogDetailPage
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
4 issues found across 176 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="doc/style/color.md">
<violation number="1" location="doc/style/color.md:29">
P3: The example uses duplicate "background-color" keys in one object literal, so the first value is overwritten and the standard color case is never demonstrated.</violation>
</file>
<file name=".gitignore">
<violation number="1" location=".gitignore:6">
P2: Narrowing the ignore rule to `build/*` no longer ignores `build_lib/` created by the Makefile, so build artifacts can be accidentally committed.</violation>
</file>
<file name="demo/gateway/components/ConfirmDialog.tsx">
<violation number="1" location="demo/gateway/components/ConfirmDialog.tsx:33">
P2: confirmText/cancelText props are defined but the button labels are hard-coded (✕/✓), so callers cannot customize button text (e.g., localization).</violation>
</file>
<file name="demo/navigation/index.tsx">
<violation number="1" location="demo/navigation/index.tsx:379">
P2: Pager uses scroll-snap-x for horizontal paging but is laid out with flex-direction: "column", which stacks pages vertically and prevents horizontal scroll snapping/scrollIntoView from working as intended.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR includes LVGL and React dependency upgrades, LVGL Group-based focus navigation, component API and styling refactors, new navigation and gateway demos with i18n, and build/config improvements.
Dependencies & core
LVGLJS_CONF_DIRand display resolution; add static library build and refactor main entry.Focus & navigation
lv_group_*usage).addToFocusGroupand focus handling on View; refineLV_OBJ_FLAG_SCROLL_ON_FOCUSusage.useAutoFocushook and GroupManager; useautoFocusandaddToFocusGroupprops.reorderFocusGroupand BasicComponent changes.Component API & styling
UpdatePayloadandpropDifferacross Button, Text, View, Arc, Calendar, Canvas, Chart, Checkbox, Dropdownlist, GIF, Image, Input, Keyboard, Line, Mask, ProgressBar, Roller, Slider, Switch, Tabs, Textarea, Window.CommonComponentApiwithsetComponentPropsfor consistent property handling.CreateStyleinstead ofRecord<string, any>for style types; renamestyle-transition-timetotransition-time.style.cpp.background-opacity; improve color handling (4/8-digit hex with opacity); countdown angle and CountdownSettingsPage styles.Demos
Fixes & misc
fetchBinaryinstead ofgetBinary.init_input_devicesfor indev init; update.gitignore.Summary by cubic
Upgrades LVGL to 8.4 and React to 18.3.1, adds LVGL group-based focus navigation, and ships new navigation/gateway demos with i18n. Also adds a static library build and device resolution config, plus component API and styling refactors.
New Features
Bug Fixes
Written for commit d34d458. Summary will update on new commits.