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({
|
14 | to,
|
15 | action,
|
16 | ...rest
|
17 | }) {
|
18 | const props = useLinkProps({
|
19 | to,
|
20 | action
|
21 | });
|
22 |
|
23 | const onPress = e => {
|
24 | if ('onPress' in rest) {
|
25 | var _rest$onPress;
|
26 |
|
27 | (_rest$onPress = rest.onPress) === null || _rest$onPress === void 0 ? void 0 : _rest$onPress.call(rest, e);
|
28 | }
|
29 |
|
30 | props.onPress(e);
|
31 | };
|
32 |
|
33 | return React.createElement(Text, { ...props,
|
34 | ...rest,
|
35 | ...Platform.select({
|
36 | web: {
|
37 | onClick: onPress
|
38 | },
|
39 | default: {
|
40 | onPress
|
41 | }
|
42 | })
|
43 | });
|
44 | }
|
45 |
|
\ | No newline at end of file |