diff --git a/packages/react-native-web/src/exports/Text/__tests__/__snapshots__/index-test.js.snap b/packages/react-native-web/src/exports/Text/__tests__/__snapshots__/index-test.js.snap index 183f3775..0b8e3bd0 100644 --- a/packages/react-native-web/src/exports/Text/__tests__/__snapshots__/index-test.js.snap +++ b/packages/react-native-web/src/exports/Text/__tests__/__snapshots__/index-test.js.snap @@ -107,6 +107,15 @@ exports[`components/Text prop "hrefAttrs" requires "href" 1`] = ` /> `; +exports[`components/Text prop "hrefAttrs" target variant is set 1`] = ` + +`; + exports[`components/Text prop "hrefAttrs" value is set 1`] = ` { const hrefAttrs = { download: 'filename.jpg', rel: 'nofollow', + target: '_blank' + }; + const { container } = render(); + expect(container.firstChild).toMatchSnapshot(); + }); + + test('target variant is set', () => { + const hrefAttrs = { target: 'blank' }; const { container } = render(); diff --git a/packages/react-native-web/src/exports/Text/index.js b/packages/react-native-web/src/exports/Text/index.js index ca0e5157..1a84ad6f 100644 --- a/packages/react-native-web/src/exports/Text/index.js +++ b/packages/react-native-web/src/exports/Text/index.js @@ -131,8 +131,8 @@ const Text = forwardRef((props, forwardedRef) => { if (rel != null) { supportedProps.rel = rel; } - if (typeof target === 'string' && target.charAt(0) !== '_') { - supportedProps.target = '_' + target; + if (typeof target === 'string') { + supportedProps.target = target.charAt(0) !== '_' ? '_' + target : target; } } diff --git a/packages/react-native-web/src/exports/View/__tests__/__snapshots__/index-test.js.snap b/packages/react-native-web/src/exports/View/__tests__/__snapshots__/index-test.js.snap index 7e35f278..d630684f 100644 --- a/packages/react-native-web/src/exports/View/__tests__/__snapshots__/index-test.js.snap +++ b/packages/react-native-web/src/exports/View/__tests__/__snapshots__/index-test.js.snap @@ -95,6 +95,14 @@ exports[`components/View prop "hrefAttrs" requires "href" 1`] = ` /> `; +exports[`components/View prop "hrefAttrs" target variant is set 1`] = ` + +`; + exports[`components/View prop "hrefAttrs" value is set 1`] = ` { expect(container.firstChild).toMatchSnapshot(); }); + test('target variant is set', () => { + const hrefAttrs = { + target: 'blank' + }; + const { container } = render(); + expect(container.firstChild).toMatchSnapshot(); + }); + test('null values are excluded', () => { const hrefAttrs = { download: null,