Repository navigation
Expand file tree
/
Copy pathApp.js
More file actions
115 lines (107 loc) · 3.21 KB
/
Copy pathApp.js
File metadata and controls
115 lines (107 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import React from 'react';
import {
StyleSheet,
ScrollView,
View,
Text
} from 'react-native';
import Hyperlink from 'react-native-hyperlink';
const App = () => {
return (
<View style={{flex: 1}}>
<ScrollView
contentInsetAdjustmentBehavior="automatic">
<View style={styles.container}>
<View style={styles.sectionContainer}>
<Text style={styles.header}>
Example of React Native Hyperlink
</Text>
<Text style={styles.sectionTitle}>
Without Hyperlink
</Text>
<Text style={styles.sectionDescription}>
Please click on https://aboutreact.com to check if it
can do any action
</Text>
<Text style={styles.sectionTitle}>
Hyperlink and Click to open in Browser
</Text>
<Hyperlink linkDefault={true}>
<Text style={styles.sectionDescription}>
Please click on https://aboutreact.com to check if it
can do any action
</Text>
</Hyperlink>
<Text style={styles.sectionTitle}>
Hyperlink and Click to get the url in onPress
</Text>
<Hyperlink
onPress={(url, text) => alert(url + ', ' + text)}>
<Text style={styles.sectionDescription}>
Please click on https://aboutreact.com to check if it
can do any action
</Text>
</Hyperlink>
<Text style={styles.sectionTitle}>
Hyperlink and Custom Styling of Hyperlink
</Text>
<Hyperlink
linkStyle={{color: '#2980b9', fontSize: 16}}
onPress={(url, text) => alert(url + ', ' + text)}>
<Text style={styles.sectionDescription}>
Please click on https://aboutreact.com to check if it
can do any action
</Text>
</Hyperlink>
<Text style={styles.sectionTitle}>
Hyperlink, Custom styling and Replace URL with String
</Text>
<Hyperlink
linkStyle={{color: '#2980b9', fontSize: 16}}
onPress={(url, text) => alert(url + ', ' + text)}
linkText={(url) =>
url === 'https://aboutreact.com' ? 'AboutReact' : url
}>
<Text style={styles.sectionDescription}>
Please click on https://aboutreact.com to check if it
can do any action
</Text>
</Hyperlink>
</View>
</View>
</ScrollView>
</View>
);
};
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center',
textAlign: 'center',
padding: 10,
},
header: {
fontSize: 22,
fontWeight: '600',
color: 'black',
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 18,
fontWeight: '600',
color: 'black',
marginTop: 30,
},
sectionDescription: {
marginTop: 8,
fontSize: 15,
fontWeight: '400',
color: 'black',
},
});