@@ -1,10 +1,11 @@
1−import React, { useState } from 'react';
1+import React, { useState, useRef } from 'react';
3import useInterval from 'lib/useInterval';
3import useInterval from 'lib/useInterval';
5// TODO: make these characters display as the same width
5// TODO: make these characters display as the same width
6export const kLoadingCharacter = '▓';
6export const kLoadingCharacter = '▓';
7export const kInterstitialCharacter = '░';
7export const kInterstitialCharacter = '░';
8+const kBlinkAfterMs = 2500; // ms
9export const matchBlinky = obj =>
10export const matchBlinky = obj =>
10 obj.matchWith({
11 obj.matchWith({
@@ -17,7 +18,14 @@ export default function Blinky({
17 b = kInterstitialCharacter,
18 b = kInterstitialCharacter,
19 const [value, setValue] = useState(true);
20 const [value, setValue] = useState(true);
21+ const now = useRef(new Date());
24+ // only start blinking if we've elapsed enough time
25+ if (new Date() - now.current > kBlinkAfterMs) {
20− useInterval(() => setValue(val => !val), 1000);
26+ setValue(val => !val);
22 return value ? a : b;
30 return value ? a : b;