INNER CODE UNIT · TypeScript
reloadWebView
rgommezz/react-native-chatgpt · src/api/index.ts:282
export function reloadWebView() {
webview?.reload();
}
/**
* Removes the icon button in the top right corner of the webview screen when
* ChatGPT is at full capacity
*/
export async function removeThemeSwitcher() {
// Apparently the button is not there yet after the page loads, so we wait a bit
await wait(200);
const script = `
(() => {
const xpath = "//div[contains(text(),'ChatGPT is at capacity right now')]";
const element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (element) {
window.removeThemeSwitcher();