diff --git a/change/react-native-windows-e9ae59ba-5d8f-44e3-baca-ee3cefee5b84.json b/change/react-native-windows-e9ae59ba-5d8f-44e3-baca-ee3cefee5b84.json new file mode 100644 index 00000000000..45d72526c7e --- /dev/null +++ b/change/react-native-windows-e9ae59ba-5d8f-44e3-baca-ee3cefee5b84.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Add functional tests for Button component fast refresh scenarios", + "packageName": "react-native-windows", + "email": "copilot@github.com", + "dependentChangeType": "patch" +} \ No newline at end of file diff --git a/packages/@react-native-windows/tester/src/js/examples-win/Button/ButtonExample.windows.js b/packages/@react-native-windows/tester/src/js/examples-win/Button/ButtonExample.windows.js index 034302faa95..94378fe611a 100644 --- a/packages/@react-native-windows/tester/src/js/examples-win/Button/ButtonExample.windows.js +++ b/packages/@react-native-windows/tester/src/js/examples-win/Button/ButtonExample.windows.js @@ -273,11 +273,146 @@ exports.examples = [ ); }, }, + { + title: 'Button with dynamic text', + description: 'Button text updates when pressed', + render: function (): React.Node { + return ; + }, + }, + { + title: 'Button with dynamic color', + description: 'Button color updates when pressed', + render: function (): React.Node { + return ; + }, + }, + { + title: 'Button with dynamic disabled state', + description: 'Button disabled state toggles when pressed', + render: function (): React.Node { + return ; + }, + }, + { + title: 'Button with dynamic styling on press', + description: 'Button updates styling when pressed', + render: function (): React.Node { + return ; + }, + }, ]; +// Dynamic Button Components for fast refresh testing +function DynamicTextButton(): React.Node { + const [buttonText, setButtonText] = React.useState('Initial Text'); + const [pressCount, setPressCount] = React.useState(0); + + const onPress = () => { + const newCount = pressCount + 1; + setPressCount(newCount); + setButtonText(`Pressed ${newCount} times`); + }; + + return ( +