Skip to content

Commit

Permalink
🐛 Re-add support for ReactNode captions
Browse files Browse the repository at this point in the history
Merges #368
  • Loading branch information
davwheat authored May 2, 2020
2 parents c9b1c31 + de33fdb commit 7d26913
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface TrackProps {
onSwipeStart?: () => void;
onViewChange?: (view: number) => void;
springConfig?: { [key: string]: number };
swipe?: boolean| 'mouse' | 'touch';
swipe?: boolean | 'mouse' | 'touch';
swipeThreshold?: number;
tag?: any;
viewsToMove?: number;
Expand Down
8 changes: 7 additions & 1 deletion src/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ export const FooterCaption = (props: ViewType) => {
css={getStyles('footerCaption', props)}
className={className('footer__caption', state)}
>
{ParseHtml(`<span>${caption}</span>`)}
{/*
* Render a string caption using ParseHtml in case we were passed a
* string with HTML. All other types are rendered by JSX by default.
*/}
{caption instanceof string

This comment has been minimized.

Copy link
@ogheo

ogheo May 2, 2020

Change this code to {typeof caption === 'string' since previous one broke page

This comment has been minimized.

Copy link
@davwheat

davwheat May 2, 2020

Author Collaborator

Good spot! That slipped past me!

? ParseHtml(`<span>${caption}</span>`)
: caption}
</Span>
);
};
Expand Down

0 comments on commit 7d26913

Please sign in to comment.