Skip to content

Commit 433a0f5

Browse files
authored
Enable imperative focus (#15863)
* Fix view.focus function * Change files * snapshots
1 parent 12f8f72 commit 433a0f5

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Fix view.focus function",
4+
"packageName": "react-native-windows",
5+
"email": "30809111+acoates-ms@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/e2e-test-app-fabric/test/__snapshots__/PressableComponentTest.test.ts.snap

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,13 @@ exports[`Pressable Tests Pressables can have event handlers, hover and click 2`]
846846
"Name": "pressOut",
847847
"TextRangePattern.GetText": "pressOut",
848848
},
849+
{
850+
"AutomationId": "",
851+
"ControlType": 50020,
852+
"LocalizedControlType": "text",
853+
"Name": "focus",
854+
"TextRangePattern.GetText": "focus",
855+
},
849856
{
850857
"AutomationId": "",
851858
"ControlType": 50020,
@@ -891,6 +898,10 @@ exports[`Pressable Tests Pressables can have event handlers, hover and click 2`]
891898
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
892899
"_Props": {},
893900
},
901+
{
902+
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
903+
"_Props": {},
904+
},
894905
],
895906
},
896907
"Visual Tree": {
@@ -991,6 +1002,18 @@ exports[`Pressable Tests Pressables can have event handlers, hover and click 2`]
9911002
},
9921003
],
9931004
},
1005+
{
1006+
"Offset": "11, 85, 0",
1007+
"Size": "874, 20",
1008+
"Visual Type": "SpriteVisual",
1009+
"__Children": [
1010+
{
1011+
"Offset": "0, 0, 0",
1012+
"Size": "874, 20",
1013+
"Visual Type": "SpriteVisual",
1014+
},
1015+
],
1016+
},
9941017
],
9951018
},
9961019
}

vnext/Microsoft.ReactNative/ReactHost/ReactHost.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ class ReactNativeWindowsFeatureFlags : public facebook::react::ReactNativeFeatur
266266
return true;
267267
}
268268

269+
bool enableImperativeFocus() override {
270+
return true;
271+
}
272+
269273
bool fuseboxEnabledRelease() override {
270274
return true; // Enable Fusebox (modern CDP backend) by default for React Native Windows
271275
}

0 commit comments

Comments
 (0)