1 | import * as React from 'react';
|
2 | import { Platform, Text } from 'react-native';
|
3 | import useLinkProps from './useLinkProps';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export default function Link(_ref) {
|
14 | let {
|
15 | to,
|
16 | action,
|
17 | ...rest
|
18 | } = _ref;
|
19 | const props = useLinkProps({
|
20 | to,
|
21 | action
|
22 | });
|
23 |
|
24 | const onPress = e => {
|
25 | if ('onPress' in rest) {
|
26 | var _rest$onPress;
|
27 |
|
28 | (_rest$onPress = rest.onPress) === null || _rest$onPress === void 0 ? void 0 : _rest$onPress.call(rest, e);
|
29 | }
|
30 |
|
31 | props.onPress(e);
|
32 | };
|
33 |
|
34 | return React.createElement(Text, { ...props,
|
35 | ...rest,
|
36 | ...Platform.select({
|
37 | web: {
|
38 | onClick: onPress
|
39 | },
|
40 | default: {
|
41 | onPress
|
42 | }
|
43 | })
|
44 | });
|
45 | }
|
46 |
|
\ | No newline at end of file |