react-twitter-embed icon indicating copy to clipboard operation
react-twitter-embed copied to clipboard

Passing theme as a prop does not make component update.

Open MuhammadHasham23 opened this issue 5 years ago • 1 comments

When passing theme as a prop. The component does not re-render.

For example, passing isDark as theme={isDark ? "dark" : "light"} does not work.

Please see the codesandbox link to see the issue: https://codesandbox.io/s/unruffled-bartik-lo92h

MuhammadHasham23 avatar Apr 30 '20 20:04 MuhammadHasham23

Here is a quick hack for anyone:

Pass key prop manually,

	<TwitterTimelineEmbed
		sourceType="profile"
		theme={isDark ? "dark":"light"}
                key={isDark ? "1":"2"}	
         />

MuhammadHasham23 avatar Apr 30 '20 20:04 MuhammadHasham23