react-native-windows 0.84.0-preview.5 → 0.84.0-preview.7
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/Libraries/Modal/Modal.windows.js +1 -7
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +58 -20
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +238 -57
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +18 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +14 -9
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +98 -44
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -2
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +3 -3
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.h +3 -1
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +0 -1
- package/Microsoft.ReactNative/Modules/Animated/AnimatedNode.cpp +3 -3
- package/Microsoft.ReactNative/Modules/Animated/AnimatedNode.h +3 -2
- package/Microsoft.ReactNative/Modules/Timing.h +2 -1
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/JSEngine.props +1 -1
- package/package.json +1 -1
|
@@ -41,13 +41,7 @@ export type PublicModalInstance = HostInstance;
|
|
|
41
41
|
const ModalEventEmitter =
|
|
42
42
|
(Platform.OS === 'ios' || Platform.OS === 'windows') && // [Windows]
|
|
43
43
|
NativeModalManager != null
|
|
44
|
-
? new NativeEventEmitter<ModalEventDefinitions>(
|
|
45
|
-
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
|
|
46
|
-
// If you want to use the native module on other platforms, please remove this condition and test its behavior
|
|
47
|
-
Platform.OS !== 'ios' && Platform.OS !== 'windows' // [Windows]
|
|
48
|
-
? null
|
|
49
|
-
: NativeModalManager,
|
|
50
|
-
)
|
|
44
|
+
? new NativeEventEmitter<ModalEventDefinitions>(NativeModalManager)
|
|
51
45
|
: null;
|
|
52
46
|
|
|
53
47
|
/**
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
#include "pch.h"
|
|
3
3
|
#include "CompositionContextHelper.h"
|
|
4
4
|
#include <algorithm>
|
|
5
|
+
#include <cassert>
|
|
6
|
+
#include <exception>
|
|
7
|
+
#include <vector>
|
|
5
8
|
#if __has_include("Composition.Experimental.SystemCompositionContextHelper.g.cpp")
|
|
6
9
|
#include "Composition.Experimental.SystemCompositionContextHelper.g.cpp"
|
|
7
10
|
#endif
|
|
@@ -431,30 +434,43 @@ struct CompVisualImpl {
|
|
|
431
434
|
void InsertAt(
|
|
432
435
|
const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual,
|
|
433
436
|
uint32_t index) noexcept {
|
|
437
|
+
if (index > m_childrenCache.size()) {
|
|
438
|
+
std::terminate();
|
|
439
|
+
}
|
|
434
440
|
auto containerChildren = InnerVisual().as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
435
441
|
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
436
442
|
if (index == 0) {
|
|
437
443
|
containerChildren.InsertAtBottom(compVisual);
|
|
438
|
-
|
|
444
|
+
} else {
|
|
445
|
+
auto insertAfter = containerChildren.First();
|
|
446
|
+
for (uint32_t i = 1; i < index; i++)
|
|
447
|
+
insertAfter.MoveNext();
|
|
448
|
+
containerChildren.InsertAbove(compVisual, insertAfter.Current());
|
|
449
|
+
}
|
|
450
|
+
if (index >= m_childrenCache.size()) {
|
|
451
|
+
m_childrenCache.push_back(visual);
|
|
452
|
+
} else {
|
|
453
|
+
m_childrenCache.insert(m_childrenCache.begin() + index, visual);
|
|
439
454
|
}
|
|
440
|
-
auto insertAfter = containerChildren.First();
|
|
441
|
-
for (uint32_t i = 1; i < index; i++)
|
|
442
|
-
insertAfter.MoveNext();
|
|
443
|
-
containerChildren.InsertAbove(compVisual, insertAfter.Current());
|
|
444
455
|
}
|
|
445
456
|
|
|
446
457
|
void Remove(const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual) noexcept {
|
|
447
458
|
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
448
459
|
auto containerChildren = InnerVisual().as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
449
460
|
containerChildren.Remove(compVisual);
|
|
461
|
+
auto it = std::find_if(
|
|
462
|
+
m_childrenCache.begin(), m_childrenCache.end(), [&visual](const auto &cached) { return cached == visual; });
|
|
463
|
+
if (it != m_childrenCache.end()) {
|
|
464
|
+
m_childrenCache.erase(it);
|
|
465
|
+
}
|
|
450
466
|
}
|
|
451
467
|
|
|
452
468
|
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual GetAt(uint32_t index) noexcept {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return
|
|
469
|
+
if (index < m_childrenCache.size()) {
|
|
470
|
+
return m_childrenCache[index];
|
|
471
|
+
}
|
|
472
|
+
assert(false && "GetAt called with out-of-range index");
|
|
473
|
+
return nullptr;
|
|
458
474
|
}
|
|
459
475
|
|
|
460
476
|
void SetClippingPath(ID2D1Geometry *clippingPath) noexcept {
|
|
@@ -534,6 +550,7 @@ struct CompVisualImpl {
|
|
|
534
550
|
|
|
535
551
|
protected:
|
|
536
552
|
TVisual m_visual;
|
|
553
|
+
std::vector<winrt::Microsoft::ReactNative::Composition::Experimental::IVisual> m_childrenCache;
|
|
537
554
|
};
|
|
538
555
|
|
|
539
556
|
template <typename TTypeRedirects>
|
|
@@ -848,30 +865,43 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
848
865
|
void InsertAt(
|
|
849
866
|
const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual,
|
|
850
867
|
uint32_t index) noexcept {
|
|
868
|
+
if (index > m_childrenCache.size()) {
|
|
869
|
+
std::terminate();
|
|
870
|
+
}
|
|
851
871
|
auto containerChildren = m_contentVisual.Children();
|
|
852
872
|
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
853
873
|
if (index == 0) {
|
|
854
874
|
containerChildren.InsertAtBottom(compVisual);
|
|
855
|
-
|
|
875
|
+
} else {
|
|
876
|
+
auto insertAfter = containerChildren.First();
|
|
877
|
+
for (uint32_t i = 1; i < index; i++)
|
|
878
|
+
insertAfter.MoveNext();
|
|
879
|
+
containerChildren.InsertAbove(compVisual, insertAfter.Current());
|
|
880
|
+
}
|
|
881
|
+
if (index >= m_childrenCache.size()) {
|
|
882
|
+
m_childrenCache.push_back(visual);
|
|
883
|
+
} else {
|
|
884
|
+
m_childrenCache.insert(m_childrenCache.begin() + index, visual);
|
|
856
885
|
}
|
|
857
|
-
auto insertAfter = containerChildren.First();
|
|
858
|
-
for (uint32_t i = 1; i < index; i++)
|
|
859
|
-
insertAfter.MoveNext();
|
|
860
|
-
containerChildren.InsertAbove(compVisual, insertAfter.Current());
|
|
861
886
|
}
|
|
862
887
|
|
|
863
888
|
void Remove(const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual) noexcept {
|
|
864
889
|
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
865
890
|
auto containerChildren = m_contentVisual.Children();
|
|
866
891
|
containerChildren.Remove(compVisual);
|
|
892
|
+
auto it = std::find_if(
|
|
893
|
+
m_childrenCache.begin(), m_childrenCache.end(), [&visual](const auto &cached) { return cached == visual; });
|
|
894
|
+
if (it != m_childrenCache.end()) {
|
|
895
|
+
m_childrenCache.erase(it);
|
|
896
|
+
}
|
|
867
897
|
}
|
|
868
898
|
|
|
869
899
|
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual GetAt(uint32_t index) noexcept {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
return
|
|
900
|
+
if (index < m_childrenCache.size()) {
|
|
901
|
+
return m_childrenCache[index];
|
|
902
|
+
}
|
|
903
|
+
assert(false && "GetAt called with out-of-range index");
|
|
904
|
+
return nullptr;
|
|
875
905
|
}
|
|
876
906
|
|
|
877
907
|
void Brush(const winrt::Microsoft::ReactNative::Composition::Experimental::IBrush &brush) noexcept {
|
|
@@ -1255,6 +1285,12 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
1255
1285
|
std::sort(snapPositions.begin(), snapPositions.end());
|
|
1256
1286
|
snapPositions.erase(std::unique(snapPositions.begin(), snapPositions.end()), snapPositions.end());
|
|
1257
1287
|
|
|
1288
|
+
// Skip reconfiguration if snap points haven't changed
|
|
1289
|
+
if (snapPositions == m_previousSnapPositions) {
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
m_previousSnapPositions = snapPositions;
|
|
1293
|
+
|
|
1258
1294
|
std::vector<typename TTypeRedirects::InteractionTrackerInertiaRestingValue> restingValues;
|
|
1259
1295
|
|
|
1260
1296
|
for (size_t i = 0; i < snapPositions.size(); ++i) {
|
|
@@ -1384,6 +1420,7 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
1384
1420
|
winrt::Microsoft::ReactNative::Composition::Experimental::SnapPointsAlignment m_snapToAlignment{
|
|
1385
1421
|
winrt::Microsoft::ReactNative::Composition::Experimental::SnapPointsAlignment::Near};
|
|
1386
1422
|
std::vector<float> m_snapToOffsets;
|
|
1423
|
+
std::vector<float> m_previousSnapPositions;
|
|
1387
1424
|
bool m_inertia{false};
|
|
1388
1425
|
bool m_custom{false};
|
|
1389
1426
|
bool m_interacting{false};
|
|
@@ -1410,6 +1447,7 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
1410
1447
|
typename TTypeRedirects::SpriteVisual m_contentVisual{nullptr};
|
|
1411
1448
|
typename TTypeRedirects::InteractionTracker m_interactionTracker{nullptr};
|
|
1412
1449
|
typename TTypeRedirects::VisualInteractionSource m_visualInteractionSource{nullptr};
|
|
1450
|
+
std::vector<winrt::Microsoft::ReactNative::Composition::Experimental::IVisual> m_childrenCache;
|
|
1413
1451
|
};
|
|
1414
1452
|
using WindowsCompScrollerVisual = CompScrollerVisual<WindowsTypeRedirects>;
|
|
1415
1453
|
using MicrosoftCompScrollerVisual = CompScrollerVisual<MicrosoftTypeRedirects>;
|