[win32] Inline link support (#3682)
* 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:
Родитель
23ad7283d0
Коммит
c429c9c9df
|
@ -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,
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче