Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support message passing and keeping native WebView in memory when react component is unmounted #2469

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Commits on Mar 28, 2023

  1. [ios] support maintaining WebView and iFrame state when moving WebVie…

    …w in view hierarchy
    
    make sure release function is defined for Android WebView react component (#3)
    
    [iOS] support releasing native WebView without a ref to the React WebView (#4)
    
    fix EXC_BAD_ACCESS error by removing WKWebView reference to RNCWebView
    
    Support message passing to native webview without react tag (#6)
    
    fix EXC_BAD_ACCESS during remount situations (#7)
    
    There are some specific edge cases where a crash currently happens
    1) Let's say RNCWebview A is mounted on the screen.
    2) RNCWebview B starts to mount (while A is still mounted) with the same webview key
    3) RNCWebview B removes the WKWebview from A and attaches it to itself
    4) RNCWebview A starts to unmount, and upon unmounting tries to remove WKWebview A from itself. Since RNCWebview B already did this step from (3), this causes a crash.
    
    Here we only remove the view if the currently "set" RNCWebview inside the shared dict (where we keep track of the active view for a key) is self
    
    fix segfault with webview remount (#8)
    
    * fix another segfault
    
    * address comments
    donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    b96df7b View commit details
    Browse the repository at this point in the history
  2. [android] support maintaining WebView and iFrame state when moving We…

    …bView in view hierarchy
    
    * add support to reuse instance with webViewKey
    
    * change up
    
    * address comments related to layout params
    
    * add nullability checks
    
    * fix
    
    * get full stack trace
    
    * add secondary map
    
    * rename to ifHasInternalWebView
    
    * additional fixes
    
    * fix
    
    * fix boolean
    
    [android] add messaging passing without a react tag (#12)
    
    This PR adds messaging passing. This was much simpler to do than the iOS counter part. This is the analogue to the following PR: #6. I've followed the same test plan. The sample app was really nice to use when testing.
    
    In the previous PR #11, I broke all native->react-native communication since events were being passed by the `InternalWebView` viewId not the `RNCWebView` viewId. This is now fixed.
    
    [android] check source prop if changed (#14)
    
    * [android] check source prop if changed
    
    * detect if new source is null too
    nealmanaktola authored and donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    91e5515 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    63c586a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8d53293 View commit details
    Browse the repository at this point in the history
  5. cleanup message passing (#17)

    * message passing cleanup
    
    - rename onMessage -> ReactNativeWebviewOnMessageWithWebViewKey (due to globally unique event names)
    - add a small wrapper for listening to events
    - rename `enableMessaging` to `messagingWithWebViewKeyEnabled`
    
    * remove empty line
    
    * fix spacing
    
    * fix spacing p2
    
    * additional cleanup
    
    * update comments
    
    * make this a bit safer
    nealmanaktola authored and donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    fd7cb69 View commit details
    Browse the repository at this point in the history
  6. remove COMMAND_RELEASE

    nealmanaktola authored and donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    293273d View commit details
    Browse the repository at this point in the history
  7. ci-fixes

    nealmanaktola authored and donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    413cae3 View commit details
    Browse the repository at this point in the history
  8. auto-format with XCode

    donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    9db5879 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    c1e4fc5 View commit details
    Browse the repository at this point in the history
  10. create WebViewProxy

    donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    87883fc View commit details
    Browse the repository at this point in the history
  11. end of file newlines

    donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    c1465a9 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    d1e4433 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    267b40a View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    4343e47 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    2eeb82f View commit details
    Browse the repository at this point in the history
  16. lint

    donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    285811d View commit details
    Browse the repository at this point in the history
  17. spacing nit

    donaldchen committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    e9a0e44 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    6a1ef63 View commit details
    Browse the repository at this point in the history

Commits on Mar 29, 2023

  1. Configuration menu
    Copy the full SHA
    8299671 View commit details
    Browse the repository at this point in the history