diff --git a/change/@fluentui-react-native-link-c18251d2-05a6-485f-a6bc-f471efef105e.json b/change/@fluentui-react-native-link-c18251d2-05a6-485f-a6bc-f471efef105e.json new file mode 100644 index 00000000000..5de0932f589 --- /dev/null +++ b/change/@fluentui-react-native-link-c18251d2-05a6-485f-a6bc-f471efef105e.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Simplify code to find child string of LinkV1", + "packageName": "@fluentui-react-native/link", + "email": "krsiler@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/components/Link/src/Link.tsx b/packages/components/Link/src/Link.tsx index a86601834d3..4b1f0bb9061 100644 --- a/packages/components/Link/src/Link.tsx +++ b/packages/components/Link/src/Link.tsx @@ -49,12 +49,9 @@ export const Link = compose({ // Views in Text, we use that to handle interactions instead. const supportsInteractionOnText = Platform.OS !== 'macos'; - // Find the first child that's a string and save it to set as the link's + // Find the first child that's a string (if it exists) and save it to set as the link's // accessibilityLabel if one isn't defined. - let linkA11yLabel = ''; - linkA11yLabel = React.Children.toArray(children) - .find((child) => typeof child === 'string') - .toString(); + const linkA11yLabel = React.Children.toArray(children).find((child) => typeof child === 'string'); return supportsA11yTextInText && supportsInteractionOnText && (inline || mergedProps.selectable) ? ( {children}