react-native-webview / react-native-webview

React Native Cross-Platform WebView
https://github.com/react-native-community/discussions-and-proposals/pull/3
MIT License
6.31k stars 2.96k forks source link

feat: Add visionOS support #3373

Closed Saadnajmi closed 1 month ago

Saadnajmi commented 2 months ago

Summary

Add visionOS support, and an example test app via react-native-test-app.

As it turns out, most of where we ifdeffed stuff out for macOS, is also where we need to ifdef out for visionOS. So a simple conversion of the ifdefs from "if !macOS" to "if iOS" does the job.

Additionally, we needed to port uses of UIMenuController to to UIEditMenuInteraction. This is only available on iOS 16+, so I did my best to guard behind availability checks and compiler ifdefs. I am not sure what our minimum iOS/Xcode version we want to support in this repo is, so I would appreciate a sanity check.

Test Plan

Test app works. Custom menus work on both iOS 16 and visionOS 1.0

Screenshot 2024-04-01 at 11 23 23 PM

(Sorry for the compressed video)

https://github.com/react-native-webview/react-native-webview/assets/6722175/fbab0541-c47c-4ae9-bbc3-84057605101e

Saadnajmi commented 2 months ago

EDIT: And ported. Good to go!

This PR works as far as I can tell, save custom menus. The method for showing custom actions in a context menu on iOS 16 / visionOS 1.0 changed (use UIEditMenuConfiguration instead of UIMenuController), so I'm seeing If I can refactor that bit. Otherwise, this change might be able to land without custom menu support

Saadnajmi commented 2 months ago

Hello @Titozzz / @jamonholmgren , I was wondering if there was anything I could do to help move this PR forward? Appreciate your time spent maintaining this repo :)

react-native-community-bot commented 1 month ago

:tada: This PR is included in version 13.9.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: