@olea-bps/views 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import { useState, useMemo, useCallback, useEffect } from 'react';
16
- import { View, Text, TextInput, TouchableOpacity, StyleSheet, Dimensions, SafeAreaView, KeyboardAvoidingView, Platform, ActivityIndicator } from 'react-native';
16
+ import { View, Text, TextInput, TouchableOpacity, StyleSheet, Dimensions, SafeAreaView, KeyboardAvoidingView, Platform, ActivityIndicator, Linking } from 'react-native';
17
17
  import { connect } from 'react-redux';
18
18
  import { withTheme, Headline } from 'react-native-paper';
19
19
  import componentStyles from "./styles";
@@ -167,6 +167,25 @@ function TimetableViewCalendar(props) {
167
167
  // Unter verwendung von Luxon wird eine Liste der Monatsnamen generiert, dabei wird die eingestellte Sprache berücksichtigt
168
168
  const months = moment.months();
169
169
 
170
+ const renderTextWithLinks = (text) => {
171
+ const parts = text.split(/(https?:\/\/[^\s]+)/g);
172
+ return parts.map((part, index) => {
173
+ if (part.match(/https?:\/\/[^\s]+/)) {
174
+ const displayText = part.replace(/https?:\/\//, '');
175
+ return (
176
+ <Text
177
+ key={index}
178
+ style={styles.link}
179
+ onPress={() => Linking.openURL(part)}
180
+ >
181
+ {displayText}
182
+ </Text>
183
+ );
184
+ }
185
+ return part;
186
+ });
187
+ };
188
+
170
189
  const handleImportButtonPress = () => {
171
190
  setLoading(true);
172
191
  setErrorMessage('');
@@ -269,7 +288,7 @@ function TimetableViewCalendar(props) {
269
288
  dataDetectorType="link"
270
289
  selectable
271
290
  >
272
- {infoMessage}
291
+ {renderTextWithLinks(infoMessage)}
273
292
  </Text>
274
293
  ) : null}
275
294
 
@@ -112,6 +112,10 @@ export default function (theme) {
112
112
  infoText: {
113
113
  color: 'black',
114
114
  marginLeft: 5,
115
+ },
116
+ link: {
117
+ textDecorationLine: 'underline',
118
+ color: '#007bff',
115
119
  }
116
120
  };
117
121
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olea-bps/views",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Consolidated views for OLEA",
5
5
  "main": "index.js",
6
6
  "repository": {