Skip to content

Added WebView native template element#97

Open
scorsin-oai wants to merge 1 commit into
Snapchat:mainfrom
scorsin-oai:simon/260514-webview
Open

Added WebView native template element#97
scorsin-oai wants to merge 1 commit into
Snapchat:mainfrom
scorsin-oai:simon/260514-webview

Conversation

@scorsin-oai
Copy link
Copy Markdown

Description

This change adds webview as a builtin native template element. It is implemented through the new polyglot module system, which allows to provide new native views with their TS API in their own isolated modules and have them being automatically discoverable by the Valdi runtime. It works on both iOS and Android. The API is exposed through a WebViewController API which is code generated. The controller can be attached when rendered under a <webview> element. Added also a sample app which showcases the API.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Documentation improvement
  • Performance optimization
  • Test improvement
  • Other (please describe)

Testing

  • Tests pass locally (bazel test //...)
  • Added/updated tests for changes (if applicable)
  • Tested on multiple platforms (iOS/Android/Web/macOS as applicable)
  • Manual testing performed (describe below)

Testing Details

Checklist

  • Code follows project style guidelines
  • Documentation updated (if needed)
  • No breaking changes (or documented in description)
  • Commit messages follow conventional format
  • No secrets, API keys, or internal URLs included

Related Issues

Additional Context

## Description
This change adds webview as a builtin native template element. It is implemented through the new polyglot module system we introduced for open sourcing, which allows to provide new native views with their TS API in their own isolated modules and have them being automatically discoverable by the Valdi runtime. It works on both iOS and Android. The API is exposed through a WebViewController API which is code generated. The controller can be attached when rendered under a `<webview>` element. Added also a sample app which showcases the API.

(cherry picked from commit 73f32a0c05fe45dcc69a020ea59fa96b0b367a20)
@github-actions github-actions Bot added area/build-system Bazel build rules and config area/docs Documentation labels May 14, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thanks for your first contribution to Valdi!

A maintainer will review your PR soon. Here are a few things to check while you wait:

  • ✅ All tests pass (bazel test //...)
  • ✅ Your changes follow our coding standards
  • ✅ You've added tests for your changes (if applicable)
  • ✅ You've updated documentation (if needed)

Join our Discord community if you have questions!

@semgrep-code-snapchat
Copy link
Copy Markdown

Semgrep found 23 internal-sensitive-strings findings:

  • src/valdi_modules/src/valdi/valdi_webview/src/WebViewNative.d.ts
  • src/valdi_modules/src/valdi/valdi_webview/android/com/snap/valdi/modules/webview/WebViewControllerImpl.kt
  • src/valdi_modules/src/valdi/valdi_webview/android/com/snap/valdi/modules/webview/ValdiWebViewAttributesBinder.kt
  • src/valdi_modules/src/valdi/valdi_webview/android/com/snap/valdi/modules/webview/ValdiWebView.kt
  • src/valdi_modules/src/valdi/valdi_webview/android/com/snap/valdi/modules/webview/AndroidWebViewHolder.kt
  • src/valdi_modules/src/valdi/valdi_webview/android/WebViewNativeModuleFactoryImpl.kt
  • src/valdi_modules/src/valdi/valdi_webview/BUILD.bazel
  • src/valdi_modules/src/valdi/valdi_tsx/src/NativeTemplateElements.d.ts
  • src/valdi_modules/src/valdi/valdi_core/src/JSXBootstrap.ts
  • apps/webview_example/BUILD.bazel

This literal might contain a Snapchat internal reference that should not be committed to open-source repositories.

Fix: Please replace / remove the string to avoid committing it to open-source repositories.

@clholgat
Copy link
Copy Markdown
Collaborator

Pulling in for extra testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build-system Bazel build rules and config area/docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants