Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.

Ticker only display when I resize the browser #56

Open
premtemp1 opened this issue Apr 7, 2022 · 1 comment
Open

Ticker only display when I resize the browser #56

premtemp1 opened this issue Apr 7, 2022 · 1 comment

Comments

@premtemp1
Copy link

Hello,
Thanks for ticker but It only works when I manually resize the window.. Can you please let me know how to fix it

const WeatherWidget = ({ id, editMode }) => {
 const [initialized, setInitialized] = useState(false);
 const [settings, setSettings] = useState({});
 const [widgetApi, setWidgetApi] = useState();
 const [tickerTitle, setTickerTitle] = useState();
 const [loading, setLoading] = useState(true);
 const [error, setError] = useState();
 const [roles, setRoles] = useState([]);

 const settingsChanged = useCallback(debounce(setSettings, 1000), []);

 useEffect(() => {
   const **setDataRole** = (json) => {
     setRoles(json.data)
   }
   if (widgetApi && initialized && settings.jsonData) {
     var json = validateJSON(settings.jsonData);
     **setDataRole**(json);
   }
 }, [settings])


 return (
   <Container>

     <StyledUl>
       <Ticker>

         {({ index }) => (
           <>
             {roles && roles.map(({ key, value }, i) => (
               <>
                 {i === 0 ? null : ','}

                 <span className="name" style={{ fontSize: "12px", color: settings?.keyColor, whiteSpace: "nowrap", margin: "5px" }}>
                   {key}
                 </span>
                 <span className="goal" style={{ fontSize: "12px", color: settings?.valueColor, whiteSpace: "nowrap", margin: "5px" }}>{value}</span>

               </>
             ))
             }
           </>
         )}
       </Ticker>
     </StyledUl>
   </Container>
 );
};

@scottie
Copy link

scottie commented Aug 7, 2022

Same issue here can confirm !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants