@olea-bps/base 1.0.2 → 1.0.4

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.
@@ -24,7 +24,7 @@ import CollektorVersion2ApiProvider from './CollektorVersion2ApiProvider';
24
24
 
25
25
  /**
26
26
  * @typedef Ticket
27
- * @property {string} barcode
27
+ * @property {string} barcode URL oder Data-URI für den Ticketbarcode als Bild
28
28
  * @property {string} owner
29
29
  * @property {date} valid_from
30
30
  * @property {date} valid_to
@@ -32,7 +32,7 @@ import CollektorVersion2ApiProvider from './CollektorVersion2ApiProvider';
32
32
 
33
33
  /**
34
34
  * @typedef PublicTransportTicketContext
35
- * @property {string} ticketBarcode
35
+ * @property {string} ticketBarcode Barcode Data-URI/URL
36
36
  * @property {string} ticketOwner
37
37
  * @property {string} ticketValidFrom
38
38
  * @property {string} ticketValidTo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olea-bps/base",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "OLEA base library",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -12,13 +12,27 @@
12
12
  * limitations under the License.
13
13
  */
14
14
 
15
- import { useState, useEffect, useMemo, useCallback } from 'react';
16
- import { AppState, SafeAreaView, View, ScrollView, StyleSheet, Alert, useWindowDimensions, RefreshControl } from 'react-native';
15
+ import {
16
+ useState,
17
+ useEffect,
18
+ useMemo,
19
+ useCallback,
20
+ } from 'react';
21
+ import {
22
+ AppState,
23
+ SafeAreaView,
24
+ View,
25
+ ScrollView,
26
+ StyleSheet,
27
+ Alert,
28
+ RefreshControl,
29
+ Image,
30
+ useWindowDimensions,
31
+ } from 'react-native';
17
32
 
18
33
  import { useTheme, Text, Button } from 'react-native-paper';
19
34
  import { useFocusEffect } from '@react-navigation/native';
20
35
  import { useTranslation } from 'react-i18next';
21
- import QRCode from 'react-native-qrcode-svg';
22
36
 
23
37
  import AppbarComponent from '../../components/AppBar';
24
38
  import { useUser } from '../../context/context-user';
@@ -31,6 +45,7 @@ import componentStyles from './styles';
31
45
  */
32
46
  export default function PublicTransportTicketView() {
33
47
  const componentName = PublicTransportTicketView.name;
48
+ const { height: windowHeight } = useWindowDimensions();
34
49
  // Get theme from theme context
35
50
  const theme = useTheme();
36
51
  const { themeStyles } = theme;
@@ -39,7 +54,6 @@ export default function PublicTransportTicketView() {
39
54
 
40
55
  const [user, login] = useUser();
41
56
  const [ticketBarcode, ticketOwner, ticketValidFrom, ticketValidTo, refreshTicket] = usePublicTransportTicket();
42
- const { width } = useWindowDimensions();
43
57
 
44
58
  const [refreshingTicketScrollView, setRefreshingTicketScrollView] = useState(false);
45
59
 
@@ -114,9 +128,16 @@ export default function PublicTransportTicketView() {
114
128
  ticketBarcode
115
129
  ? <>
116
130
  <View>
117
- <QRCode
118
- value={ticketBarcode}
119
- size={width * 0.8}
131
+ <Image
132
+ style={{
133
+ // Der Barcode soll die Hälfte der Bildschirmhöhe ausfüllen.
134
+ height: windowHeight / 2,
135
+ width: '100%',
136
+ }}
137
+ source={{ uri: ticketBarcode }}
138
+ // Barcode soll auf die passende Größe angepasst und zentriert werden.
139
+ // Beim anpassen, wird das Seitenverhältnis beibehalten.
140
+ resizeMode='center'
120
141
  />
121
142
  </View>
122
143
  <Text>