Skip to content

Commit ddd5902

Browse files
shubhamzanwara7ul
authored andcommitted
improv: enabling external text links (#123)
* components: adding open extenal links prop to text * demo: using text with an external link in demo
1 parent b922d76 commit ddd5902

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/components/Text/RNText.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface TextProps extends ViewProps<QLabelSignals> {
77
children?: string | number;
88
wordWrap?: boolean;
99
scaledContents?: boolean;
10+
openExternalLinks?: boolean;
1011
}
1112

1213
/**
@@ -26,6 +27,9 @@ export const setTextProps = (
2627
},
2728
set scaledContents(scaled: boolean) {
2829
widget.setProperty("scaledContents", scaled);
30+
},
31+
set openExternalLinks(shouldOpenExternalLinks: boolean) {
32+
widget.setProperty("openExternalLinks", shouldOpenExternalLinks);
2933
}
3034
};
3135
Object.assign(setter, newProps);

src/demo.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
Window,
66
View,
77
AnimatedImage,
8-
ComboBox
8+
ComboBox,
9+
Text
910
} from "./index";
1011
import { QIcon, QVariant, QPushButtonSignals } from "@nodegui/nodegui";
1112
import { useEventHandler } from "./hooks";
@@ -31,6 +32,13 @@ const App = () => {
3132
return (
3233
<Window>
3334
<View style={containerStyle}>
35+
<Text openExternalLinks={true}>
36+
{`<a
37+
style="color: white"
38+
href="https://react.nodegui.org/docs/guides/getting-started/">
39+
docs
40+
</a>`}
41+
</Text>
3442
<View on={{}}>
3543
<Button on={handler} style={buttonStyle} text={"Hello"} />
3644
<Button style={buttonStyle} text={"World"} />

0 commit comments

Comments
 (0)