@olea-bps/base 1.0.3 → 1.0.5
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.
|
@@ -83,6 +83,12 @@ const CustomIcon = createIconSet(glyphMap, 'openasist');
|
|
|
83
83
|
* This component handles the load of the icon font and
|
|
84
84
|
* provides a simple way to include these icons.
|
|
85
85
|
*
|
|
86
|
+
* Icon lookup precedence:
|
|
87
|
+
* 1. `iconSVG` prop (explicit React component)
|
|
88
|
+
* 2. `theme.icons[icon]` (per-app SVG registry)
|
|
89
|
+
* 3. `theme.AppIcons` (per-app font icon set)
|
|
90
|
+
* 4. library-default `CustomIcon` font icon set
|
|
91
|
+
*
|
|
86
92
|
* Parameters:
|
|
87
93
|
* - icon: Name (slug) of the icon
|
|
88
94
|
* - size: Size (as Number) of the icon
|
|
@@ -94,6 +100,7 @@ const CustomIcon = createIconSet(glyphMap, 'openasist');
|
|
|
94
100
|
function IconsOpenasist({ icon, iconSVG: IconSVG, size, color, accessibilityLabel, ...props }) {
|
|
95
101
|
const theme = useTheme();
|
|
96
102
|
const { AppIcons } = theme;
|
|
103
|
+
const ThemeIcon = theme.icons?.[icon];
|
|
97
104
|
|
|
98
105
|
const iconSize = size ?? 26;
|
|
99
106
|
const iconAriaLabel = props?.['aria-label'] ?? accessibilityLabel ?? null;
|
|
@@ -113,6 +120,14 @@ function IconsOpenasist({ icon, iconSVG: IconSVG, size, color, accessibilityLabe
|
|
|
113
120
|
height={iconSize}
|
|
114
121
|
/>
|
|
115
122
|
);
|
|
123
|
+
} else if (typeof ThemeIcon === 'function') {
|
|
124
|
+
return (
|
|
125
|
+
<ThemeIcon
|
|
126
|
+
{...iconProps}
|
|
127
|
+
width={iconSize}
|
|
128
|
+
height={iconSize}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
116
131
|
} else if (AppIcons) {
|
|
117
132
|
return (
|
|
118
133
|
<AppIcons
|
package/package.json
CHANGED
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
* limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
useState,
|
|
17
|
+
useEffect,
|
|
18
|
+
useMemo,
|
|
19
|
+
useCallback,
|
|
20
|
+
} from 'react';
|
|
16
21
|
import {
|
|
17
22
|
AppState,
|
|
18
23
|
SafeAreaView,
|
|
@@ -20,9 +25,9 @@ import {
|
|
|
20
25
|
ScrollView,
|
|
21
26
|
StyleSheet,
|
|
22
27
|
Alert,
|
|
23
|
-
useWindowDimensions,
|
|
24
28
|
RefreshControl,
|
|
25
29
|
Image,
|
|
30
|
+
useWindowDimensions,
|
|
26
31
|
} from 'react-native';
|
|
27
32
|
|
|
28
33
|
import { useTheme, Text, Button } from 'react-native-paper';
|
|
@@ -40,6 +45,7 @@ import componentStyles from './styles';
|
|
|
40
45
|
*/
|
|
41
46
|
export default function PublicTransportTicketView() {
|
|
42
47
|
const componentName = PublicTransportTicketView.name;
|
|
48
|
+
const { height: windowHeight } = useWindowDimensions();
|
|
43
49
|
// Get theme from theme context
|
|
44
50
|
const theme = useTheme();
|
|
45
51
|
const { themeStyles } = theme;
|
|
@@ -48,7 +54,6 @@ export default function PublicTransportTicketView() {
|
|
|
48
54
|
|
|
49
55
|
const [user, login] = useUser();
|
|
50
56
|
const [ticketBarcode, ticketOwner, ticketValidFrom, ticketValidTo, refreshTicket] = usePublicTransportTicket();
|
|
51
|
-
const { width } = useWindowDimensions();
|
|
52
57
|
|
|
53
58
|
const [refreshingTicketScrollView, setRefreshingTicketScrollView] = useState(false);
|
|
54
59
|
|
|
@@ -124,7 +129,15 @@ export default function PublicTransportTicketView() {
|
|
|
124
129
|
? <>
|
|
125
130
|
<View>
|
|
126
131
|
<Image
|
|
132
|
+
style={{
|
|
133
|
+
// Der Barcode soll die Hälfte der Bildschirmhöhe ausfüllen.
|
|
134
|
+
height: windowHeight / 2,
|
|
135
|
+
width: '100%',
|
|
136
|
+
}}
|
|
127
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'
|
|
128
141
|
/>
|
|
129
142
|
</View>
|
|
130
143
|
<Text>
|