feat: support ReactNode in ScrollVelocity texts prop#907
Open
mohamed-younes16 wants to merge 1 commit intoDavidHDev:mainfrom
Open
feat: support ReactNode in ScrollVelocity texts prop#907mohamed-younes16 wants to merge 1 commit intoDavidHDev:mainfrom
mohamed-younes16 wants to merge 1 commit intoDavidHDev:mainfrom
Conversation
- Change texts: string[] to texts: React.ReactNode[] in TS variants - Move separator inside the span (encapsulated in scroller) - Replace numCopies! non-null assertion with numCopies ?? 6 - Update prop table description in demo to reflect ReactNode support - Applied consistently across all 4 variants (JS-CSS, JS-TW, TS-CSS, TS-TW) This is a non-breaking change — plain strings are valid ReactNode values, so all existing usage continues to work. The change unlocks rich content like icons, styled spans, gradients, and mixed JSX in the scrolling ticker.
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.
Problem
texts: string[]limits content to plain text only, preventing commonreal-world use cases like icons, styled spans, gradient text, and logos.
Before / After
// Before
texts={['React Bits', 'Scroll Down']}
// After — any ReactNode now works
React Bits</>,
texts={[
<>
Scroll Down,
'Plain strings still work too ✅'
]}
Changes
texts: string[]→texts: React.ReactNode[]in TS variants separator moved inside the span (encapsulated in scroller)numCopies!non-null assertion replaced withnumCopies ?? 6Final Notes
Non-breaking — plain strings are valid
ReactNode, so all existing usage continues to work unchanged.Tested locally in dev and production build with no errors.