Skip to content

gabifs/rn-webview-lens

Repository files navigation

React Native WebView Lens

JavaScript syntax highlighting for react-native-webview's injectedJavaScript and injectedJavaScriptBeforeContentLoaded props.

Visual Studio Marketplace Version Visual Studio Marketplace Installs

The Problem

When using react-native-webview, injected scripts are plain strings — your editor treats them as opaque text with no syntax highlighting.

Before — no highlighting, hard to read:

Before

After — full JavaScript syntax highlighting:

After

Supported Patterns

Inline template literal

<WebView injectedJavaScript={`document.body.style.backgroundColor = 'red';`} />

Variable reference (same scope or module-level)

const script = `document.body.style.backgroundColor = 'red';`;
// ...
<WebView injectedJavaScript={script} />

String literals (single and double quotes)

const script = "document.body.style.backgroundColor = 'red'";
// ...
<WebView injectedJavaScript={script} />

All patterns work with both injectedJavaScript and injectedJavaScriptBeforeContentLoaded.

Supported File Types

.js, .jsx, .ts, .tsx

Known Limitations (v0.1)

  • Variable tracking only works within the same file
  • Variable shadowing is not handled — the first matching declaration is used

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors