diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index ddc85c7..3df630c 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -1258,10 +1258,12 @@ const textInsert = new MutationObserver( (mutations) =>{ const currentLines = document.querySelector('#topHeader div').innerText; window.ReactNativeWebView.postMessage(JSON.stringify({type:"currentLines",currentLines})); } - // Debounced setStrings: fires after any subtree change settles. - // This catches async train re-renders (e.g. from mock XHR setTimeout(0)). + // Apply Tokyo UX immediately (prevents visible flash on normal renders). + try { setStrings(); } catch(e) {} + // Also schedule a follow-up after 250ms to catch async re-renders + // triggered by mock XHR setTimeout(0) responses that settle later. clearTimeout(_ssDebounce); - _ssDebounce = setTimeout(() => { try { setStrings(); } catch(e) {} }, 100); + _ssDebounce = setTimeout(() => { try { setStrings(); } catch(e) {} }, 250); }); // 監視を開始 (subtree: true で深い子孫の変化も捕捉する)