react-native-windows 0.77.0 → 0.78.0-preview.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/.flowconfig +1 -1
- package/Chakra/ChakraTracing.cpp +1 -1
- package/Libraries/Animated/animations/Animation.js +22 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -0
- package/Libraries/Animated/animations/SpringAnimation.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
- package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
- package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
- package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
- package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
- package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/Animated/useAnimatedProps.js +0 -43
- package/Libraries/Components/Button.windows.js +3 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +9 -0
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
- package/Libraries/Components/View/View.windows.js +3 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
- package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +0 -9
- package/Libraries/Components/View/ViewPropTypes.windows.js +1 -9
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +1 -16
- package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
- package/Libraries/Image/AssetSourceResolver.js +11 -0
- package/Libraries/Image/AssetSourceResolver.windows.js +11 -0
- package/Libraries/Image/Image.windows.js +2 -0
- package/Libraries/Inspector/BorderBox.js +26 -14
- package/Libraries/Inspector/BoxInspector.js +60 -42
- package/Libraries/Inspector/ElementBox.js +55 -48
- package/Libraries/Inspector/StyleInspector.js +36 -30
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Modal/Modal.js +2 -0
- package/Libraries/Modal/Modal.windows.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +0 -2
- package/Libraries/Network/RCTNetworking.android.js +24 -16
- package/Libraries/Network/RCTNetworking.ios.js +1 -46
- package/Libraries/Network/RCTNetworking.windows.js +1 -46
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
- package/Libraries/ReactNative/UIManagerProperties.js +3 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
- package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
- package/Libraries/StyleSheet/processTransform.js +6 -0
- package/Libraries/Text/Text.d.ts +6 -1
- package/Libraries/Text/Text.windows.js +4 -0
- package/Libraries/Text/TextProps.js +2 -2
- package/Libraries/Text/TextProps.windows.js +3 -2
- package/Libraries/Utilities/BackHandler.android.js +5 -4
- package/Libraries/Utilities/BackHandler.ios.js +4 -5
- package/Libraries/Utilities/BackHandler.windows.js +5 -4
- package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +92 -17
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -33
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -10
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +11 -9
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +5 -10
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +138 -110
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +27 -27
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -33
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +0 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -16
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +9 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
- package/Microsoft.ReactNative/IReactContext.cpp +2 -2
- package/Microsoft.ReactNative/IReactContext.h +1 -1
- package/Microsoft.ReactNative/IReactContext.idl +2 -2
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +10 -10
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +24 -24
- package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
- package/Microsoft.ReactNative/ReactHost/React.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +39 -16
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +4 -2
- package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
- package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
- package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
- package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
- package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
- package/Microsoft.ReactNative/XamlUIService.h +4 -1
- package/Microsoft.ReactNative/XamlUIService.idl +2 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
- package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +3 -0
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +5 -4
- package/ReactCommon/ReactCommon.vcxproj +5 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
- package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
- package/Shared/HermesRuntimeHolder.cpp +2 -2
- package/Shared/Shared.vcxitems +8 -14
- package/Shared/Shared.vcxitems.filters +4 -16
- package/Shared/Threading/BatchingQueueThread.cpp +3 -3
- package/codegen/NativeCPUTimeSpec.g.h +41 -0
- package/codegen/NativeFantomSpec.g.h +78 -0
- package/codegen/NativePerformanceSpec.g.h +31 -43
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
- package/codegen/react/components/rnwcore/Switch.g.h +263 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
- package/codegen/rnwcoreJSI-generated.cpp +90 -57
- package/codegen/rnwcoreJSI.h +241 -104
- package/index.js +5 -0
- package/index.windows.js +5 -0
- package/just-task.js +1 -1
- package/package.json +25 -26
- package/src/private/animated/NativeAnimatedValidation.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +33 -27
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
- package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
- package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
- package/src/private/specs/modules/NativeFantom.js +37 -0
- package/src/private/utilities/ensureInstance.js +21 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/Performance.js +0 -12
- package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
- package/types/index.d.ts +1 -0
- package/Libraries/HeapCapture/HeapCapture.js +0 -29
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
- package/Libraries/Performance/SamplingProfiler.js +0 -39
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
- package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
- package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
10
10
|
#include <Fabric/Composition/UiaHelpers.h>
|
|
11
11
|
#include <Utils/ValueUtils.h>
|
|
12
|
+
#include <react/renderer/components/textinput/TextInputState.h>
|
|
12
13
|
#include <tom.h>
|
|
13
14
|
#include <unicode.h>
|
|
14
15
|
#include <winrt/Microsoft.UI.Input.h>
|
|
@@ -18,7 +19,6 @@
|
|
|
18
19
|
#include "../RootComponentView.h"
|
|
19
20
|
#include "JSValueReader.h"
|
|
20
21
|
#include "WindowsTextInputShadowNode.h"
|
|
21
|
-
#include "WindowsTextInputState.h"
|
|
22
22
|
#include "guid/msoGuid.h"
|
|
23
23
|
|
|
24
24
|
#include <unicode.h>
|
|
@@ -1070,7 +1070,7 @@ void WindowsTextInputComponentView::updateState(
|
|
|
1070
1070
|
|
|
1071
1071
|
if (m_mostRecentEventCount == m_state->getData().mostRecentEventCount) {
|
|
1072
1072
|
m_comingFromState = true;
|
|
1073
|
-
auto &fragments = m_state->getData().
|
|
1073
|
+
auto &fragments = m_state->getData().attributedStringBox.getValue().getFragments();
|
|
1074
1074
|
UpdateText(fragments.size() ? fragments[0].string : "");
|
|
1075
1075
|
|
|
1076
1076
|
m_comingFromState = false;
|
|
@@ -1133,7 +1133,7 @@ void WindowsTextInputComponentView::OnTextUpdated() noexcept {
|
|
|
1133
1133
|
// auto newAttributedString = getAttributedString();
|
|
1134
1134
|
// if (data.attributedString == newAttributedString)
|
|
1135
1135
|
// return;
|
|
1136
|
-
data.
|
|
1136
|
+
data.attributedStringBox = facebook::react::AttributedStringBox(getAttributedString());
|
|
1137
1137
|
data.mostRecentEventCount = m_nativeEventCount;
|
|
1138
1138
|
|
|
1139
1139
|
m_state->updateState(std::move(data));
|
|
@@ -1525,4 +1525,4 @@ void WindowsTextInputComponentView::autoCapitalizeOnUpdateProps(
|
|
|
1525
1525
|
}
|
|
1526
1526
|
}
|
|
1527
1527
|
|
|
1528
|
-
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
1528
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "WindowsTextInputShadowNode.h"
|
|
5
5
|
|
|
6
|
-
#include <react/
|
|
6
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
7
7
|
#include <react/renderer/attributedstring/AttributedStringBox.h>
|
|
8
8
|
#include <react/renderer/attributedstring/TextAttributes.h>
|
|
9
9
|
#include <react/renderer/components/text/BaseTextShadowNode.h>
|
|
@@ -12,39 +12,42 @@
|
|
|
12
12
|
#include <react/renderer/core/conversions.h>
|
|
13
13
|
#include <react/renderer/textlayoutmanager/TextLayoutContext.h>
|
|
14
14
|
|
|
15
|
-
#include <utility>
|
|
16
|
-
|
|
17
15
|
namespace facebook::react {
|
|
18
16
|
|
|
19
17
|
extern const char WindowsTextInputComponentName[] = "WindowsTextInput";
|
|
20
18
|
|
|
21
|
-
void WindowsTextInputShadowNode::
|
|
19
|
+
void WindowsTextInputShadowNode::setTextLayoutManager(std::shared_ptr<const TextLayoutManager> textLayoutManager) {
|
|
22
20
|
ensureUnsealed();
|
|
23
|
-
|
|
21
|
+
textLayoutManager_ = std::move(textLayoutManager);
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
Size WindowsTextInputShadowNode::measureContent(
|
|
25
|
+
const LayoutContext &layoutContext,
|
|
26
|
+
const LayoutConstraints &layoutConstraints) const {
|
|
27
|
+
if (getStateData().cachedAttributedStringId != 0) {
|
|
28
|
+
return textLayoutManager_
|
|
29
|
+
->measureCachedSpannableById(
|
|
30
|
+
getStateData().cachedAttributedStringId,
|
|
31
|
+
{}, // TODO getConcreteProps().paragraphAttributes
|
|
32
|
+
layoutConstraints)
|
|
33
|
+
.size;
|
|
34
|
+
}
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
36
|
+
// Layout is called right after measure.
|
|
37
|
+
// Measure is marked as `const`, and `layout` is not; so State can be updated
|
|
38
|
+
// during layout, but not during `measure`. If State is out-of-date in layout,
|
|
39
|
+
// it's too late: measure will have already operated on old State. Thus, we
|
|
40
|
+
// use the same value here that we *will* use in layout to update the state.
|
|
41
|
+
AttributedString attributedString = getMostRecentAttributedString(layoutContext);
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
attributedString.setBaseTextAttributes(childTextAttributes);
|
|
43
|
+
if (attributedString.isEmpty()) {
|
|
44
|
+
attributedString = getPlaceholderAttributedString(layoutContext);
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
// BaseTextShadowNode only gets children. We must detect and prepend text
|
|
44
48
|
// value attributes manually.
|
|
45
49
|
if (!getConcreteProps().text.empty()) {
|
|
46
50
|
auto textAttributes = TextAttributes::defaultTextAttributes();
|
|
47
|
-
textAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
48
51
|
textAttributes.apply(getConcreteProps().textAttributes);
|
|
49
52
|
auto fragment = AttributedString::Fragment{};
|
|
50
53
|
fragment.string = getConcreteProps().text;
|
|
@@ -57,56 +60,40 @@ AttributedString WindowsTextInputShadowNode::getAttributedString(const LayoutCon
|
|
|
57
60
|
attributedString.prependFragment(std::move(fragment));
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
AttributedString WindowsTextInputShadowNode::getPlaceholderAttributedString(const LayoutContext &layoutContext) const {
|
|
70
|
-
// Return placeholder text, since text and children are empty.
|
|
71
|
-
auto textAttributedString = AttributedString{};
|
|
72
|
-
auto fragment = AttributedString::Fragment{};
|
|
73
|
-
fragment.string = getConcreteProps().placeholder;
|
|
74
|
-
|
|
75
|
-
if (fragment.string.empty()) {
|
|
76
|
-
fragment.string = BaseTextShadowNode::getEmptyPlaceholder();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
auto textAttributes = TextAttributes::defaultTextAttributes();
|
|
80
|
-
textAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
81
|
-
textAttributes.apply(getConcreteProps().textAttributes);
|
|
82
|
-
|
|
83
|
-
// If there's no text, it's possible that this Fragment isn't actually
|
|
84
|
-
// appended to the AttributedString (see implementation of appendFragment)
|
|
85
|
-
fragment.textAttributes = textAttributes;
|
|
86
|
-
fragment.parentShadowView = ShadowView(*this);
|
|
87
|
-
textAttributedString.appendFragment(std::move(fragment));
|
|
88
|
-
|
|
89
|
-
return textAttributedString;
|
|
63
|
+
TextLayoutContext textLayoutContext;
|
|
64
|
+
textLayoutContext.pointScaleFactor = layoutContext.pointScaleFactor;
|
|
65
|
+
return textLayoutManager_
|
|
66
|
+
->measure(
|
|
67
|
+
AttributedStringBox{attributedString},
|
|
68
|
+
{}, // TODO getConcreteProps().paragraphAttributes,
|
|
69
|
+
textLayoutContext,
|
|
70
|
+
layoutConstraints)
|
|
71
|
+
.size;
|
|
90
72
|
}
|
|
91
73
|
|
|
92
|
-
void WindowsTextInputShadowNode::
|
|
93
|
-
|
|
94
|
-
|
|
74
|
+
void WindowsTextInputShadowNode::layout(LayoutContext layoutContext) {
|
|
75
|
+
updateStateIfNeeded(layoutContext);
|
|
76
|
+
ConcreteViewShadowNode::layout(layoutContext);
|
|
95
77
|
}
|
|
96
78
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
79
|
+
LayoutConstraints WindowsTextInputShadowNode::getTextConstraints(const LayoutConstraints &layoutConstraints) const {
|
|
80
|
+
if (getConcreteProps().multiline) {
|
|
81
|
+
return layoutConstraints;
|
|
82
|
+
} else {
|
|
83
|
+
// A single line TextInput acts as a horizontal scroller of infinitely
|
|
84
|
+
// expandable text, so we want to measure the text as if it is allowed to
|
|
85
|
+
// infinitely expand horizontally, and later clamp to the constraints of the
|
|
86
|
+
// input.
|
|
87
|
+
return LayoutConstraints{
|
|
88
|
+
.minimumSize = layoutConstraints.minimumSize,
|
|
89
|
+
.maximumSize =
|
|
90
|
+
Size{
|
|
91
|
+
.width = std::numeric_limits<Float>::infinity(),
|
|
92
|
+
.height = layoutConstraints.maximumSize.height,
|
|
93
|
+
},
|
|
94
|
+
.layoutDirection = layoutConstraints.layoutDirection,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
110
97
|
}
|
|
111
98
|
|
|
112
99
|
void WindowsTextInputShadowNode::updateStateIfNeeded(const LayoutContext &layoutContext) {
|
|
@@ -146,60 +133,101 @@ void WindowsTextInputShadowNode::updateStateIfNeeded(const LayoutContext &layout
|
|
|
146
133
|
// current attributedString unchanged, and pass in zero for the "event count"
|
|
147
134
|
// so no changes are applied There's no way to prevent a state update from
|
|
148
135
|
// flowing to Java, so we just ensure it's a noop in those cases.
|
|
149
|
-
setStateData(facebook::react::
|
|
150
|
-
newEventCount
|
|
151
|
-
newAttributedString,
|
|
152
|
-
reactTreeAttributedString,
|
|
153
|
-
{},
|
|
154
|
-
state.defaultThemePaddingStart,
|
|
155
|
-
state.defaultThemePaddingEnd,
|
|
156
|
-
state.defaultThemePaddingTop,
|
|
157
|
-
state.defaultThemePaddingBottom});
|
|
136
|
+
setStateData(facebook::react::TextInputState{
|
|
137
|
+
AttributedStringBox(newAttributedString), reactTreeAttributedString, {}, newEventCount});
|
|
158
138
|
}
|
|
159
139
|
|
|
160
|
-
|
|
140
|
+
AttributedString WindowsTextInputShadowNode::getAttributedString(const LayoutContext &layoutContext) const {
|
|
141
|
+
// Use BaseTextShadowNode to get attributed string from children
|
|
161
142
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const LayoutConstraints &layoutConstraints) const {
|
|
165
|
-
if (getStateData().cachedAttributedStringId != 0) {
|
|
166
|
-
return m_textLayoutManager
|
|
167
|
-
->measureCachedSpannableById(
|
|
168
|
-
getStateData().cachedAttributedStringId,
|
|
169
|
-
{}, // TODO getConcreteProps().paragraphAttributes
|
|
170
|
-
layoutConstraints)
|
|
171
|
-
.size;
|
|
172
|
-
}
|
|
143
|
+
auto childTextAttributes = TextAttributes::defaultTextAttributes();
|
|
144
|
+
childTextAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
173
145
|
|
|
174
|
-
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
-
AttributedString attributedString = getMostRecentAttributedString(layoutContext);
|
|
146
|
+
childTextAttributes.apply(getConcreteProps().textAttributes);
|
|
147
|
+
// Don't propagate the background color of the TextInput onto the attributed
|
|
148
|
+
// string. Android tries to render shadow of the background alongside the
|
|
149
|
+
// shadow of the text which results in weird artifacts.
|
|
150
|
+
childTextAttributes.backgroundColor = HostPlatformColor::UndefinedColor;
|
|
180
151
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
152
|
+
auto attributedString = AttributedString{};
|
|
153
|
+
auto attachments = BaseTextShadowNode::Attachments{};
|
|
154
|
+
BaseTextShadowNode::buildAttributedString(childTextAttributes, *this, attributedString, attachments);
|
|
155
|
+
attributedString.setBaseTextAttributes(childTextAttributes);
|
|
184
156
|
|
|
185
|
-
|
|
186
|
-
|
|
157
|
+
// BaseTextShadowNode only gets children. We must detect and prepend text
|
|
158
|
+
// value attributes manually.
|
|
159
|
+
if (!getConcreteProps().text.empty()) {
|
|
160
|
+
auto textAttributes = TextAttributes::defaultTextAttributes();
|
|
161
|
+
textAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
162
|
+
textAttributes.apply(getConcreteProps().textAttributes);
|
|
163
|
+
auto fragment = AttributedString::Fragment{};
|
|
164
|
+
fragment.string = getConcreteProps().text;
|
|
165
|
+
fragment.textAttributes = textAttributes;
|
|
166
|
+
// If the TextInput opacity is 0 < n < 1, the opacity of the TextInput and
|
|
167
|
+
// text value's background will stack. This is a hack/workaround to prevent
|
|
168
|
+
// that effect.
|
|
169
|
+
fragment.textAttributes.backgroundColor = clearColor();
|
|
170
|
+
fragment.parentShadowView = ShadowView(*this);
|
|
171
|
+
attributedString.prependFragment(std::move(fragment));
|
|
187
172
|
}
|
|
188
173
|
|
|
189
|
-
|
|
190
|
-
textLayoutContext.pointScaleFactor = layoutContext.pointScaleFactor;
|
|
191
|
-
return m_textLayoutManager
|
|
192
|
-
->measure(
|
|
193
|
-
AttributedStringBox{attributedString},
|
|
194
|
-
{}, // TODO getConcreteProps().paragraphAttributes,
|
|
195
|
-
textLayoutContext,
|
|
196
|
-
layoutConstraints)
|
|
197
|
-
.size;
|
|
174
|
+
return attributedString;
|
|
198
175
|
}
|
|
199
176
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
177
|
+
AttributedString WindowsTextInputShadowNode::getMostRecentAttributedString(const LayoutContext &layoutContext) const {
|
|
178
|
+
const auto &state = getStateData();
|
|
179
|
+
|
|
180
|
+
auto reactTreeAttributedString = getAttributedString(layoutContext);
|
|
181
|
+
|
|
182
|
+
// Sometimes the treeAttributedString will only differ from the state
|
|
183
|
+
// not by inherent properties (string or prop attributes), but by the frame of
|
|
184
|
+
// the parent which has changed Thus, we can't directly compare the entire
|
|
185
|
+
// AttributedString
|
|
186
|
+
bool treeAttributedStringChanged =
|
|
187
|
+
!state.reactTreeAttributedString.compareTextAttributesWithoutFrame(reactTreeAttributedString);
|
|
188
|
+
|
|
189
|
+
return (!treeAttributedStringChanged ? state.attributedStringBox.getValue() : reactTreeAttributedString);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// For measurement purposes, we want to make sure that there's at least a
|
|
193
|
+
// single character in the string so that the measured height is greater
|
|
194
|
+
// than zero. Otherwise, empty TextInputs with no placeholder don't
|
|
195
|
+
// display at all.
|
|
196
|
+
// TODO T67606511: We will redefine the measurement of empty strings as part
|
|
197
|
+
// of T67606511
|
|
198
|
+
AttributedString WindowsTextInputShadowNode::getPlaceholderAttributedString(const LayoutContext &layoutContext) const {
|
|
199
|
+
// Return placeholder text, since text and children are empty.
|
|
200
|
+
auto textAttributedString = AttributedString{};
|
|
201
|
+
auto fragment = AttributedString::Fragment{};
|
|
202
|
+
fragment.string = getConcreteProps().placeholder;
|
|
203
|
+
|
|
204
|
+
if (fragment.string.empty()) {
|
|
205
|
+
fragment.string = BaseTextShadowNode::getEmptyPlaceholder();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
auto textAttributes = TextAttributes::defaultTextAttributes();
|
|
209
|
+
textAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
210
|
+
textAttributes.apply(getConcreteProps().textAttributes);
|
|
211
|
+
|
|
212
|
+
// If there's no text, it's possible that this Fragment isn't actually
|
|
213
|
+
// appended to the AttributedString (see implementation of appendFragment)
|
|
214
|
+
fragment.textAttributes = textAttributes;
|
|
215
|
+
fragment.parentShadowView = ShadowView(*this);
|
|
216
|
+
textAttributedString.appendFragment(std::move(fragment));
|
|
217
|
+
|
|
218
|
+
return textAttributedString;
|
|
219
|
+
// TextLayoutContext textLayoutContext;
|
|
220
|
+
// textLayoutContext.pointScaleFactor = layoutContext.pointScaleFactor;
|
|
221
|
+
// auto textSize = textLayoutManager_
|
|
222
|
+
// ->measure(
|
|
223
|
+
// AttributedStringBox{attributedString},
|
|
224
|
+
// getConcreteProps().paragraphAttributes,
|
|
225
|
+
// textLayoutContext,
|
|
226
|
+
// textConstraints)
|
|
227
|
+
// .size;
|
|
228
|
+
// return layoutConstraints.clamp(textSize);
|
|
203
229
|
}
|
|
204
230
|
|
|
231
|
+
#pragma mark - LayoutableShadowNode
|
|
232
|
+
|
|
205
233
|
} // namespace facebook::react
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
#include <unordered_map>
|
|
8
8
|
#include "WindowsTextInputEventEmitter.h"
|
|
9
9
|
#include "WindowsTextInputProps.h"
|
|
10
|
-
#include "WindowsTextInputState.h"
|
|
11
10
|
|
|
11
|
+
#include <react/renderer/attributedstring/AttributedString.h>
|
|
12
|
+
#include <react/renderer/components/textinput/TextInputState.h>
|
|
12
13
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
13
14
|
#include <react/utils/ContextContainer.h>
|
|
14
15
|
|
|
15
|
-
#include <react/renderer/attributedstring/AttributedString.h>
|
|
16
16
|
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
|
17
17
|
|
|
18
18
|
namespace facebook::react {
|
|
@@ -26,58 +26,58 @@ class WindowsTextInputShadowNode final : public ConcreteViewShadowNode<
|
|
|
26
26
|
WindowsTextInputComponentName,
|
|
27
27
|
WindowsTextInputProps,
|
|
28
28
|
WindowsTextInputEventEmitter,
|
|
29
|
-
|
|
29
|
+
TextInputState> {
|
|
30
30
|
public:
|
|
31
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
32
|
+
|
|
31
33
|
static ShadowNodeTraits BaseTraits() {
|
|
32
34
|
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
33
35
|
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
|
|
36
|
+
traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode);
|
|
34
37
|
traits.set(ShadowNodeTraits::Trait::BaselineYogaNode);
|
|
35
38
|
return traits;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
39
|
-
|
|
40
|
-
void setContextContainer(ContextContainer *contextContainer);
|
|
41
|
-
|
|
42
|
-
/*
|
|
43
|
-
* Returns a `AttributedString` which represents text content of the node.
|
|
44
|
-
*/
|
|
45
|
-
AttributedString getAttributedString(const LayoutContext &layoutContext) const;
|
|
46
|
-
AttributedString getPlaceholderAttributedString(const LayoutContext &layoutContext) const;
|
|
47
|
-
|
|
48
41
|
/*
|
|
49
42
|
* Associates a shared TextLayoutManager with the node.
|
|
50
|
-
* `
|
|
51
|
-
* and construct `
|
|
43
|
+
* `TextInputShadowNode` uses the manager to measure text content
|
|
44
|
+
* and construct `TextInputState` objects.
|
|
52
45
|
*/
|
|
53
|
-
void setTextLayoutManager(
|
|
46
|
+
void setTextLayoutManager(std::shared_ptr<const TextLayoutManager> textLayoutManager);
|
|
54
47
|
|
|
55
48
|
#pragma mark - LayoutableShadowNode
|
|
56
|
-
|
|
49
|
+
protected:
|
|
57
50
|
Size measureContent(const LayoutContext &layoutContext, const LayoutConstraints &layoutConstraints) const override;
|
|
51
|
+
|
|
58
52
|
void layout(LayoutContext layoutContext) override;
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
ContextContainer *m_contextContainer{};
|
|
54
|
+
// Float baseline(const LayoutContext& layoutContext, Size size) const override;
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
std::shared_ptr<const TextLayoutManager> textLayoutManager_;
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* Determines the constraints to use while measure the underlying text
|
|
65
60
|
*/
|
|
66
|
-
|
|
61
|
+
LayoutConstraints getTextConstraints(const LayoutConstraints &layoutConstraints) const;
|
|
67
62
|
|
|
63
|
+
private:
|
|
68
64
|
/*
|
|
69
65
|
* Creates a `State` object (with `AttributedText` and
|
|
70
66
|
* `TextLayoutManager`) if needed.
|
|
71
67
|
*/
|
|
72
68
|
void updateStateIfNeeded(const LayoutContext &layoutContext);
|
|
73
69
|
|
|
74
|
-
SharedTextLayoutManager m_textLayoutManager;
|
|
75
|
-
|
|
76
70
|
/*
|
|
77
|
-
*
|
|
78
|
-
* from the node.
|
|
71
|
+
* Returns a `AttributedString` which represents text content of the node.
|
|
79
72
|
*/
|
|
80
|
-
|
|
73
|
+
AttributedString getAttributedString(const LayoutContext &layoutContext) const;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get the most up-to-date attributed string for measurement and State.
|
|
77
|
+
*/
|
|
78
|
+
AttributedString getMostRecentAttributedString(const LayoutContext &layoutContext) const;
|
|
79
|
+
|
|
80
|
+
AttributedString getPlaceholderAttributedString(const LayoutContext &layoutContext) const;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
} // namespace facebook::react
|
|
@@ -124,7 +124,7 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
|
|
|
124
124
|
|
|
125
125
|
#ifndef CORE_ABI
|
|
126
126
|
// If XAML is loaded, look in application resources
|
|
127
|
-
if (xaml::
|
|
127
|
+
if (xaml::TryGetCurrentUwpXamlApplication()) {
|
|
128
128
|
const auto appResources{xaml::Application::Current().Resources()};
|
|
129
129
|
const auto boxedResourceName{winrt::box_value(winrt::to_hstring(platformColor))};
|
|
130
130
|
if (appResources.HasKey(boxedResourceName)) {
|
|
@@ -42,44 +42,59 @@ HRESULT UiaNavigateHelper(
|
|
|
42
42
|
}
|
|
43
43
|
} break;
|
|
44
44
|
|
|
45
|
-
case NavigateDirection_LastChild:
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
case NavigateDirection_LastChild: {
|
|
46
|
+
auto children = view.Children();
|
|
47
|
+
if (children.Size() != 0) {
|
|
48
|
+
uint32_t index = children.Size() - 1;
|
|
49
|
+
do {
|
|
50
|
+
auto child = children.GetAt(index).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
|
|
51
|
+
if (uiaProvider = child->EnsureUiaProvider()) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
} while (index-- != 0);
|
|
55
|
+
}
|
|
56
|
+
} break;
|
|
48
57
|
case NavigateDirection_FirstChild: {
|
|
49
58
|
auto children = view.Children();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
if (children.Size() != 0) {
|
|
60
|
+
uint32_t index = 0;
|
|
61
|
+
do {
|
|
62
|
+
auto child = children.GetAt(index).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
|
|
63
|
+
if (uiaProvider = child->EnsureUiaProvider()) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
} while (++index != children.Size());
|
|
55
67
|
}
|
|
56
68
|
} break;
|
|
57
|
-
|
|
58
69
|
case NavigateDirection_NextSibling: {
|
|
59
|
-
auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::
|
|
70
|
+
auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
|
|
60
71
|
if (parentCV != nullptr) {
|
|
61
72
|
auto children = parentCV->Children();
|
|
62
73
|
auto it = std::find(children.begin(), children.end(), view);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
|
|
75
|
+
while (++it != children.end()) {
|
|
76
|
+
auto nextchild = (*it).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
|
|
77
|
+
if (uiaProvider = nextchild->EnsureUiaProvider()) {
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
82
|
} break;
|
|
70
83
|
|
|
71
84
|
case NavigateDirection_PreviousSibling: {
|
|
72
|
-
auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::
|
|
85
|
+
auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
|
|
73
86
|
if (parentCV != nullptr) {
|
|
74
87
|
auto children = parentCV->Children();
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
auto it = std::find(children.begin(), children.end(), view);
|
|
89
|
+
|
|
90
|
+
if (it != children.begin()) {
|
|
91
|
+
do {
|
|
92
|
+
it--;
|
|
93
|
+
auto prevchild = (*it).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
|
|
94
|
+
if (uiaProvider = prevchild->EnsureUiaProvider()) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
} while (it != children.begin());
|
|
83
98
|
}
|
|
84
99
|
}
|
|
85
100
|
} break;
|
|
@@ -174,16 +189,6 @@ long GetLiveSetting(const std::string &liveRegion) noexcept {
|
|
|
174
189
|
return LiveSetting::Off;
|
|
175
190
|
}
|
|
176
191
|
|
|
177
|
-
std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept {
|
|
178
|
-
if (value.now.has_value()) {
|
|
179
|
-
return std::to_string(value.now.value());
|
|
180
|
-
} else if (value.text.has_value()) {
|
|
181
|
-
return value.text.value();
|
|
182
|
-
} else {
|
|
183
|
-
return "";
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
192
|
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept {
|
|
188
193
|
auto strongView = view.view();
|
|
189
194
|
|
|
@@ -32,8 +32,6 @@ void UpdateUiaProperty(
|
|
|
32
32
|
|
|
33
33
|
long GetLiveSetting(const std::string &liveRegion) noexcept;
|
|
34
34
|
|
|
35
|
-
std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept;
|
|
36
|
-
|
|
37
35
|
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept;
|
|
38
36
|
|
|
39
37
|
ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
#include <Fabric/Composition/ReactNativeIsland.h>
|
|
14
14
|
#include <Fabric/Composition/RootComponentView.h>
|
|
15
15
|
#include <Fabric/FabricUIManagerModule.h>
|
|
16
|
-
#include <Fabric/ReactNativeConfigProperties.h>
|
|
17
16
|
#include <Fabric/WindowsComponentDescriptorRegistry.h>
|
|
18
17
|
#include <IReactContext.h>
|
|
19
18
|
#include <IReactRootView.h>
|
|
@@ -61,9 +60,6 @@ FabricUIManager::~FabricUIManager() {
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
void FabricUIManager::installFabricUIManager() noexcept {
|
|
64
|
-
std::shared_ptr<const facebook::react::ReactNativeConfig> config =
|
|
65
|
-
std::make_shared<const ReactNativeConfigProperties>(m_context.Properties());
|
|
66
|
-
|
|
67
63
|
std::lock_guard<std::mutex> schedulerLock(m_schedulerMutex);
|
|
68
64
|
|
|
69
65
|
facebook::react::ContextContainer::Shared contextContainer = std::make_shared<facebook::react::ContextContainer>();
|
|
@@ -89,8 +85,6 @@ void FabricUIManager::installFabricUIManager() noexcept {
|
|
|
89
85
|
return std::make_unique<AsynchronousEventBeat>(ownerBox, context, runtimeScheduler);
|
|
90
86
|
};
|
|
91
87
|
|
|
92
|
-
contextContainer->insert("ReactNativeConfig", config);
|
|
93
|
-
|
|
94
88
|
toolbox.contextContainer = contextContainer;
|
|
95
89
|
toolbox.componentRegistryFactory = [](facebook::react::EventDispatcher::Weak const &eventDispatcher,
|
|
96
90
|
facebook::react::ContextContainer::Shared const &contextContainer)
|
|
@@ -134,7 +128,6 @@ void FabricUIManager::startSurface(
|
|
|
134
128
|
|
|
135
129
|
auto root = rootComponentViewDescriptor.view
|
|
136
130
|
.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
|
|
137
|
-
root->theme(winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::Theme>(rootView.Theme()));
|
|
138
131
|
root->start(rootView);
|
|
139
132
|
});
|
|
140
133
|
|
|
@@ -154,15 +147,11 @@ void FabricUIManager::startSurface(
|
|
|
154
147
|
void FabricUIManager::stopSurface(facebook::react::SurfaceId surfaceId) noexcept {
|
|
155
148
|
m_surfaceManager->stopSurface(surfaceId);
|
|
156
149
|
auto &rootDescriptor = m_registry.componentViewDescriptorWithTag(surfaceId);
|
|
150
|
+
rootDescriptor.view.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>()->stop();
|
|
157
151
|
m_registry.enqueueComponentViewWithComponentHandle(
|
|
158
152
|
facebook::react::RootShadowNode::Handle(), surfaceId, rootDescriptor);
|
|
159
153
|
}
|
|
160
154
|
|
|
161
|
-
winrt::Microsoft::ReactNative::ReactNativeIsland FabricUIManager::GetReactNativeIsland(
|
|
162
|
-
facebook::react::SurfaceId surfaceId) const noexcept {
|
|
163
|
-
return m_surfaceRegistry.at(surfaceId).wkRootView.get();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
155
|
facebook::react::Size FabricUIManager::measureSurface(
|
|
167
156
|
facebook::react::SurfaceId surfaceId,
|
|
168
157
|
const facebook::react::LayoutConstraints &layoutConstraints,
|
|
@@ -230,9 +219,9 @@ void FabricUIManager::RCTPerformMountInstructions(
|
|
|
230
219
|
case facebook::react::ShadowViewMutation::Insert: {
|
|
231
220
|
auto &oldChildShadowView = mutation.oldChildShadowView;
|
|
232
221
|
auto &newChildShadowView = mutation.newChildShadowView;
|
|
233
|
-
auto &
|
|
222
|
+
auto &parentTag = mutation.parentTag;
|
|
234
223
|
auto &newChildViewDescriptor = m_registry.componentViewDescriptorWithTag(newChildShadowView.tag);
|
|
235
|
-
auto parentViewDescriptor = m_registry.componentViewDescriptorWithTag(
|
|
224
|
+
auto parentViewDescriptor = m_registry.componentViewDescriptorWithTag(parentTag);
|
|
236
225
|
auto newChildComponentView =
|
|
237
226
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(newChildViewDescriptor.view);
|
|
238
227
|
|
|
@@ -249,9 +238,9 @@ void FabricUIManager::RCTPerformMountInstructions(
|
|
|
249
238
|
|
|
250
239
|
case facebook::react::ShadowViewMutation::Remove: {
|
|
251
240
|
auto &oldChildShadowView = mutation.oldChildShadowView;
|
|
252
|
-
auto &
|
|
241
|
+
auto &parentTag = mutation.parentTag;
|
|
253
242
|
auto &oldChildViewDescriptor = m_registry.componentViewDescriptorWithTag(oldChildShadowView.tag);
|
|
254
|
-
auto &parentViewDescriptor = m_registry.componentViewDescriptorWithTag(
|
|
243
|
+
auto &parentViewDescriptor = m_registry.componentViewDescriptorWithTag(parentTag);
|
|
255
244
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(parentViewDescriptor.view)
|
|
256
245
|
->UnmountChildComponentView(oldChildViewDescriptor.view, mutation.index);
|
|
257
246
|
break;
|
|
@@ -49,9 +49,6 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
|
|
|
49
49
|
|
|
50
50
|
const IComponentViewRegistry &GetViewRegistry() const noexcept;
|
|
51
51
|
|
|
52
|
-
winrt::Microsoft::ReactNative::ReactNativeIsland GetReactNativeIsland(
|
|
53
|
-
facebook::react::SurfaceId surfaceId) const noexcept;
|
|
54
|
-
|
|
55
52
|
static winrt::Microsoft::ReactNative::ReactNotificationId<facebook::react::SurfaceId> NotifyMountedId() noexcept;
|
|
56
53
|
|
|
57
54
|
private:
|