Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TypeError: Cannot set property 'text' of null

ANSWERED

I've solved this problem before on another watch a long time ago, but I forgot what I did. Anywho, I'm receiving this error from 

  hourHand.groupTransform.rotate.angle = hoursToAngle(hours, mins);

 

My first plan was to take the analog tutorial watch and make a test watchface and test it out. Worked perfectly. Now I update my functions to match exactly what it says in the tutorial, and I'm still getting a problem.

I'll post some code below:

 

function updateClock() {
  let now = new Date();
  let hours = now.getHours() % 12;
  let mins = now.getMinutes();
  let secs = now.getSeconds();
  const dates = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"];
  let dateName = dates[now.getDate()];
  const days = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
  let dayName = days[now.getDay()];
  hourHand.groupTransform.rotate.angle = hoursToAngle(hours, mins);
  minHand.groupTransform.rotate.angle = minutesToAngle(mins);
  secHand.groupTransform.rotate.angle = secondsToAngle(secs);

 

My <g> in my index.views are also the same as usual, but I replaced the <rect> with <image> as I have custom images and such. Also, my console.log for the hoursToAngle(hours, mins) is producing a number and is correct, so I'm a bit confused. 

Thanks for the help!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

And its magically gone. If someone could close this, it would be appreciated!

View best answer in original post

Best Answer
2 REPLIES 2

Also, everything works. The hour hand and other hands all are working properly, but I don't understand why I'm getting this error.

Best Answer
0 Votes

And its magically gone. If someone could close this, it would be appreciated!

Best Answer