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

Ticker only display when I resize the browser #56

Description

@premtemp1

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>
 );
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions