react-native-screens 4.11.0-beta.0 → 4.11.0-beta.2
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/RNScreens.podspec +3 -1
- 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/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +1 -2
- package/ios/RNSConvert.mm +44 -47
- package/ios/RNSFullWindowOverlay.h +2 -0
- package/ios/RNSFullWindowOverlay.mm +32 -8
- package/ios/RNSScreen.mm +20 -34
- package/ios/RNSScreenStack.mm +6 -8
- package/ios/RNSScreenStackHeaderConfig.mm +120 -223
- package/ios/RNSScreenWindowTraits.mm +19 -37
- package/ios/RNSSearchBar.mm +15 -24
- package/lib/commonjs/components/FullWindowOverlay.js +2 -1
- package/lib/commonjs/components/FullWindowOverlay.js.map +1 -1
- 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/commonjs/fabric/FullWindowOverlayNativeComponent.js +1 -0
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/module/components/FullWindowOverlay.js +2 -1
- package/lib/module/components/FullWindowOverlay.js.map +1 -1
- 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/module/fabric/FullWindowOverlayNativeComponent.js +3 -0
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/typescript/components/FullWindowOverlay.d.ts +4 -2
- package/lib/typescript/components/FullWindowOverlay.d.ts.map +1 -1
- 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/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts +3 -1
- package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +1 -1
- package/lib/typescript/types.d.ts +2 -2
- package/native-stack/README.md +2 -2
- package/package.json +1 -1
- package/src/components/FullWindowOverlay.tsx +14 -3
- package/src/components/ScreenContentWrapper.windows.tsx +5 -0
- package/src/components/ScreenFooter.windows.tsx +7 -0
- package/src/fabric/FullWindowOverlayNativeComponent.ts +5 -1
- package/src/native-stack/types.tsx +1 -1
- package/src/types.tsx +2 -2
- 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
|
@@ -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
|