react-native-screens 4.11.0-beta.0 → 4.11.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +18 -12
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +48 -97
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +4 -124
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetDelegate.kt +2 -2
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetUtils.kt +23 -0
- package/android/src/main/java/com/swmansion/rnscreens/stack/anim/ScreensAnimation.kt +18 -0
- package/android/src/main/java/com/swmansion/rnscreens/stack/views/ChildDrawingOrderStrategyImpl.kt +48 -0
- package/android/src/main/java/com/swmansion/rnscreens/stack/views/ChildrenDrawingOrderStrategy.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/stack/views/ScreensCoordinatorLayout.kt +99 -0
- package/lib/commonjs/components/ScreenContentWrapper.windows.js +10 -0
- package/lib/commonjs/components/ScreenContentWrapper.windows.js.map +1 -0
- package/lib/commonjs/components/ScreenFooter.windows.js +11 -0
- package/lib/commonjs/components/ScreenFooter.windows.js.map +1 -0
- package/lib/module/components/ScreenContentWrapper.windows.js +4 -0
- package/lib/module/components/ScreenContentWrapper.windows.js.map +1 -0
- package/lib/module/components/ScreenFooter.windows.js +6 -0
- package/lib/module/components/ScreenFooter.windows.js.map +1 -0
- package/lib/typescript/components/ScreenContentWrapper.windows.d.ts +4 -0
- package/lib/typescript/components/ScreenContentWrapper.windows.d.ts.map +1 -0
- package/lib/typescript/components/ScreenFooter.windows.d.ts +6 -0
- package/lib/typescript/components/ScreenFooter.windows.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/ScreenContentWrapper.windows.tsx +5 -0
- package/src/components/ScreenFooter.windows.tsx +7 -0
- package/windows/RNScreens/ModalScreenViewManager.cpp +22 -0
- package/windows/RNScreens/ModalScreenViewManager.h +13 -0
- package/windows/RNScreens/RNScreens.vcxproj +11 -1
- package/windows/RNScreens/RNScreens.vcxproj.filters +10 -0
- package/windows/RNScreens/ReactPackageProvider.cpp +18 -0
- package/windows/RNScreens/Screen.cpp +128 -122
- package/windows/RNScreens/Screen.h +6 -2
- package/windows/RNScreens/ScreenStackHeaderConfig.cpp +25 -1
- package/windows/RNScreens/ScreenStackHeaderConfig.h +10 -1
- package/windows/RNScreens/ScreenStackHeaderConfigViewManager.cpp +42 -1
- package/windows/RNScreens/ScreenStackHeaderConfigViewManager.h +15 -0
- package/windows/RNScreens/ScreenStackHeaderSubview.cpp +43 -0
- package/windows/RNScreens/ScreenStackHeaderSubview.h +24 -0
- package/windows/RNScreens/ScreenStackHeaderSubviewViewManager.cpp +129 -0
- package/windows/RNScreens/ScreenStackHeaderSubviewViewManager.h +77 -0
- package/windows/RNScreens/ScreenViewManager.cpp +45 -16
- package/windows/RNScreens/ScreenViewManager.h +1 -1
- package/windows/RNScreens/SearchBar.cpp +19 -0
- package/windows/RNScreens/SearchBar.h +14 -0
- package/windows/RNScreens/SearchBarViewManager.cpp +88 -0
- package/windows/RNScreens/SearchBarViewManager.h +62 -0
|
@@ -15,5 +15,29 @@ using namespace Windows::UI::Xaml::Controls;
|
|
|
15
15
|
namespace winrt::RNScreens::implementation {
|
|
16
16
|
ScreenStackHeaderConfig::ScreenStackHeaderConfig(
|
|
17
17
|
winrt::Microsoft::ReactNative::IReactContext reactContext)
|
|
18
|
-
: m_reactContext(reactContext)
|
|
18
|
+
: m_reactContext(reactContext),
|
|
19
|
+
m_children(
|
|
20
|
+
{winrt::single_threaded_vector<Windows::UI::Xaml::UIElement>()}) {}
|
|
21
|
+
|
|
22
|
+
void ScreenStackHeaderConfig::addView(winrt::Windows::UI::Xaml::UIElement element) {
|
|
23
|
+
Children().Append(element);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void ScreenStackHeaderConfig::removeAllChildren() {
|
|
27
|
+
Children().Clear();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void ScreenStackHeaderConfig::removeChildAt(int64_t index) {
|
|
31
|
+
Children().RemoveAt(static_cast<uint32_t>(index));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void ScreenStackHeaderConfig::replaceChild(
|
|
35
|
+
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
36
|
+
winrt::Windows::UI::Xaml::UIElement newChild) {
|
|
37
|
+
uint32_t index;
|
|
38
|
+
if (!Children().IndexOf(oldChild, index))
|
|
39
|
+
return;
|
|
40
|
+
|
|
41
|
+
Children().SetAt(index, newChild);
|
|
42
|
+
}
|
|
19
43
|
} // namespace winrt::RNScreens::implementation
|
|
@@ -6,8 +6,17 @@ class ScreenStackHeaderConfig
|
|
|
6
6
|
ScreenStackHeaderConfig> {
|
|
7
7
|
public:
|
|
8
8
|
ScreenStackHeaderConfig(
|
|
9
|
-
winrt::Microsoft::ReactNative::IReactContext
|
|
9
|
+
winrt::Microsoft::ReactNative::IReactContext reactContext);
|
|
10
10
|
|
|
11
|
+
void addView(winrt::Windows::UI::Xaml::UIElement element);
|
|
12
|
+
void removeAllChildren();
|
|
13
|
+
void removeChildAt(int64_t index);
|
|
14
|
+
void replaceChild(
|
|
15
|
+
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
16
|
+
winrt::Windows::UI::Xaml::UIElement newChild);
|
|
17
|
+
|
|
18
|
+
winrt::Windows::Foundation::Collections::IVector<Windows::UI::Xaml::UIElement>
|
|
19
|
+
m_children;
|
|
11
20
|
private:
|
|
12
21
|
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
|
13
22
|
};
|
|
@@ -26,7 +26,48 @@ ScreenStackHeaderConfigViewManager::CreateView() noexcept {
|
|
|
26
26
|
|
|
27
27
|
// IViewManagerRequiresNativeLayout
|
|
28
28
|
bool ScreenStackHeaderConfigViewManager::RequiresNativeLayout() {
|
|
29
|
-
return
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// IViewManagerWithChildren
|
|
33
|
+
void ScreenStackHeaderConfigViewManager::AddView(
|
|
34
|
+
FrameworkElement parent,
|
|
35
|
+
UIElement child,
|
|
36
|
+
int64_t index) {
|
|
37
|
+
auto screenStackHeaderConfig = parent.as<ScreenStackHeaderConfig>();
|
|
38
|
+
if (!screenStackHeaderConfig)
|
|
39
|
+
return;
|
|
40
|
+
|
|
41
|
+
screenStackHeaderConfig->addView(child);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
void ScreenStackHeaderConfigViewManager::RemoveAllChildren(FrameworkElement parent) {
|
|
45
|
+
auto screenStackHeaderConfig = parent.as<ScreenStackHeaderConfig>();
|
|
46
|
+
if (!screenStackHeaderConfig)
|
|
47
|
+
return;
|
|
48
|
+
|
|
49
|
+
screenStackHeaderConfig->removeAllChildren();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void ScreenStackHeaderConfigViewManager::RemoveChildAt(
|
|
53
|
+
FrameworkElement parent,
|
|
54
|
+
int64_t index) {
|
|
55
|
+
auto screenStackHeaderConfig = parent.as<ScreenStackHeaderConfig>();
|
|
56
|
+
if (!screenStackHeaderConfig)
|
|
57
|
+
return;
|
|
58
|
+
|
|
59
|
+
screenStackHeaderConfig->removeChildAt(index);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void ScreenStackHeaderConfigViewManager::ReplaceChild(
|
|
63
|
+
FrameworkElement parent,
|
|
64
|
+
UIElement oldChild,
|
|
65
|
+
UIElement newChild) {
|
|
66
|
+
auto screenStackHeaderConfig = parent.as<ScreenStackHeaderConfig>();
|
|
67
|
+
if (!screenStackHeaderConfig)
|
|
68
|
+
return;
|
|
69
|
+
|
|
70
|
+
screenStackHeaderConfig->replaceChild(oldChild, newChild);
|
|
30
71
|
}
|
|
31
72
|
|
|
32
73
|
// IViewManagerWithReactContext
|
|
@@ -10,6 +10,7 @@ class ScreenStackHeaderConfigViewManager
|
|
|
10
10
|
winrt::Microsoft::ReactNative::IViewManager,
|
|
11
11
|
winrt::Microsoft::ReactNative::IViewManagerRequiresNativeLayout,
|
|
12
12
|
winrt::Microsoft::ReactNative::IViewManagerWithReactContext,
|
|
13
|
+
winrt::Microsoft::ReactNative::IViewManagerWithChildren,
|
|
13
14
|
winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties,
|
|
14
15
|
winrt::Microsoft::ReactNative::
|
|
15
16
|
IViewManagerWithExportedEventTypeConstants,
|
|
@@ -24,6 +25,20 @@ class ScreenStackHeaderConfigViewManager
|
|
|
24
25
|
// IViewManagerRequiresNativeLayout
|
|
25
26
|
bool RequiresNativeLayout();
|
|
26
27
|
|
|
28
|
+
// IViewManagerWithChildren
|
|
29
|
+
void AddView(
|
|
30
|
+
winrt::Windows::UI::Xaml::FrameworkElement parent,
|
|
31
|
+
winrt::Windows::UI::Xaml::UIElement child,
|
|
32
|
+
int64_t index);
|
|
33
|
+
void RemoveAllChildren(winrt::Windows::UI::Xaml::FrameworkElement parent);
|
|
34
|
+
void RemoveChildAt(
|
|
35
|
+
winrt::Windows::UI::Xaml::FrameworkElement parent,
|
|
36
|
+
int64_t index);
|
|
37
|
+
void ReplaceChild(
|
|
38
|
+
winrt::Windows::UI::Xaml::FrameworkElement parent,
|
|
39
|
+
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
40
|
+
winrt::Windows::UI::Xaml::UIElement newChild);
|
|
41
|
+
|
|
27
42
|
// IViewManagerWithReactContext
|
|
28
43
|
winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
|
|
29
44
|
void ReactContext(
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "ScreenStackHeaderSubview.h"
|
|
3
|
+
#include "JSValueXaml.h"
|
|
4
|
+
#include "NativeModules.h"
|
|
5
|
+
|
|
6
|
+
namespace winrt {
|
|
7
|
+
using namespace Microsoft::ReactNative;
|
|
8
|
+
using namespace Windows::Foundation;
|
|
9
|
+
using namespace Windows::Foundation::Collections;
|
|
10
|
+
using namespace Windows::UI;
|
|
11
|
+
using namespace Windows::UI::Xaml;
|
|
12
|
+
using namespace Windows::UI::Xaml::Controls;
|
|
13
|
+
} // namespace winrt
|
|
14
|
+
|
|
15
|
+
namespace winrt::RNScreens::implementation {
|
|
16
|
+
ScreenStackHeaderSubview::ScreenStackHeaderSubview(
|
|
17
|
+
winrt::Microsoft::ReactNative::IReactContext reactContext)
|
|
18
|
+
: m_reactContext(reactContext),
|
|
19
|
+
m_children(
|
|
20
|
+
{winrt::single_threaded_vector<Windows::UI::Xaml::UIElement>()}) {}
|
|
21
|
+
|
|
22
|
+
void ScreenStackHeaderSubview::addView(winrt::Windows::UI::Xaml::UIElement element) {
|
|
23
|
+
Children().Append(element);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void ScreenStackHeaderSubview::removeAllChildren() {
|
|
27
|
+
Children().Clear();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void ScreenStackHeaderSubview::removeChildAt(int64_t index) {
|
|
31
|
+
Children().RemoveAt(static_cast<uint32_t>(index));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void ScreenStackHeaderSubview::replaceChild(
|
|
35
|
+
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
36
|
+
winrt::Windows::UI::Xaml::UIElement newChild) {
|
|
37
|
+
uint32_t index;
|
|
38
|
+
if (!Children().IndexOf(oldChild, index))
|
|
39
|
+
return;
|
|
40
|
+
|
|
41
|
+
Children().SetAt(index, newChild);
|
|
42
|
+
}
|
|
43
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
namespace winrt::RNScreens::implementation {
|
|
4
|
+
class ScreenStackHeaderSubview
|
|
5
|
+
: public winrt::Windows::UI::Xaml::Controls::StackPanelT<
|
|
6
|
+
ScreenStackHeaderSubview> {
|
|
7
|
+
public:
|
|
8
|
+
ScreenStackHeaderSubview(
|
|
9
|
+
winrt::Microsoft::ReactNative::IReactContext reactContext);
|
|
10
|
+
|
|
11
|
+
void addView(winrt::Windows::UI::Xaml::UIElement element);
|
|
12
|
+
void removeAllChildren();
|
|
13
|
+
void removeChildAt(int64_t index);
|
|
14
|
+
void replaceChild(
|
|
15
|
+
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
16
|
+
winrt::Windows::UI::Xaml::UIElement newChild);
|
|
17
|
+
|
|
18
|
+
winrt::Windows::Foundation::Collections::IVector<Windows::UI::Xaml::UIElement>
|
|
19
|
+
m_children;
|
|
20
|
+
|
|
21
|
+
private:
|
|
22
|
+
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
|
23
|
+
};
|
|
24
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "ScreenStackHeaderSubviewViewManager.h"
|
|
3
|
+
#include "ScreenStackHeaderSubview.h"
|
|
4
|
+
#include "JSValueXaml.h"
|
|
5
|
+
#include "NativeModules.h"
|
|
6
|
+
|
|
7
|
+
namespace winrt {
|
|
8
|
+
using namespace Microsoft::ReactNative;
|
|
9
|
+
using namespace Windows::Foundation;
|
|
10
|
+
using namespace Windows::Foundation::Collections;
|
|
11
|
+
using namespace Windows::UI;
|
|
12
|
+
using namespace Windows::UI::Xaml;
|
|
13
|
+
using namespace Windows::UI::Xaml::Controls;
|
|
14
|
+
} // namespace winrt
|
|
15
|
+
|
|
16
|
+
namespace winrt::RNScreens::implementation {
|
|
17
|
+
// IViewManager
|
|
18
|
+
winrt::hstring ScreenStackHeaderSubviewViewManager::Name() noexcept {
|
|
19
|
+
return L"RNSScreenStackHeaderSubview";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
winrt::FrameworkElement ScreenStackHeaderSubviewViewManager::CreateView() noexcept {
|
|
23
|
+
return winrt::make<winrt::RNScreens::implementation::ScreenStackHeaderSubview>(m_reactContext);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// IViewManagerRequiresNativeLayout
|
|
27
|
+
bool ScreenStackHeaderSubviewViewManager::RequiresNativeLayout() {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// IViewManagerWithChildren
|
|
32
|
+
void ScreenStackHeaderSubviewViewManager::AddView(
|
|
33
|
+
FrameworkElement parent,
|
|
34
|
+
UIElement child,
|
|
35
|
+
int64_t index) {
|
|
36
|
+
auto screenStackHeaderSubview = parent.as<ScreenStackHeaderSubview>();
|
|
37
|
+
if (!screenStackHeaderSubview)
|
|
38
|
+
return;
|
|
39
|
+
|
|
40
|
+
screenStackHeaderSubview->addView(child);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void ScreenStackHeaderSubviewViewManager::RemoveAllChildren(FrameworkElement parent) {
|
|
44
|
+
auto screenStackHeaderSubview = parent.as<ScreenStackHeaderSubview>();
|
|
45
|
+
if (!screenStackHeaderSubview)
|
|
46
|
+
return;
|
|
47
|
+
|
|
48
|
+
screenStackHeaderSubview->removeAllChildren();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void ScreenStackHeaderSubviewViewManager::RemoveChildAt(
|
|
52
|
+
FrameworkElement parent,
|
|
53
|
+
int64_t index) {
|
|
54
|
+
auto screenStackHeaderSubview = parent.as<ScreenStackHeaderSubview>();
|
|
55
|
+
if (!screenStackHeaderSubview)
|
|
56
|
+
return;
|
|
57
|
+
|
|
58
|
+
screenStackHeaderSubview->removeChildAt(index);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void ScreenStackHeaderSubviewViewManager::ReplaceChild(
|
|
62
|
+
FrameworkElement parent,
|
|
63
|
+
UIElement oldChild,
|
|
64
|
+
UIElement newChild) {
|
|
65
|
+
auto screenStackHeaderSubview = parent.as<ScreenStackHeaderSubview>();
|
|
66
|
+
if (!screenStackHeaderSubview)
|
|
67
|
+
return;
|
|
68
|
+
|
|
69
|
+
screenStackHeaderSubview->replaceChild(oldChild, newChild);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// IViewManagerWithNativeProperties
|
|
73
|
+
IMapView<hstring, ViewManagerPropertyType>
|
|
74
|
+
ScreenStackHeaderSubviewViewManager::NativeProps() noexcept {
|
|
75
|
+
auto nativeProps =
|
|
76
|
+
winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
|
|
77
|
+
return nativeProps.GetView();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
void ScreenStackHeaderSubviewViewManager::UpdateProperties(
|
|
81
|
+
FrameworkElement const &view,
|
|
82
|
+
IJSValueReader const &propertyMapReader) noexcept {
|
|
83
|
+
(void)view;
|
|
84
|
+
const JSValueObject &propertyMap = JSValue::ReadObjectFrom(propertyMapReader);
|
|
85
|
+
for (auto const &pair : propertyMap) {
|
|
86
|
+
auto const &propertyName = pair.first;
|
|
87
|
+
auto const &propertyValue = pair.second;
|
|
88
|
+
(void)propertyName;
|
|
89
|
+
(void)propertyValue;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// IViewManagerWithCommands
|
|
94
|
+
IVectorView<hstring> ScreenStackHeaderSubviewViewManager::Commands() noexcept {
|
|
95
|
+
auto commands = winrt::single_threaded_vector<hstring>();
|
|
96
|
+
return commands.GetView();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
void ScreenStackHeaderSubviewViewManager::DispatchCommand(
|
|
100
|
+
FrameworkElement const &view,
|
|
101
|
+
winrt::hstring const &commandId,
|
|
102
|
+
winrt::IJSValueReader const &commandArgsReader) noexcept {
|
|
103
|
+
(void)view;
|
|
104
|
+
(void)commandId;
|
|
105
|
+
(void)commandArgsReader;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
// IViewManagerWithExportedEventTypeConstants
|
|
110
|
+
ConstantProviderDelegate ScreenStackHeaderSubviewViewManager::
|
|
111
|
+
ExportedCustomBubblingEventTypeConstants() noexcept {
|
|
112
|
+
return nullptr;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
ConstantProviderDelegate ScreenStackHeaderSubviewViewManager::
|
|
116
|
+
ExportedCustomDirectEventTypeConstants() noexcept {
|
|
117
|
+
return nullptr;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// IViewManagerWithReactContext
|
|
121
|
+
winrt::IReactContext ScreenStackHeaderSubviewViewManager::ReactContext() noexcept {
|
|
122
|
+
return m_reactContext;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
void ScreenStackHeaderSubviewViewManager::ReactContext(IReactContext reactContext) noexcept {
|
|
126
|
+
m_reactContext = reactContext;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "NativeModules.h"
|
|
4
|
+
#include "winrt/Microsoft.ReactNative.h"
|
|
5
|
+
|
|
6
|
+
namespace winrt::RNScreens::implementation {
|
|
7
|
+
class ScreenStackHeaderSubviewViewManager
|
|
8
|
+
: public winrt::implements<
|
|
9
|
+
ScreenStackHeaderSubviewViewManager,
|
|
10
|
+
winrt::Microsoft::ReactNative::IViewManager,
|
|
11
|
+
winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties,
|
|
12
|
+
winrt::Microsoft::ReactNative::IViewManagerWithCommands,
|
|
13
|
+
winrt::Microsoft::ReactNative::IViewManagerWithChildren,
|
|
14
|
+
winrt::Microsoft::ReactNative::IViewManagerWithExportedEventTypeConstants,
|
|
15
|
+
winrt::Microsoft::ReactNative::IViewManagerRequiresNativeLayout,
|
|
16
|
+
winrt::Microsoft::ReactNative::IViewManagerWithReactContext> {
|
|
17
|
+
public:
|
|
18
|
+
ScreenStackHeaderSubviewViewManager() = default;
|
|
19
|
+
|
|
20
|
+
// IViewManager
|
|
21
|
+
winrt::hstring Name() noexcept;
|
|
22
|
+
winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
|
|
23
|
+
|
|
24
|
+
// IViewManagerRequiresNativeLayout
|
|
25
|
+
bool RequiresNativeLayout();
|
|
26
|
+
|
|
27
|
+
// IViewManagerWithChildren
|
|
28
|
+
void AddView(
|
|
29
|
+
winrt::Windows::UI::Xaml::FrameworkElement parent,
|
|
30
|
+
winrt::Windows::UI::Xaml::UIElement child,
|
|
31
|
+
int64_t index);
|
|
32
|
+
void RemoveAllChildren(winrt::Windows::UI::Xaml::FrameworkElement parent);
|
|
33
|
+
void RemoveChildAt(
|
|
34
|
+
winrt::Windows::UI::Xaml::FrameworkElement parent,
|
|
35
|
+
int64_t index);
|
|
36
|
+
void ReplaceChild(
|
|
37
|
+
winrt::Windows::UI::Xaml::FrameworkElement parent,
|
|
38
|
+
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
39
|
+
winrt::Windows::UI::Xaml::UIElement newChild);
|
|
40
|
+
|
|
41
|
+
// IViewManagerWithNativeProperties
|
|
42
|
+
winrt::Windows::Foundation::Collections::IMapView<
|
|
43
|
+
winrt::hstring,
|
|
44
|
+
winrt::Microsoft::ReactNative::ViewManagerPropertyType>
|
|
45
|
+
NativeProps() noexcept;
|
|
46
|
+
|
|
47
|
+
void UpdateProperties(
|
|
48
|
+
winrt::Windows::UI::Xaml::FrameworkElement const &view,
|
|
49
|
+
winrt::Microsoft::ReactNative::IJSValueReader const
|
|
50
|
+
&propertyMapReader) noexcept;
|
|
51
|
+
|
|
52
|
+
// IViewManagerWithExportedEventTypeConstants
|
|
53
|
+
winrt::Microsoft::ReactNative::ConstantProviderDelegate
|
|
54
|
+
ExportedCustomBubblingEventTypeConstants() noexcept;
|
|
55
|
+
winrt::Microsoft::ReactNative::ConstantProviderDelegate
|
|
56
|
+
ExportedCustomDirectEventTypeConstants() noexcept;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// IViewManagerWithCommands
|
|
60
|
+
winrt::Windows::Foundation::Collections::IVectorView<winrt::hstring>
|
|
61
|
+
Commands() noexcept;
|
|
62
|
+
|
|
63
|
+
void DispatchCommand(
|
|
64
|
+
winrt::Windows::UI::Xaml::FrameworkElement const &view,
|
|
65
|
+
winrt::hstring const &commandId,
|
|
66
|
+
winrt::Microsoft::ReactNative::IJSValueReader const
|
|
67
|
+
&commandArgsReader) noexcept;
|
|
68
|
+
|
|
69
|
+
// IViewManagerWithReactContext
|
|
70
|
+
winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
|
|
71
|
+
void ReactContext(
|
|
72
|
+
winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
|
|
73
|
+
|
|
74
|
+
private:
|
|
75
|
+
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
|
76
|
+
};
|
|
77
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -98,22 +98,51 @@ ScreenViewManager::NativeProps() noexcept {
|
|
|
98
98
|
void ScreenViewManager::UpdateProperties(
|
|
99
99
|
FrameworkElement const &view,
|
|
100
100
|
IJSValueReader const &propertyMapReader) noexcept {
|
|
101
|
-
(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
(
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
if (auto screen = view.try_as<Screen>()) {
|
|
102
|
+
const JSValueObject &propertyMap = JSValue::ReadObjectFrom(propertyMapReader);
|
|
103
|
+
for (auto const &pair : propertyMap) {
|
|
104
|
+
auto const &propertyName = pair.first;
|
|
105
|
+
auto const &propertyValue = pair.second;
|
|
106
|
+
if (propertyName == "stackAnimation") {
|
|
107
|
+
if (propertyValue.IsNull() ||
|
|
108
|
+
propertyValue.AsString() == "default" ||
|
|
109
|
+
propertyValue.AsString() == "flip" ||
|
|
110
|
+
propertyValue.AsString() == "simple_push") {
|
|
111
|
+
screen->SetStackAnimation(winrt::RNScreens::implementation::StackAnimation::DEFAULT);
|
|
112
|
+
} else if (propertyValue.AsString() == "none") {
|
|
113
|
+
screen->SetStackAnimation(StackAnimation::NONE);
|
|
114
|
+
} else if (propertyValue.AsString() == "fade") {
|
|
115
|
+
screen->SetStackAnimation(StackAnimation::FADE);
|
|
116
|
+
} else if (propertyValue.AsString() == "slide_from_right") {
|
|
117
|
+
screen->SetStackAnimation(StackAnimation::SLIDE_FROM_RIGHT);
|
|
118
|
+
} else if (propertyValue.AsString() == "slide_from_left") {
|
|
119
|
+
screen->SetStackAnimation(StackAnimation::SLIDE_FROM_LEFT);
|
|
120
|
+
} else if (propertyValue.AsString() == "slide_from_bottom") {
|
|
121
|
+
screen->SetStackAnimation(StackAnimation::SLIDE_FROM_BOTTOM);
|
|
122
|
+
} else if (propertyValue.AsString() == "fade_from_bottom") {
|
|
123
|
+
screen->SetStackAnimation(StackAnimation::FADE_FROM_BOTTOM);
|
|
124
|
+
} else if (propertyValue.AsString() == "ios_from_right") {
|
|
125
|
+
screen->SetStackAnimation(StackAnimation::IOS_FROM_RIGHT);
|
|
126
|
+
} else if (propertyValue.AsString() == "ios_from_left") {
|
|
127
|
+
screen->SetStackAnimation(StackAnimation::IOS_FROM_LEFT);
|
|
128
|
+
} else {
|
|
129
|
+
std::string error = "Unknown animation type: ";
|
|
130
|
+
error += propertyValue.AsString();
|
|
131
|
+
throw std::runtime_error(error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (propertyValue != nullptr) {
|
|
135
|
+
if (propertyName == "replaceAnimation") {
|
|
136
|
+
auto const &value = propertyValue.AsString();
|
|
137
|
+
// TODO: Implement this for Windows
|
|
138
|
+
(void)value;
|
|
139
|
+
} else if (propertyName == "stackPresentation") {
|
|
140
|
+
auto const &value = propertyValue.AsString();
|
|
141
|
+
// TODO: Implement this for Windows
|
|
142
|
+
(void)value;
|
|
143
|
+
} else {
|
|
144
|
+
OutputDebugStringA("Unknown property in ScreenViewManager\n");
|
|
145
|
+
}
|
|
117
146
|
}
|
|
118
147
|
}
|
|
119
148
|
}
|
|
@@ -20,7 +20,7 @@ class ScreenViewManager
|
|
|
20
20
|
ScreenViewManager() = default;
|
|
21
21
|
|
|
22
22
|
// IViewManager
|
|
23
|
-
winrt::hstring Name() noexcept;
|
|
23
|
+
virtual winrt::hstring Name() noexcept;
|
|
24
24
|
winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
|
|
25
25
|
|
|
26
26
|
// IViewManagerRequiresNativeLayout
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "SearchBar.h"
|
|
3
|
+
#include "JSValueXaml.h"
|
|
4
|
+
#include "NativeModules.h"
|
|
5
|
+
|
|
6
|
+
namespace winrt {
|
|
7
|
+
using namespace Microsoft::ReactNative;
|
|
8
|
+
using namespace Windows::Foundation;
|
|
9
|
+
using namespace Windows::Foundation::Collections;
|
|
10
|
+
using namespace Windows::UI;
|
|
11
|
+
using namespace Windows::UI::Xaml;
|
|
12
|
+
using namespace Windows::UI::Xaml::Controls;
|
|
13
|
+
} // namespace winrt
|
|
14
|
+
|
|
15
|
+
namespace winrt::RNScreens::implementation {
|
|
16
|
+
SearchBar::SearchBar(
|
|
17
|
+
winrt::Microsoft::ReactNative::IReactContext reactContext)
|
|
18
|
+
: m_reactContext(reactContext) {}
|
|
19
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
namespace winrt::RNScreens::implementation {
|
|
4
|
+
class SearchBar
|
|
5
|
+
: public winrt::Windows::UI::Xaml::Controls::StackPanelT<
|
|
6
|
+
SearchBar> {
|
|
7
|
+
public:
|
|
8
|
+
SearchBar(
|
|
9
|
+
winrt::Microsoft::ReactNative::IReactContext reactContext);
|
|
10
|
+
|
|
11
|
+
private:
|
|
12
|
+
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
|
13
|
+
};
|
|
14
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "SearchBarViewManager.h"
|
|
3
|
+
#include "SearchBar.h"
|
|
4
|
+
#include "JSValueXaml.h"
|
|
5
|
+
#include "NativeModules.h"
|
|
6
|
+
|
|
7
|
+
namespace winrt {
|
|
8
|
+
using namespace Microsoft::ReactNative;
|
|
9
|
+
using namespace Windows::Foundation;
|
|
10
|
+
using namespace Windows::Foundation::Collections;
|
|
11
|
+
using namespace Windows::UI;
|
|
12
|
+
using namespace Windows::UI::Xaml;
|
|
13
|
+
using namespace Windows::UI::Xaml::Controls;
|
|
14
|
+
} // namespace winrt
|
|
15
|
+
|
|
16
|
+
namespace winrt::RNScreens::implementation {
|
|
17
|
+
// IViewManager
|
|
18
|
+
winrt::hstring SearchBarViewManager::Name() noexcept {
|
|
19
|
+
return L"RNSSearchBar";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
winrt::FrameworkElement SearchBarViewManager::CreateView() noexcept {
|
|
23
|
+
return winrt::make<winrt::RNScreens::implementation::SearchBar>(m_reactContext);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// IViewManagerRequiresNativeLayout
|
|
27
|
+
bool SearchBarViewManager::RequiresNativeLayout() {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// IViewManagerWithNativeProperties
|
|
32
|
+
IMapView<hstring, ViewManagerPropertyType>
|
|
33
|
+
SearchBarViewManager::NativeProps() noexcept {
|
|
34
|
+
auto nativeProps =
|
|
35
|
+
winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
|
|
36
|
+
return nativeProps.GetView();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void SearchBarViewManager::UpdateProperties(
|
|
40
|
+
FrameworkElement const &view,
|
|
41
|
+
IJSValueReader const &propertyMapReader) noexcept {
|
|
42
|
+
(void)view;
|
|
43
|
+
const JSValueObject &propertyMap = JSValue::ReadObjectFrom(propertyMapReader);
|
|
44
|
+
for (auto const &pair : propertyMap) {
|
|
45
|
+
auto const &propertyName = pair.first;
|
|
46
|
+
auto const &propertyValue = pair.second;
|
|
47
|
+
(void)propertyName;
|
|
48
|
+
(void)propertyValue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// IViewManagerWithCommands
|
|
53
|
+
IVectorView<hstring> SearchBarViewManager::Commands() noexcept {
|
|
54
|
+
auto commands = winrt::single_threaded_vector<hstring>();
|
|
55
|
+
return commands.GetView();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void SearchBarViewManager::DispatchCommand(
|
|
59
|
+
FrameworkElement const &view,
|
|
60
|
+
winrt::hstring const &commandId,
|
|
61
|
+
winrt::IJSValueReader const &commandArgsReader) noexcept {
|
|
62
|
+
(void)view;
|
|
63
|
+
(void)commandId;
|
|
64
|
+
(void)commandArgsReader;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// IViewManagerWithExportedEventTypeConstants
|
|
69
|
+
ConstantProviderDelegate SearchBarViewManager::
|
|
70
|
+
ExportedCustomBubblingEventTypeConstants() noexcept {
|
|
71
|
+
return nullptr;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ConstantProviderDelegate SearchBarViewManager::
|
|
75
|
+
ExportedCustomDirectEventTypeConstants() noexcept {
|
|
76
|
+
return nullptr;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// IViewManagerWithReactContext
|
|
80
|
+
winrt::IReactContext SearchBarViewManager::ReactContext() noexcept {
|
|
81
|
+
return m_reactContext;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
void SearchBarViewManager::ReactContext(IReactContext reactContext) noexcept {
|
|
85
|
+
m_reactContext = reactContext;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "NativeModules.h"
|
|
4
|
+
#include "winrt/Microsoft.ReactNative.h"
|
|
5
|
+
|
|
6
|
+
namespace winrt::RNScreens::implementation {
|
|
7
|
+
class SearchBarViewManager
|
|
8
|
+
: public winrt::implements<
|
|
9
|
+
SearchBarViewManager,
|
|
10
|
+
winrt::Microsoft::ReactNative::IViewManager,
|
|
11
|
+
winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties,
|
|
12
|
+
winrt::Microsoft::ReactNative::IViewManagerWithCommands,
|
|
13
|
+
winrt::Microsoft::ReactNative::IViewManagerWithExportedEventTypeConstants,
|
|
14
|
+
winrt::Microsoft::ReactNative::IViewManagerRequiresNativeLayout,
|
|
15
|
+
winrt::Microsoft::ReactNative::IViewManagerWithReactContext> {
|
|
16
|
+
public:
|
|
17
|
+
SearchBarViewManager() = default;
|
|
18
|
+
|
|
19
|
+
// IViewManager
|
|
20
|
+
winrt::hstring Name() noexcept;
|
|
21
|
+
winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
|
|
22
|
+
|
|
23
|
+
// IViewManagerRequiresNativeLayout
|
|
24
|
+
bool RequiresNativeLayout();
|
|
25
|
+
|
|
26
|
+
// IViewManagerWithNativeProperties
|
|
27
|
+
winrt::Windows::Foundation::Collections::IMapView<
|
|
28
|
+
winrt::hstring,
|
|
29
|
+
winrt::Microsoft::ReactNative::ViewManagerPropertyType>
|
|
30
|
+
NativeProps() noexcept;
|
|
31
|
+
|
|
32
|
+
void UpdateProperties(
|
|
33
|
+
winrt::Windows::UI::Xaml::FrameworkElement const &view,
|
|
34
|
+
winrt::Microsoft::ReactNative::IJSValueReader const
|
|
35
|
+
&propertyMapReader) noexcept;
|
|
36
|
+
|
|
37
|
+
// IViewManagerWithExportedEventTypeConstants
|
|
38
|
+
winrt::Microsoft::ReactNative::ConstantProviderDelegate
|
|
39
|
+
ExportedCustomBubblingEventTypeConstants() noexcept;
|
|
40
|
+
winrt::Microsoft::ReactNative::ConstantProviderDelegate
|
|
41
|
+
ExportedCustomDirectEventTypeConstants() noexcept;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// IViewManagerWithCommands
|
|
45
|
+
winrt::Windows::Foundation::Collections::IVectorView<winrt::hstring>
|
|
46
|
+
Commands() noexcept;
|
|
47
|
+
|
|
48
|
+
void DispatchCommand(
|
|
49
|
+
winrt::Windows::UI::Xaml::FrameworkElement const &view,
|
|
50
|
+
winrt::hstring const &commandId,
|
|
51
|
+
winrt::Microsoft::ReactNative::IJSValueReader const
|
|
52
|
+
&commandArgsReader) noexcept;
|
|
53
|
+
|
|
54
|
+
// IViewManagerWithReactContext
|
|
55
|
+
winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
|
|
56
|
+
void ReactContext(
|
|
57
|
+
winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
|
61
|
+
};
|
|
62
|
+
} // namespace winrt::RNScreens::implementation
|