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
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
package com.swmansion.rnscreens.stack.views
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.view.WindowInsets
|
|
5
|
+
import android.view.animation.Animation
|
|
6
|
+
import android.view.animation.AnimationSet
|
|
7
|
+
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
8
|
+
import com.facebook.react.uimanager.ReactPointerEventsView
|
|
9
|
+
import com.swmansion.rnscreens.PointerEventsBoxNoneImpl
|
|
10
|
+
import com.swmansion.rnscreens.ScreenStackFragment
|
|
11
|
+
import com.swmansion.rnscreens.bottomsheet.usesFormSheetPresentation
|
|
12
|
+
import com.swmansion.rnscreens.stack.anim.ScreensAnimation
|
|
13
|
+
|
|
14
|
+
internal class ScreensCoordinatorLayout(
|
|
15
|
+
context: Context,
|
|
16
|
+
internal val fragment: ScreenStackFragment,
|
|
17
|
+
private val pointerEventsImpl: ReactPointerEventsView,
|
|
18
|
+
) : CoordinatorLayout(context),
|
|
19
|
+
ReactPointerEventsView by pointerEventsImpl {
|
|
20
|
+
constructor(context: Context, fragment: ScreenStackFragment) : this(
|
|
21
|
+
context,
|
|
22
|
+
fragment,
|
|
23
|
+
PointerEventsBoxNoneImpl(),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets = super.onApplyWindowInsets(insets)
|
|
27
|
+
|
|
28
|
+
private val animationListener: Animation.AnimationListener =
|
|
29
|
+
object : Animation.AnimationListener {
|
|
30
|
+
override fun onAnimationStart(animation: Animation) {
|
|
31
|
+
fragment.onViewAnimationStart()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun onAnimationEnd(animation: Animation) {
|
|
35
|
+
fragment.onViewAnimationEnd()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun onAnimationRepeat(animation: Animation) {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun startAnimation(animation: Animation) {
|
|
42
|
+
// For some reason View##onAnimationEnd doesn't get called for
|
|
43
|
+
// exit transitions so we explicitly attach animation listener.
|
|
44
|
+
// We also have some animations that are an AnimationSet, so we don't wrap them
|
|
45
|
+
// in another set since it causes some visual glitches when going forward.
|
|
46
|
+
// We also set the listener only when going forward, since when going back,
|
|
47
|
+
// there is already a listener for dismiss action added, which would be overridden
|
|
48
|
+
// and also this is not necessary when going back since the lifecycle methods
|
|
49
|
+
// are correctly dispatched then.
|
|
50
|
+
// We also add fakeAnimation to the set of animations, which sends the progress of animation
|
|
51
|
+
val fakeAnimation = ScreensAnimation(fragment).apply { duration = animation.duration }
|
|
52
|
+
|
|
53
|
+
if (animation is AnimationSet && !fragment.isRemoving) {
|
|
54
|
+
animation
|
|
55
|
+
.apply {
|
|
56
|
+
addAnimation(fakeAnimation)
|
|
57
|
+
setAnimationListener(animationListener)
|
|
58
|
+
}.also {
|
|
59
|
+
super.startAnimation(it)
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
AnimationSet(true)
|
|
63
|
+
.apply {
|
|
64
|
+
addAnimation(animation)
|
|
65
|
+
addAnimation(fakeAnimation)
|
|
66
|
+
setAnimationListener(animationListener)
|
|
67
|
+
}.also {
|
|
68
|
+
super.startAnimation(it)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* This method implements a workaround for RN's autoFocus functionality. Because of the way
|
|
75
|
+
* autoFocus is implemented it dismisses soft keyboard in fragment transition
|
|
76
|
+
* due to change of visibility of the view at the start of the transition. Here we override the
|
|
77
|
+
* call to `clearFocus` when the visibility of view is `INVISIBLE` since `clearFocus` triggers the
|
|
78
|
+
* hiding of the keyboard in `ReactEditText.java`.
|
|
79
|
+
*/
|
|
80
|
+
override fun clearFocus() {
|
|
81
|
+
if (visibility != INVISIBLE) {
|
|
82
|
+
super.clearFocus()
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
override fun onLayout(
|
|
87
|
+
changed: Boolean,
|
|
88
|
+
l: Int,
|
|
89
|
+
t: Int,
|
|
90
|
+
r: Int,
|
|
91
|
+
b: Int,
|
|
92
|
+
) {
|
|
93
|
+
super.onLayout(changed, l, t, r, b)
|
|
94
|
+
|
|
95
|
+
if (fragment.screen.usesFormSheetPresentation()) {
|
|
96
|
+
fragment.screen.onBottomSheetBehaviorDidLayout(changed)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const ScreenContentWrapper = _reactNative.View;
|
|
9
|
+
var _default = exports.default = ScreenContentWrapper;
|
|
10
|
+
//# sourceMappingURL=ScreenContentWrapper.windows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","ScreenContentWrapper","View","_default","exports","default"],"sourceRoot":"../../../src","sources":["components/ScreenContentWrapper.windows.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,oBAAoB,GAAGC,iBAAI;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEnBJ,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.FooterComponent = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const ScreenFooter = _reactNative.View;
|
|
9
|
+
const FooterComponent = exports.FooterComponent = _reactNative.View;
|
|
10
|
+
var _default = exports.default = ScreenFooter;
|
|
11
|
+
//# sourceMappingURL=ScreenFooter.windows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","ScreenFooter","View","FooterComponent","exports","_default","default"],"sourceRoot":"../../../src","sources":["components/ScreenFooter.windows.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,YAAY,GAAGC,iBAAI;AACzB,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGD,iBAAI;AAAC,IAAAG,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEdL,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","ScreenContentWrapper"],"sourceRoot":"../../../src","sources":["components/ScreenContentWrapper.windows.tsx"],"mappings":"AAAA,SAASA,IAAI,QAAQ,cAAc;AAEnC,MAAMC,oBAAoB,GAAGD,IAAI;AAEjC,eAAeC,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","ScreenFooter","FooterComponent"],"sourceRoot":"../../../src","sources":["components/ScreenFooter.windows.tsx"],"mappings":"AAAA,SAASA,IAAI,QAAQ,cAAc;AAEnC,MAAMC,YAAY,GAAGD,IAAI;AACzB,MAAME,eAAe,GAAGF,IAAI;AAE5B,eAAeC,YAAY;AAC3B,SAASC,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenContentWrapper.windows.d.ts","sourceRoot":"","sources":["../../../src/components/ScreenContentWrapper.windows.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,QAAA,MAAM,oBAAoB,aAAO,CAAC;AAElC,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenFooter.windows.d.ts","sourceRoot":"","sources":["../../../src/components/ScreenFooter.windows.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,QAAA,MAAM,YAAY,aAAO,CAAC;AAC1B,QAAA,MAAM,eAAe,aAAO,CAAC;AAE7B,eAAe,YAAY,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screens",
|
|
3
|
-
"version": "4.11.0-beta.
|
|
3
|
+
"version": "4.11.0-beta.1",
|
|
4
4
|
"description": "Native navigation primitives for your React Native app.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"submodules": "git submodule update --init --recursive && (cd react-navigation && yarn && yarn build && cd ../)",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "ModalScreenViewManager.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
|
+
// IViewManager
|
|
17
|
+
winrt::hstring ModalScreenViewManager::Name() noexcept {
|
|
18
|
+
return L"RNSModalScreen";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "NativeModules.h"
|
|
3
|
+
#include "winrt/Microsoft.ReactNative.h"
|
|
4
|
+
#include "ScreenViewManager.h"
|
|
5
|
+
|
|
6
|
+
namespace winrt::RNScreens::implementation {
|
|
7
|
+
|
|
8
|
+
class ModalScreenViewManager : public ScreenViewManager {
|
|
9
|
+
public:
|
|
10
|
+
ModalScreenViewManager() = default;
|
|
11
|
+
winrt::hstring Name() noexcept;
|
|
12
|
+
};
|
|
13
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.WindowsSdk.Default.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.WindowsSdk.Default.props')" />
|
|
21
21
|
<PropertyGroup Label="Fallback Windows SDK Versions">
|
|
22
22
|
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
|
|
23
|
-
<WindowsTargetPlatformMinVersion Condition=" '$(WindowsTargetPlatformMinVersion)' == '' ">10.0.
|
|
23
|
+
<WindowsTargetPlatformMinVersion Condition=" '$(WindowsTargetPlatformMinVersion)' == '' ">10.0.17763.0</WindowsTargetPlatformMinVersion>
|
|
24
24
|
</PropertyGroup>
|
|
25
25
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
26
26
|
<ItemGroup Label="ProjectConfigurations">
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
<ClInclude Include="ScreenContainerViewManager.h" />
|
|
123
123
|
<ClInclude Include="ScreenStack.h" />
|
|
124
124
|
<ClInclude Include="ScreenStackHeaderConfigViewManager.h" />
|
|
125
|
+
<ClInclude Include="ScreenStackHeaderSubviewViewManager.h" />
|
|
126
|
+
<ClInclude Include="SearchBarViewManager.h" />
|
|
127
|
+
<ClInclude Include="ModalScreenViewManager.h" />
|
|
125
128
|
<ClInclude Include="ScreenViewManager.h" />
|
|
126
129
|
<ClInclude Include="RNScreens.h">
|
|
127
130
|
<DependentUpon>RNScreens.idl</DependentUpon>
|
|
@@ -133,6 +136,8 @@
|
|
|
133
136
|
<DependentUpon>RNScreens.idl</DependentUpon>
|
|
134
137
|
</ClCompile>
|
|
135
138
|
<ClInclude Include="ScreenStackHeaderConfig.h" />
|
|
139
|
+
<ClInclude Include="ScreenStackHeaderSubview.h" />
|
|
140
|
+
<ClInclude Include="SearchBar.h" />
|
|
136
141
|
<ClInclude Include="ScreenStackViewManager.h" />
|
|
137
142
|
</ItemGroup>
|
|
138
143
|
<ItemGroup>
|
|
@@ -144,12 +149,17 @@
|
|
|
144
149
|
<ClCompile Include="ScreenContainerViewManager.cpp" />
|
|
145
150
|
<ClCompile Include="ScreenStack.cpp" />
|
|
146
151
|
<ClCompile Include="ScreenStackHeaderConfigViewManager.cpp" />
|
|
152
|
+
<ClCompile Include="ScreenStackHeaderSubviewViewManager.cpp" />
|
|
153
|
+
<ClCompile Include="SearchBarViewManager.cpp" />
|
|
154
|
+
<ClCompile Include="ModalScreenViewManager.cpp" />
|
|
147
155
|
<ClCompile Include="ScreenViewManager.cpp" />
|
|
148
156
|
<ClCompile Include="ReactPackageProvider.cpp">
|
|
149
157
|
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
|
|
150
158
|
</ClCompile>
|
|
151
159
|
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
|
152
160
|
<ClCompile Include="ScreenStackHeaderConfig.cpp" />
|
|
161
|
+
<ClCompile Include="ScreenStackHeaderSubview.cpp" />
|
|
162
|
+
<ClCompile Include="SearchBar.cpp" />
|
|
153
163
|
<ClCompile Include="ScreenStackViewManager.cpp" />
|
|
154
164
|
</ItemGroup>
|
|
155
165
|
<ItemGroup>
|
|
@@ -17,8 +17,13 @@
|
|
|
17
17
|
<ClCompile Include="RNScreens.cpp" />
|
|
18
18
|
<ClCompile Include="Screen.cpp" />
|
|
19
19
|
<ClCompile Include="ScreenStackHeaderConfigViewManager.cpp" />
|
|
20
|
+
<ClCompile Include="ScreenStackHeaderSubviewViewManager.cpp" />
|
|
21
|
+
<ClCompile Include="SearchBarViewManager.cpp" />
|
|
22
|
+
<ClCompile Include="ModalScreenViewManager.cpp" />
|
|
20
23
|
<ClCompile Include="ScreenViewManager.cpp" />
|
|
21
24
|
<ClCompile Include="ScreenStackHeaderConfig.cpp" />
|
|
25
|
+
<ClCompile Include="ScreenStackHeaderSubview.cpp" />
|
|
26
|
+
<ClCompile Include="SearchBar.cpp" />
|
|
22
27
|
<ClCompile Include="ScreenStackViewManager.cpp" />
|
|
23
28
|
<ClCompile Include="ScreenStack.cpp" />
|
|
24
29
|
<ClCompile Include="ScreenContainerViewManager.cpp" />
|
|
@@ -31,8 +36,13 @@
|
|
|
31
36
|
<ClInclude Include="RNScreens.h" />
|
|
32
37
|
<ClInclude Include="Screen.h" />
|
|
33
38
|
<ClInclude Include="ScreenStackHeaderConfigViewManager.h" />
|
|
39
|
+
<ClInclude Include="ScreenStackHeaderSubviewViewManager.h" />
|
|
40
|
+
<ClInclude Include="SearchBarViewManager.h" />
|
|
41
|
+
<ClInclude Include="ModalScreenViewManager.h" />
|
|
34
42
|
<ClInclude Include="ScreenViewManager.h" />
|
|
35
43
|
<ClInclude Include="ScreenStackHeaderConfig.h" />
|
|
44
|
+
<ClInclude Include="ScreenStackHeaderSubview.h" />
|
|
45
|
+
<ClInclude Include="SearchBar.h" />
|
|
36
46
|
<ClInclude Include="ScreenStackViewManager.h" />
|
|
37
47
|
<ClInclude Include="ScreenStack.h" />
|
|
38
48
|
<ClInclude Include="ScreenContainer.h" />
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
#include "ScreenStackHeaderConfigViewManager.h"
|
|
9
9
|
#include "ScreenStackViewManager.h"
|
|
10
10
|
#include "ScreenViewManager.h"
|
|
11
|
+
#include "ScreenStackHeaderSubviewViewManager.h"
|
|
12
|
+
#include "ModalScreenViewManager.h"
|
|
13
|
+
#include "SearchBarViewManager.h"
|
|
11
14
|
|
|
12
15
|
using namespace winrt::Microsoft::ReactNative;
|
|
13
16
|
|
|
@@ -17,14 +20,29 @@ void ReactPackageProvider::CreatePackage(
|
|
|
17
20
|
packageBuilder.AddViewManager(L"RNScreensViewManager", []() {
|
|
18
21
|
return winrt::make<ScreenViewManager>();
|
|
19
22
|
});
|
|
23
|
+
|
|
20
24
|
packageBuilder.AddViewManager(L"RNScreensStackHeaderConfigViewManager", []() {
|
|
21
25
|
return winrt::make<ScreenStackHeaderConfigViewManager>();
|
|
22
26
|
});
|
|
27
|
+
|
|
23
28
|
packageBuilder.AddViewManager(L"RNSScreenStackViewManager", []() {
|
|
24
29
|
return winrt::make<ScreenStackViewManager>();
|
|
25
30
|
});
|
|
31
|
+
|
|
26
32
|
packageBuilder.AddViewManager(L"RNSScreenContainerViewManager", []() {
|
|
27
33
|
return winrt::make<ScreenContainerViewManager>();
|
|
28
34
|
});
|
|
35
|
+
|
|
36
|
+
packageBuilder.AddViewManager(L"RNSScreenStackHeaderSubviewViewManager", [] () {
|
|
37
|
+
return winrt::make<ScreenStackHeaderSubviewViewManager>();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
packageBuilder.AddViewManager(L"RNSModalScreenViewManager", [] () {
|
|
41
|
+
return winrt::make<ModalScreenViewManager>();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
packageBuilder.AddViewManager(L"RNSSearchBar", [] () {
|
|
45
|
+
return winrt::make<SearchBarViewManager>();
|
|
46
|
+
});
|
|
29
47
|
}
|
|
30
48
|
} // namespace winrt::RNScreens::implementation
|
|
@@ -1,122 +1,128 @@
|
|
|
1
|
-
#include "pch.h"
|
|
2
|
-
#include "Screen.h"
|
|
3
|
-
#include "JSValueXaml.h"
|
|
4
|
-
#include "NativeModules.h"
|
|
5
|
-
|
|
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
|
-
Screen::Screen(winrt::Microsoft::ReactNative::IReactContext reactContext)
|
|
18
|
-
: m_reactContext(reactContext) {
|
|
19
|
-
onLoadingRevoker = Loading({this, &Screen::onLoading});
|
|
20
|
-
onLoadedRevoker = Loaded({this, &Screen::onLoaded});
|
|
21
|
-
onUnloadedRevoker = Unloaded({this, &Screen::onUnloaded});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
Screen::~Screen() {
|
|
25
|
-
Loading(onLoadingRevoker);
|
|
26
|
-
Loaded(onLoadedRevoker);
|
|
27
|
-
Unloaded(onUnloadedRevoker);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
void Screen::addView(winrt::Windows::UI::Xaml::UIElement element) {
|
|
31
|
-
Children().Append(element);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
void Screen::removeAllChildren() {
|
|
35
|
-
Children().Clear();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
void Screen::removeChildAt(int64_t index) {
|
|
39
|
-
Children().RemoveAt(static_cast<uint32_t>(index));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
void Screen::replaceChild(
|
|
43
|
-
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
44
|
-
winrt::Windows::UI::Xaml::UIElement newChild) {
|
|
45
|
-
uint32_t index;
|
|
46
|
-
if (!Children().IndexOf(oldChild, index))
|
|
47
|
-
return;
|
|
48
|
-
|
|
49
|
-
Children().SetAt(index, newChild);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
void Screen::onLoading(
|
|
53
|
-
winrt::Windows::UI::Xaml::FrameworkElement const &sender,
|
|
54
|
-
winrt::Windows::Foundation::IInspectable const &) {
|
|
55
|
-
auto screen = sender.try_as<Screen>();
|
|
56
|
-
if (!screen)
|
|
57
|
-
return;
|
|
58
|
-
|
|
59
|
-
screen->dispatchOnWillAppear();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
void Screen::onLoaded(
|
|
63
|
-
winrt::Windows::Foundation::IInspectable const &sender,
|
|
64
|
-
winrt::Windows::UI::Xaml::RoutedEventArgs const &) {
|
|
65
|
-
auto screen = sender.try_as<Screen>();
|
|
66
|
-
if (!screen)
|
|
67
|
-
return;
|
|
68
|
-
|
|
69
|
-
screen->dispatchOnAppear();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
void Screen::onUnloaded(
|
|
73
|
-
winrt::Windows::Foundation::IInspectable const &sender,
|
|
74
|
-
winrt::Windows::UI::Xaml::RoutedEventArgs const &) {
|
|
75
|
-
auto screen = sender.try_as<Screen>();
|
|
76
|
-
if (!screen)
|
|
77
|
-
return;
|
|
78
|
-
|
|
79
|
-
screen->dispatchOnWillDisappear();
|
|
80
|
-
screen->dispatchOnDisappear();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
void Screen::dispatchOnWillAppear() {
|
|
84
|
-
m_reactContext.DispatchEvent(
|
|
85
|
-
*this,
|
|
86
|
-
L"topWillAppear",
|
|
87
|
-
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
88
|
-
eventDataWriter.WriteObjectBegin();
|
|
89
|
-
eventDataWriter.WriteObjectEnd();
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
void Screen::dispatchOnWillDisappear() {
|
|
94
|
-
m_reactContext.DispatchEvent(
|
|
95
|
-
*this,
|
|
96
|
-
L"topWillDisappear",
|
|
97
|
-
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
98
|
-
eventDataWriter.WriteObjectBegin();
|
|
99
|
-
eventDataWriter.WriteObjectEnd();
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
void Screen::dispatchOnAppear() {
|
|
104
|
-
m_reactContext.DispatchEvent(
|
|
105
|
-
*this,
|
|
106
|
-
L"topAppear",
|
|
107
|
-
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
108
|
-
eventDataWriter.WriteObjectBegin();
|
|
109
|
-
eventDataWriter.WriteObjectEnd();
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
void Screen::dispatchOnDisappear() {
|
|
114
|
-
m_reactContext.DispatchEvent(
|
|
115
|
-
*this,
|
|
116
|
-
L"topDisappear",
|
|
117
|
-
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
118
|
-
eventDataWriter.WriteObjectBegin();
|
|
119
|
-
eventDataWriter.WriteObjectEnd();
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "Screen.h"
|
|
3
|
+
#include "JSValueXaml.h"
|
|
4
|
+
#include "NativeModules.h"
|
|
5
|
+
|
|
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
|
+
Screen::Screen(winrt::Microsoft::ReactNative::IReactContext reactContext)
|
|
18
|
+
: m_reactContext(reactContext) {
|
|
19
|
+
onLoadingRevoker = Loading({this, &Screen::onLoading});
|
|
20
|
+
onLoadedRevoker = Loaded({this, &Screen::onLoaded});
|
|
21
|
+
onUnloadedRevoker = Unloaded({this, &Screen::onUnloaded});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Screen::~Screen() {
|
|
25
|
+
Loading(onLoadingRevoker);
|
|
26
|
+
Loaded(onLoadedRevoker);
|
|
27
|
+
Unloaded(onUnloadedRevoker);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void Screen::addView(winrt::Windows::UI::Xaml::UIElement element) {
|
|
31
|
+
Children().Append(element);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void Screen::removeAllChildren() {
|
|
35
|
+
Children().Clear();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void Screen::removeChildAt(int64_t index) {
|
|
39
|
+
Children().RemoveAt(static_cast<uint32_t>(index));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void Screen::replaceChild(
|
|
43
|
+
winrt::Windows::UI::Xaml::UIElement oldChild,
|
|
44
|
+
winrt::Windows::UI::Xaml::UIElement newChild) {
|
|
45
|
+
uint32_t index;
|
|
46
|
+
if (!Children().IndexOf(oldChild, index))
|
|
47
|
+
return;
|
|
48
|
+
|
|
49
|
+
Children().SetAt(index, newChild);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void Screen::onLoading(
|
|
53
|
+
winrt::Windows::UI::Xaml::FrameworkElement const &sender,
|
|
54
|
+
winrt::Windows::Foundation::IInspectable const &) {
|
|
55
|
+
auto screen = sender.try_as<Screen>();
|
|
56
|
+
if (!screen)
|
|
57
|
+
return;
|
|
58
|
+
|
|
59
|
+
screen->dispatchOnWillAppear();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void Screen::onLoaded(
|
|
63
|
+
winrt::Windows::Foundation::IInspectable const &sender,
|
|
64
|
+
winrt::Windows::UI::Xaml::RoutedEventArgs const &) {
|
|
65
|
+
auto screen = sender.try_as<Screen>();
|
|
66
|
+
if (!screen)
|
|
67
|
+
return;
|
|
68
|
+
|
|
69
|
+
screen->dispatchOnAppear();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void Screen::onUnloaded(
|
|
73
|
+
winrt::Windows::Foundation::IInspectable const &sender,
|
|
74
|
+
winrt::Windows::UI::Xaml::RoutedEventArgs const &) {
|
|
75
|
+
auto screen = sender.try_as<Screen>();
|
|
76
|
+
if (!screen)
|
|
77
|
+
return;
|
|
78
|
+
|
|
79
|
+
screen->dispatchOnWillDisappear();
|
|
80
|
+
screen->dispatchOnDisappear();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
void Screen::dispatchOnWillAppear() {
|
|
84
|
+
m_reactContext.DispatchEvent(
|
|
85
|
+
*this,
|
|
86
|
+
L"topWillAppear",
|
|
87
|
+
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
88
|
+
eventDataWriter.WriteObjectBegin();
|
|
89
|
+
eventDataWriter.WriteObjectEnd();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
void Screen::dispatchOnWillDisappear() {
|
|
94
|
+
m_reactContext.DispatchEvent(
|
|
95
|
+
*this,
|
|
96
|
+
L"topWillDisappear",
|
|
97
|
+
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
98
|
+
eventDataWriter.WriteObjectBegin();
|
|
99
|
+
eventDataWriter.WriteObjectEnd();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
void Screen::dispatchOnAppear() {
|
|
104
|
+
m_reactContext.DispatchEvent(
|
|
105
|
+
*this,
|
|
106
|
+
L"topAppear",
|
|
107
|
+
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
108
|
+
eventDataWriter.WriteObjectBegin();
|
|
109
|
+
eventDataWriter.WriteObjectEnd();
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
void Screen::dispatchOnDisappear() {
|
|
114
|
+
m_reactContext.DispatchEvent(
|
|
115
|
+
*this,
|
|
116
|
+
L"topDisappear",
|
|
117
|
+
[&](winrt::IJSValueWriter const &eventDataWriter) noexcept {
|
|
118
|
+
eventDataWriter.WriteObjectBegin();
|
|
119
|
+
eventDataWriter.WriteObjectEnd();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
StackAnimation Screen::GetStackAnimation() const {
|
|
123
|
+
return stackAnimation;
|
|
124
|
+
}
|
|
125
|
+
void Screen::SetStackAnimation(StackAnimation const& animation) {
|
|
126
|
+
stackAnimation = animation;
|
|
127
|
+
}
|
|
128
|
+
} // namespace winrt::RNScreens::implementation
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
namespace winrt::RNScreens::implementation {
|
|
4
4
|
|
|
5
|
-
enum class StackPresentation { PUSH, MODAL, TRANSPARENT_MODAL };
|
|
5
|
+
enum class StackPresentation { PUSH, MODAL, TRANSPARENT_MODAL, FORM_SHEET };
|
|
6
6
|
|
|
7
7
|
enum class StackAnimation {
|
|
8
8
|
DEFAULT,
|
|
9
9
|
NONE,
|
|
10
10
|
FADE,
|
|
11
|
-
|
|
11
|
+
SLIDE_FROM_BOTTOM,
|
|
12
12
|
SLIDE_FROM_RIGHT,
|
|
13
13
|
SLIDE_FROM_LEFT,
|
|
14
|
+
FADE_FROM_BOTTOM,
|
|
14
15
|
IOS_FROM_RIGHT,
|
|
15
16
|
IOS_FROM_LEFT
|
|
16
17
|
};
|
|
@@ -59,8 +60,11 @@ class Screen : public winrt::Windows::UI::Xaml::Controls::StackPanelT<Screen> {
|
|
|
59
60
|
void dispatchOnDisappear();
|
|
60
61
|
void dispatchOnWillAppear();
|
|
61
62
|
void dispatchOnWillDisappear();
|
|
63
|
+
StackAnimation GetStackAnimation() const;
|
|
64
|
+
void SetStackAnimation(StackAnimation const& animation);
|
|
62
65
|
|
|
63
66
|
private:
|
|
64
67
|
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
|
68
|
+
StackAnimation stackAnimation;
|
|
65
69
|
};
|
|
66
70
|
} // namespace winrt::RNScreens::implementation
|