Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Simplify code to find child string of LinkV1",
"packageName": "@fluentui-react-native/link",
"email": "[email protected]",
"dependentChangeType": "patch"
}
7 changes: 2 additions & 5 deletions packages/components/Link/src/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ export const Link = compose<LinkType>({
// 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) ? (
<Slots.content {...mergedProps}>{children}</Slots.content>
Expand Down
Loading