Нет описания

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. #pragma once
  4. #include "winrt/Microsoft.ReactNative.h"
  5. #include "NativeModules.h"
  6. #include "ReactWebView.h"
  7. namespace winrt::ReactNativeWebView::implementation {
  8. class ReactWebViewManager : public winrt::implements<
  9. ReactWebViewManager,
  10. winrt::Microsoft::ReactNative::IViewManager,
  11. winrt::Microsoft::ReactNative::IViewManagerWithReactContext,
  12. winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties,
  13. winrt::Microsoft::ReactNative::IViewManagerWithExportedEventTypeConstants,
  14. winrt::Microsoft::ReactNative::IViewManagerWithCommands> {
  15. public:
  16. ReactWebViewManager();
  17. // IViewManager
  18. winrt::hstring Name() noexcept;
  19. winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
  20. // IViewManagerWithReactContext
  21. winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
  22. void ReactContext(winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
  23. // IViewManagerWithNativeProperties
  24. winrt::Windows::Foundation::Collections::
  25. IMapView<winrt::hstring, winrt::Microsoft::ReactNative::ViewManagerPropertyType>
  26. NativeProps() noexcept;
  27. void UpdateProperties(
  28. winrt::Windows::UI::Xaml::FrameworkElement const& view,
  29. winrt::Microsoft::ReactNative::IJSValueReader const& propertyMapReader) noexcept;
  30. // IViewManagerWithExportedEventTypeConstants
  31. winrt::Microsoft::ReactNative::ConstantProviderDelegate ExportedCustomBubblingEventTypeConstants() noexcept;
  32. winrt::Microsoft::ReactNative::ConstantProviderDelegate ExportedCustomDirectEventTypeConstants() noexcept;
  33. // IViewManagerWithCommands
  34. winrt::Windows::Foundation::Collections::IVectorView<winrt::hstring> Commands() noexcept;
  35. void DispatchCommand(
  36. winrt::Windows::UI::Xaml::FrameworkElement const& view,
  37. winrt::hstring const& commandId,
  38. winrt::Microsoft::ReactNative::IJSValueReader const& commandArgsReader) noexcept;
  39. private:
  40. winrt::ReactNativeWebView::ReactWebView m_reactWebView{ nullptr };
  41. winrt::Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
  42. };
  43. } // namespace winrt::ReactWebView::implementation