saurabhnemade / react-twitter-embed

Simplest way to add twitter widgets to your react project.
https://saurabhnemade.github.io/react-twitter-embed/
367 stars 66 forks source link

Passing theme as a prop does not make component update. #59

Open MuhammadHasham23 opened 4 years ago

MuhammadHasham23 commented 4 years ago

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 commented 4 years ago

Here is a quick hack for anyone:

Pass key prop manually,

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