* Enable inline link support for win32

* Remove win32 inline link test page fork

* Fix test

* Make child type stricter

* Change files

* UNdo strict child type
This commit is contained in:
Ruriko Araki 2024-07-15 12:46:03 -07:00 коммит произвёл GitHub
Родитель 23ad7283d0
Коммит c429c9c9df
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
8 изменённых файлов: 15 добавлений и 27 удалений

Просмотреть файл

@ -24,7 +24,7 @@ export const InlineLinks: React.FunctionComponent = () => {
<Link inline onPress={doPress} disabled focusable>
link
</Link>{' '}
is disabled but focusable.
is disabled and not focusable.
</Text>
<Text>
Follow this{' '}

Просмотреть файл

@ -1,9 +0,0 @@
import * as React from 'react';
import { TextV1 as Text } from '@fluentui/react-native';
// Platform.select not available for win32
// Forking test instead
export const InlineLinks: React.FunctionComponent = () => {
return <Text>Inline links are not supported on win32.</Text>;
};

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Enable inline link support for win32",
"packageName": "@fluentui-react-native/link",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Enable inline link support for win32",
"packageName": "@fluentui-react-native/tester",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -90,7 +90,6 @@ export interface LinkProps extends IWithPressableOptions<TextProps> {
enableFocusRing?: boolean;
/**
* Whether the link is inline with text
* Note: Not supported for win32
* @default false
*/
inline?: boolean;

Просмотреть файл

@ -1,6 +1,5 @@
/** @jsxRuntime classic */
/** @jsx withSlots */
import * as React from 'react';
import { Platform, View } from 'react-native';
import type { UseSlots } from '@fluentui-react-native/framework';

Просмотреть файл

@ -70,7 +70,6 @@ export interface LinkProps extends IWithPressableOptions<TextProps> {
enableFocusRing?: boolean;
/**
* Whether the link is inline with text
* Note: Not supported for win32
* @default false
*/
inline?: boolean;

Просмотреть файл

@ -82,19 +82,6 @@ export const useLink = (props: LinkProps): LinkInfo => {
const linkTooltip = tooltip ?? url ?? undefined;
let inline = props.inline;
const supportsInlineLinks = Platform.OS !== ('win32' as any);
if (inline && !supportsInlineLinks) {
if (__DEV__) {
throw new Error('Inline Links are not supported on ' + Platform.OS + '. Component will fail to render.');
}
// Force Links to not be inline on win32.
// This will cause errors to be thrown in RN code if the Link is placed inline with Text,
// since Views are not allows to be children of Text components.
inline = false;
}
return {
props: {
...rest,
@ -110,7 +97,6 @@ export const useLink = (props: LinkProps): LinkInfo => {
cursor: isDisabled ? 'not-allowed' : 'pointer',
ref: useViewCommandFocus(componentRef),
tooltip: linkTooltip,
inline,
},
state: newState,
};