-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ModalScreenViewManager and ScreenStackHeaderSubview to Windows Na…
…tive UI Components
- Loading branch information
Showing
11 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "pch.h" | ||
#include "ModalScreenViewManager.h" | ||
#include "JSValueXaml.h" | ||
#include "NativeModules.h" | ||
#include "ModalScreen.h" | ||
|
||
namespace winrt { | ||
using namespace Microsoft::ReactNative; | ||
using namespace Windows::Foundation; | ||
using namespace Windows::Foundation::Collections; | ||
using namespace Windows::UI; | ||
using namespace Windows::UI::Xaml; | ||
using namespace Windows::UI::Xaml::Controls; | ||
} // namespace winrt | ||
|
||
namespace winrt::RNScreens::implementation { | ||
// IViewManager | ||
winrt::hstring ModalScreenViewManager::Name() noexcept { | ||
return L"RNSModalScreen"; | ||
} | ||
|
||
|
||
} // namespace winrt::RNScreens::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
#include "NativeModules.h" | ||
#include "winrt/Microsoft.ReactNative.h" | ||
#include "ScreenViewManager.h" | ||
|
||
namespace winrt::RNScreens::implementation { | ||
|
||
class ModalScreenViewManager : public ScreenViewManager { | ||
public: | ||
ModalScreenViewManager() = default; | ||
virtual winrt::hstring Name() noexcept; | ||
}; | ||
} // namespace winrt::RNScreens::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "pch.h" | ||
#include "ScreenStackHeaderSubview.h" | ||
#include "JSValueXaml.h" | ||
#include "NativeModules.h" | ||
|
||
namespace winrt { | ||
using namespace Microsoft::ReactNative; | ||
using namespace Windows::Foundation; | ||
using namespace Windows::Foundation::Collections; | ||
using namespace Windows::UI; | ||
using namespace Windows::UI::Xaml; | ||
using namespace Windows::UI::Xaml::Controls; | ||
} // namespace winrt | ||
|
||
namespace winrt::RNScreens::implementation { | ||
ScreenStackHeaderSubview::ScreenStackHeaderSubview( | ||
winrt::Microsoft::ReactNative::IReactContext reactContext) | ||
: m_reactContext(reactContext) {} | ||
} // namespace winrt::RNScreens::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
namespace winrt::RNScreens::implementation { | ||
class ScreenStackHeaderSubview | ||
: public winrt::Windows::UI::Xaml::Controls::StackPanelT< | ||
ScreenStackHeaderSubview> { | ||
public: | ||
ScreenStackHeaderSubview( | ||
winrt::Microsoft::ReactNative::IReactContext m_reactContext); | ||
|
||
private: | ||
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr}; | ||
}; | ||
} // namespace winrt::RNScreens::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#include "pch.h" | ||
#include "ScreenStackHeaderSubviewViewManager.h" | ||
#include "JSValueXaml.h" | ||
#include "NativeModules.h" | ||
#include "ScreenStackHeaderSubview.h" | ||
|
||
namespace winrt { | ||
using namespace Microsoft::ReactNative; | ||
using namespace Windows::Foundation; | ||
using namespace Windows::Foundation::Collections; | ||
using namespace Windows::UI; | ||
using namespace Windows::UI::Xaml; | ||
using namespace Windows::UI::Xaml::Controls; | ||
} // namespace winrt | ||
|
||
namespace winrt::RNScreens::implementation { | ||
// IViewManager | ||
winrt::hstring ScreenStackHeaderSubviewViewManager::Name() noexcept { | ||
return L"RNSScreenStackHeaderSubview"; | ||
} | ||
|
||
winrt::FrameworkElement | ||
ScreenStackHeaderSubviewViewManager::CreateView() noexcept { | ||
return winrt::make<ScreenStackHeaderSubview>(m_reactContext); | ||
} | ||
|
||
// IViewManagerRequiresNativeLayout | ||
bool ScreenStackHeaderSubviewViewManager::RequiresNativeLayout() { | ||
return true; | ||
} | ||
|
||
// IViewManagerWithReactContext | ||
winrt::IReactContext | ||
ScreenStackHeaderSubviewViewManager::ReactContext() noexcept { | ||
return m_reactContext; | ||
} | ||
|
||
void ScreenStackHeaderSubviewViewManager::ReactContext( | ||
IReactContext reactContext) noexcept { | ||
m_reactContext = reactContext; | ||
} | ||
|
||
// IViewManagerWithNativeProperties | ||
IMapView<hstring, ViewManagerPropertyType> | ||
ScreenStackHeaderSubviewViewManager::NativeProps() noexcept { | ||
auto nativeProps = | ||
winrt::single_threaded_map<hstring, ViewManagerPropertyType>(); | ||
return nativeProps.GetView(); | ||
} | ||
|
||
void ScreenStackHeaderSubviewViewManager::UpdateProperties( | ||
FrameworkElement const &view, | ||
IJSValueReader const &propertyMapReader) noexcept { | ||
(void)view; | ||
const JSValueObject &propertyMap = JSValue::ReadObjectFrom(propertyMapReader); | ||
for (auto const &pair : propertyMap) { | ||
auto const &propertyName = pair.first; | ||
auto const &propertyValue = pair.second; | ||
(void)propertyName; | ||
(void)propertyValue; | ||
} | ||
} | ||
|
||
// IViewManagerWithExportedEventTypeConstants | ||
ConstantProviderDelegate ScreenStackHeaderSubviewViewManager:: | ||
ExportedCustomBubblingEventTypeConstants() noexcept { | ||
return nullptr; | ||
} | ||
|
||
ConstantProviderDelegate ScreenStackHeaderSubviewViewManager:: | ||
ExportedCustomDirectEventTypeConstants() noexcept { | ||
return nullptr; | ||
} | ||
|
||
// IViewManagerWithCommands | ||
IVectorView<hstring> ScreenStackHeaderSubviewViewManager::Commands() noexcept { | ||
auto commands = winrt::single_threaded_vector<hstring>(); | ||
return commands.GetView(); | ||
} | ||
|
||
void ScreenStackHeaderSubviewViewManager::DispatchCommand( | ||
FrameworkElement const &view, | ||
winrt::hstring const &commandId, | ||
winrt::IJSValueReader const &commandArgsReader) noexcept { | ||
(void)view; | ||
(void)commandId; | ||
(void)commandArgsReader; | ||
} | ||
} // namespace winrt::RNScreens::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#pragma once | ||
#include "NativeModules.h" | ||
#include "winrt/Microsoft.ReactNative.h" | ||
|
||
namespace winrt::RNScreens::implementation { | ||
|
||
class ScreenStackHeaderSubviewViewManager | ||
: public winrt::implements< | ||
ScreenStackHeaderSubviewViewManager, | ||
winrt::Microsoft::ReactNative::IViewManager, | ||
winrt::Microsoft::ReactNative::IViewManagerRequiresNativeLayout, | ||
winrt::Microsoft::ReactNative::IViewManagerWithReactContext, | ||
winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties, | ||
winrt::Microsoft::ReactNative:: | ||
IViewManagerWithExportedEventTypeConstants, | ||
winrt::Microsoft::ReactNative::IViewManagerWithCommands> { | ||
public: | ||
ScreenStackHeaderSubviewViewManager() = default; | ||
|
||
// IViewManager | ||
winrt::hstring Name() noexcept; | ||
winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept; | ||
|
||
// IViewManagerRequiresNativeLayout | ||
bool RequiresNativeLayout(); | ||
|
||
// IViewManagerWithReactContext | ||
winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept; | ||
void ReactContext( | ||
winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept; | ||
|
||
// IViewManagerWithNativeProperties | ||
winrt::Windows::Foundation::Collections::IMapView< | ||
winrt::hstring, | ||
winrt::Microsoft::ReactNative::ViewManagerPropertyType> | ||
NativeProps() noexcept; | ||
|
||
void UpdateProperties( | ||
winrt::Windows::UI::Xaml::FrameworkElement const &view, | ||
winrt::Microsoft::ReactNative::IJSValueReader const | ||
&propertyMapReader) noexcept; | ||
|
||
// IViewManagerWithExportedEventTypeConstants | ||
winrt::Microsoft::ReactNative::ConstantProviderDelegate | ||
ExportedCustomBubblingEventTypeConstants() noexcept; | ||
winrt::Microsoft::ReactNative::ConstantProviderDelegate | ||
ExportedCustomDirectEventTypeConstants() noexcept; | ||
|
||
// IViewManagerWithCommands | ||
winrt::Windows::Foundation::Collections::IVectorView<winrt::hstring> | ||
Commands() noexcept; | ||
|
||
void DispatchCommand( | ||
winrt::Windows::UI::Xaml::FrameworkElement const &view, | ||
winrt::hstring const &commandId, | ||
winrt::Microsoft::ReactNative::IJSValueReader const | ||
&commandArgsReader) noexcept; | ||
|
||
private: | ||
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr}; | ||
}; | ||
} // namespace winrt::RNScreens::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters