@olea-bps/base 1.1.4 → 1.1.6

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.
@@ -0,0 +1,42 @@
1
+ import { useCallback } from 'react';
2
+ import { ColorValue } from 'react-native';
3
+
4
+ import {
5
+ Appbar,
6
+ useTheme,
7
+ } from 'react-native-paper';
8
+
9
+ import IconsOpenasist from '../../libraries/icons-openasist';
10
+
11
+ /**
12
+ * Eine Action, welche die Icons über die {@link IconsOpenasist}-Komponente einbindet.
13
+ * Es werden alle Properties der {@link Appbar.Action}-Komponente unterstüzt.
14
+ * Die `icon`-Property wird auf eine andere Art und Weise verwendet.
15
+ * Wird keine Farbe übergeben, wird die primäre Textfarbe (`primaryText`) aus den Theme verwendet.
16
+ *
17
+ * @param {object} props - Es werden die Properties der {@link Appbar.Action}-Komponente unsterstützt
18
+ * @param {string} props.icon - Name eines Icons, welches über die {@link IconsOpenasist} angezeigt werden kann.
19
+ * @param {?ColorValue} props.color - Farbe des Icons. Wenn keine Farbe übergeben wird, wird die primäre Textfarbe (`primaryText`) aus den Theme verwendet.
20
+ * @returns
21
+ */
22
+ export default function AppbarAction({ icon, color, ...rest }) {
23
+ const theme = useTheme();
24
+ const iconColor = color ?? theme?.colors?.primaryText;
25
+
26
+ const iconCallback = useCallback(
27
+ props =>
28
+ <IconsOpenasist
29
+ {...props}
30
+ icon={icon}
31
+ color={iconColor}
32
+ />,
33
+ [icon, iconColor]
34
+ );
35
+
36
+ return (
37
+ <Appbar.Action
38
+ {...rest}
39
+ icon={iconCallback}
40
+ />
41
+ );
42
+ }
@@ -30,8 +30,9 @@ import { libraryApi } from '../../libraries/core';
30
30
  import { handleHtmlEntities } from '../../libraries/core/helper/format.helper';
31
31
 
32
32
 
33
- import componentStyles from "./styles"
33
+ import componentStyles from './styles';
34
34
  import AppbarComponent from '../AppBar';
35
+ import AppbarAction from '../AppbarAction';
35
36
 
36
37
 
37
38
  class BookDetailComponent extends React.Component {
@@ -248,9 +249,11 @@ class BookDetailComponent extends React.Component {
248
249
 
249
250
  return (
250
251
  <SafeAreaView style={[this.styles.container, themeStyles.safeAreaContainer]}>
251
- <AppbarComponent {...this.props}
252
- title={t('search:title')}
253
- rightAction={<Appbar.Action icon="share-variant" onPress={this._onShare.bind(this)}/>}/>
252
+ <AppbarComponent
253
+ {...this.props}
254
+ title={t('search:title')}
255
+ rightAction={<AppbarAction icon='share' onPress={this._onShare.bind(this)} />}
256
+ />
254
257
  {this._renderContent()}
255
258
  </SafeAreaView>
256
259
  );
@@ -12,29 +12,34 @@
12
12
  * limitations under the License.
13
13
  */
14
14
 
15
- import React from 'react';
16
- import PropTypes from 'prop-types';
15
+ import {
16
+ useCallback,
17
+ useMemo
18
+ } from 'react';
17
19
 
18
20
  import {
19
- StyleSheet,
20
- Text,
21
- View,
21
+ Linking,
22
+ Platform,
22
23
  SafeAreaView,
24
+ ScrollView,
23
25
  Share,
24
- Linking,
26
+ StyleSheet,
27
+ Text,
25
28
  TouchableOpacity,
26
- Platform,
27
- ScrollView
29
+ View,
28
30
  } from 'react-native';
29
- import {Appbar, Headline, List, withTheme} from "react-native-paper";
31
+ import {
32
+ Headline,
33
+ List,
34
+ useTheme,
35
+ } from "react-native-paper";
30
36
 
31
- import { connect } from 'react-redux'
32
- import {withTranslation} from "react-i18next";
33
- import merge from 'lodash/merge';
37
+ import { useTranslation } from "react-i18next";
34
38
 
35
- import componentStyles from "./styles"
39
+ import componentStyles from './styles';
36
40
  import AppbarComponent from '../AppBar';
37
-
41
+ import AppbarAction from '../AppbarAction';
42
+ import { default as Icon } from '../../libraries/icons-openasist';
38
43
 
39
44
  /**
40
45
  * Contact Detail Component
@@ -42,191 +47,168 @@ import AppbarComponent from '../AppBar';
42
47
  * Shows the detailed information of a contact with name and contact details.
43
48
  * Provides a share functionality.
44
49
  *
45
- * Parameters:
46
- * - contact: Contact object with all information about the contact
47
- *
48
- * Navigation-Parameters:
49
- * - none
50
+ * @param {object} props
51
+ * @param {object} props.contact - Der anzuzeigende Kontakt
50
52
  */
51
- class ContactDetailComponent extends React.Component {
52
- static propTypes = {
53
- contact: PropTypes.object.isRequired
54
- };
55
-
56
- // Styles of this component
57
- styles;
58
-
59
- contact = null;
60
-
61
-
62
- constructor(props) {
63
- super(props);
64
- // ------------------------------------------------------------------------
65
- // PLUGIN FUNCTIONALITY
66
- // ------------------------------------------------------------------------
67
-
68
- const { pluginStyles,theme } = this.props;
69
- this.styles = componentStyles(theme);
70
-
71
- if(pluginStyles) {
72
- this.styles = merge(this.styles, pluginStyles);
73
- }
74
-
75
- this.styles = StyleSheet.create(this.styles);
76
-
77
- // ------------------------------------------------------------------------
78
- };
79
-
80
- /**
81
- * Share function for contact
82
- *
83
- * @returns {Promise<void>}
84
- * @private
85
- */
86
- async _onShare() {
87
- try {
88
- const { t } = this.props;
89
-
90
- let phone = "";
91
- if(this.contact.telephone.length > 0) {
92
- phone += "\n"+ t('contact:phone') +": ";
93
- this.contact.telephone.forEach((phoneNumber) => {
94
- phone += phoneNumber.number + '\n';
53
+ export default function ContactDetailComponent({ contact, ...restProps }) {
54
+ const theme = useTheme();
55
+ const { themeStyles } = theme;
56
+ const { t } = useTranslation();
57
+
58
+ const styles = useMemo(
59
+ () => StyleSheet.create(componentStyles(theme)),
60
+ [theme, componentStyles]
61
+ );
62
+
63
+ const onShare = useCallback(
64
+ async () => {
65
+ try {
66
+ // Telephone-Objekte aus dem Kontakt auslesen. Falls diese nicht vorhanden sind, mit einem leeren Array initialisieren
67
+ const contactTelephones = contact?.telephone ?? [];
68
+ const shareMessageTelephoneNumbers = contactTelephones
69
+ .map(telephone => telephone.number)
70
+ .map(number => `${t('contact:phone')}: ${number}`)
71
+ .join('\n');
72
+
73
+ const shareMessage = `${t('contact:title')} - ${contact.firstName} ${contact.lastName}`
74
+ +
75
+ (
76
+ contact?.building
77
+ ? `\n${t('contact:building')}: ${contact.building}`
78
+ : ''
79
+ )
80
+ +
81
+ (
82
+ contact?.department
83
+ ? `\n${t('contact:department')}: ${contact.department}`
84
+ : ''
85
+ )
86
+ +
87
+ (
88
+ contact?.room?.title
89
+ ? `\n${t('contact:room')}: ${contact.room.title}`
90
+ : ''
91
+ )
92
+ +
93
+ (
94
+ contact?.email
95
+ ? `\n${t('contact:email')}: ${contact.email}`
96
+ : ''
97
+ )
98
+ +
99
+ (
100
+ shareMessageTelephoneNumbers
101
+ ? '\n' + shareMessageTelephoneNumbers
102
+ : ''
103
+ );
104
+
105
+ await Share.share({
106
+ message: shareMessage,
95
107
  });
108
+ } catch (error) {
109
+ alert(error.message);
96
110
  }
97
-
98
- let message = t('contact:title') + ' - ' + this.contact.firstName + ' ' + this.contact.lastName +
99
- ((this.contact.building) ? "\n" + t('contact:building') + ": " + this.contact.building : '') +
100
- ((this.contact.department) ? "\n" + t('contact:department') + ": " + this.contact.department : '') +
101
- ((this.contact.room && this.contact.room.title) ? "\n" + t('contact:room') + ": " + this.contact.room.title : '') +
102
- ((this.contact.email) ? "\n" + t('contact:email') + ": " + this.contact.email : '') +
103
- phone;
104
-
105
- const result = await Share.share({
106
- message: message
107
- });
108
-
109
- if (result.action === Share.sharedAction) {
110
- if (result.activityType) {
111
- // shared with activity type of result.activityType
112
- } else {
113
- // shared
111
+ },
112
+ [contact, t]
113
+ );
114
+
115
+ return contact
116
+ ? <SafeAreaView style={[styles.container, themeStyles.safeAreaContainer]}>
117
+ <AppbarComponent
118
+ {...restProps}
119
+ title={t('contact:contactInformation')}
120
+ rightAction={<AppbarAction icon='share' onPress={onShare} />}
121
+ />
122
+ <ScrollView style={styles.containerInner}>
123
+ <Headline style={styles.name}>{contact.firstName} {contact.lastName}</Headline>
124
+ {
125
+ contact?.building
126
+ ? <List.Item
127
+ key="building"
128
+ title={t('contact:building')}
129
+ description={contact.building}
130
+ descriptionStyle={themeStyles.textLighter}
131
+ titleStyle={themeStyles.searchDetailTitle}
132
+ descriptionNumberOfLines={200} />
133
+ : null
114
134
  }
115
- } else if (result.action === Share.dismissedAction) {
116
- // dismissed
117
- }
118
- } catch (error) {
119
- alert(error.message);
120
- }
121
- };
122
-
123
- /**
124
- * Render contact details content
125
- *
126
- * @returns {*}
127
- * @private
128
- */
129
- _renderContent = () => {
130
- const { contact, t } = this.props;
131
- const { themeStyles } = this.props.theme;
132
-
133
- let output = [];
134
- let index = 1;
135
-
136
-
137
-
138
-
139
- if(contact.building)
140
- output.push(<List.Item key="building" title={t('contact:building')} description={contact.building}
141
- descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
142
- descriptionNumberOfLines={200}/>);
143
-
144
- if(contact.department)
145
- output.push(<List.Item key="department" title={t('contact:department')} description={contact.department}
146
- descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
147
- descriptionNumberOfLines={200}/>);
148
-
149
- if(contact.room && contact.room.title)
150
- output.push(<List.Item key="room" title={t('contact:room')} description={contact.room.title}
151
- descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
152
- descriptionNumberOfLines={200}/>);
153
-
154
- if(contact.email)
155
- output.push(<TouchableOpacity key="email" onPress={() => Linking.openURL('mailto:' + contact.email)}>
156
- <List.Item title={t('contact:email')} description={contact.email}
157
- descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
158
- right={props => <List.Icon {...props} icon="email"/>}/>
159
- </TouchableOpacity>
160
- );
161
-
162
- if(contact.telephone.length > 0) {
163
- contact.telephone.forEach((phoneNumber) => {
164
- output.push(
165
- <TouchableOpacity key={'phone_'+ index} onPress={() => {
166
- const formattedPhoneNumber = phoneNumber.number.replace(/\s/g, '');
167
- Linking.openURL('tel:' + formattedPhoneNumber).catch(error => console.error(`ContactDetailComponent - Fehler beim öffnen des Telefons ${Platform.OS}`, error));
168
- }}>
169
- <List.Item
170
- title={t('contact:phone') + ' ' + index}
171
- description={phoneNumber.number}
135
+ {
136
+ contact?.department
137
+ ? <List.Item
138
+ key="department"
139
+ title={t('contact:department')}
140
+ description={contact.department}
172
141
  descriptionStyle={themeStyles.textLighter}
173
142
  titleStyle={themeStyles.searchDetailTitle}
174
- right={props =>
175
- <List.Icon {...props}
176
- icon="phone"/>}
177
- />
178
- </TouchableOpacity>
179
- );
180
- index++;
181
- });
182
- }
183
-
184
-
185
- return (
186
- <ScrollView style={this.styles.containerInner}>
187
- <Headline style={this.styles.name}>{contact.firstName} {contact.lastName}</Headline>
188
- {output}
189
- <View style={this.styles.space}/>
143
+ descriptionNumberOfLines={200} />
144
+ : null
145
+ }
146
+ {
147
+ contact?.room && contact?.room?.title
148
+ ? <List.Item
149
+ key="room"
150
+ title={t('contact:room')}
151
+ description={contact.room.title}
152
+ descriptionStyle={themeStyles.textLighter}
153
+ titleStyle={themeStyles.searchDetailTitle}
154
+ descriptionNumberOfLines={200} />
155
+ : null
156
+ }
157
+ {
158
+ contact?.email
159
+ ? <TouchableOpacity
160
+ key="email"
161
+ onPress={() => Linking.openURL('mailto:' + contact.email)}
162
+ >
163
+ <List.Item
164
+ title={t('contact:email')}
165
+ description={contact.email}
166
+ descriptionStyle={themeStyles.textLighter}
167
+ titleStyle={themeStyles.searchDetailTitle}
168
+ right={props => <List.Icon {...props} icon="email" />}
169
+ />
170
+ </TouchableOpacity>
171
+ : null
172
+ }
173
+ {
174
+ Array.isArray(contact?.telephone)
175
+ ? contact.telephone.map(
176
+ (telephone, index, telephones) => {
177
+
178
+ const title = telephones.length == 1
179
+ ? t('contact:phone')
180
+ : t('contact:phone') + ' ' + index;
181
+
182
+ const telephoneNumber = telephone.number
183
+
184
+ return (
185
+ <TouchableOpacity
186
+ key={telephoneNumber}
187
+ onPress={
188
+ () => {
189
+ const formattedPhoneNumber = telephone.number.replace(/\s/g, '');
190
+ Linking.openURL('tel:' + formattedPhoneNumber).catch(error => console.error(`ContactDetailComponent - Fehler beim öffnen des Telefons ${Platform.OS}`, error));
191
+ }
192
+ }
193
+ >
194
+ <List.Item
195
+ title={title}
196
+ description={telephoneNumber}
197
+ descriptionStyle={themeStyles.textLighter}
198
+ titleStyle={themeStyles.searchDetailTitle}
199
+ right={props => <Icon {...props} icon={'call'} />}
200
+ />
201
+ </TouchableOpacity>
202
+ )
203
+ }
204
+ )
205
+ : null
206
+ }
207
+ <View style={styles.space} />
190
208
  </ScrollView>
191
- );
192
- };
193
-
194
- render() {
195
- // ------------------------------------------------------------------------
196
- // PLUGIN FUNCTIONALITY
197
- // ------------------------------------------------------------------------
198
- const PluginComponent = this.props.pluginComponent;
199
- if (PluginComponent) {
200
- return <PluginComponent />;
201
- }
202
- // ------------------------------------------------------------------------
203
-
204
- const {themeStyles} = this.props.theme;
205
- const { contact, t } = this.props;
206
-
207
- if(!contact){
208
- return (<Text>{t('contact:couldNotLoad')}</Text>);
209
- }
210
-
211
- this.contact = contact;
212
-
213
- return (
214
- <SafeAreaView style={[this.styles.container, themeStyles.safeAreaContainer]}>
215
- <AppbarComponent {...this.props}
216
- title={t('contact:contactInformation')}
217
- rightAction={<Appbar.Action icon="share-variant" onPress={this._onShare.bind(this)}/>}/>
218
- {this._renderContent()}
219
- </SafeAreaView>
220
- );
221
- }
222
- }
223
-
224
-
225
- const mapStateToProps = state => {
226
- return {
227
- pluginComponent: state.pluginReducer.contactDetail.component,
228
- pluginStyles: state.pluginReducer.contactDetail.styles
229
- };
230
- };
209
+ </SafeAreaView>
231
210
 
232
- export default connect(mapStateToProps, null)(withTranslation()(withTheme(ContactDetailComponent)))
211
+ : <Text>
212
+ {t('contact:couldNotLoad')}
213
+ </Text>;
214
+ }
@@ -24,10 +24,11 @@ import {Appbar, Headline, List, withTheme} from "react-native-paper";
24
24
  import { connect } from 'react-redux'
25
25
  import merge from 'lodash/merge';
26
26
 
27
- import componentStyles from "./styles"
27
+ import componentStyles from './styles';
28
28
  import AppbarComponent from '../AppBar';
29
+ import AppbarAction from '../AppbarAction';
29
30
  import IconsOpenasist from '../../libraries/icons-openasist';
30
- import {withTranslation} from "react-i18next";
31
+ import { withTranslation } from 'react-i18next';
31
32
 
32
33
 
33
34
  /**
@@ -339,9 +340,11 @@ class CourseDetailComponent extends React.Component {
339
340
 
340
341
  return (
341
342
  <SafeAreaView style={[this.styles.container, themeStyles.appSafeAreaContainer]}>
342
- <AppbarComponent {...this.props}
343
- title={t('course:lectureInformation')}
344
- rightAction={<Appbar.Action icon="share-variant" onPress={this._onShare.bind(this)}/>}/>
343
+ <AppbarComponent
344
+ {...this.props}
345
+ title={t('course:lectureInformation')}
346
+ rightAction={<AppbarAction icon='share' onPress={this._onShare.bind(this)} />}
347
+ />
345
348
  {this._renderContent()}
346
349
  </SafeAreaView>
347
350
  );
@@ -37,8 +37,9 @@ import moment from "moment";
37
37
  import WebViewAutoHeight from '../../libraries/react-native-webview-autoheight';
38
38
 
39
39
 
40
- import componentStyles from "./styles"
40
+ import componentStyles from './styles';
41
41
  import AppbarComponent from '../AppBar';
42
+ import AppbarAction from '../AppbarAction';
42
43
  import { selectFeedById } from '../../libraries/core/redux/reducers/api';
43
44
 
44
45
 
@@ -350,9 +351,15 @@ class NewsDetailComponent extends React.Component {
350
351
 
351
352
  return (
352
353
  <SafeAreaView style={[this.styles.container, themeStyles.appSafeAreaContainer]}>
353
- <AppbarComponent {...this.props}
354
- title={title}
355
- rightAction={newsType ? null : <Appbar.Action icon="share-variant" onPress={this._onShare.bind(this)}/>}/>
354
+ <AppbarComponent
355
+ {...this.props}
356
+ title={title}
357
+ rightAction={
358
+ newsType
359
+ ? null
360
+ : <AppbarAction icon='share' onPress={this._onShare.bind(this)} />
361
+ }
362
+ />
356
363
  {newsType === NewsDetailComponent.newsTypes.topNews ? this._renderTopNewsContent(news) : this._renderContent(news)}
357
364
  </SafeAreaView>
358
365
  );
@@ -20,17 +20,22 @@ import {
20
20
  Share,
21
21
  TouchableOpacity, ActivityIndicator
22
22
  } from 'react-native';
23
- import {connect} from 'react-redux'
24
- import {Appbar, Headline, List, withTheme} from "react-native-paper";
25
- import {withTranslation} from "react-i18next";
23
+ import { connect } from 'react-redux'
24
+ import {
25
+ Appbar,
26
+ Headline,
27
+ List,
28
+ withTheme,
29
+ } from "react-native-paper";
30
+ import { withTranslation } from "react-i18next";
31
+ import { WebView } from "react-native-webview";
26
32
  import merge from 'lodash/merge';
27
33
 
28
-
29
34
  import AppbarComponent from '../AppBar';
35
+ import AppbarAction from '../AppbarAction';
30
36
  import IconsOpenasist from '../../libraries/icons-openasist';
31
37
 
32
- import componentStyles from "./styles";
33
- import {WebView} from "react-native-webview";
38
+ import componentStyles from './styles';
34
39
 
35
40
  /**
36
41
  * Room Detail Component
@@ -262,9 +267,11 @@ class RoomDetailComponent extends React.Component {
262
267
 
263
268
  return (
264
269
  <SafeAreaView style={[this.styles.container, themeStyles.safeAreaContainer]}>
265
- <AppbarComponent {...this.props}
266
- title={t('room:directory')}
267
- rightAction={<Appbar.Action icon="share-variant" onPress={this._onShare.bind(this)}/>}/>
270
+ <AppbarComponent
271
+ {...this.props}
272
+ title={t('room:directory')}
273
+ rightAction={<AppbarAction icon='share' onPress={this._onShare.bind(this)} />}
274
+ />
268
275
  {this._renderContent()}
269
276
  </SafeAreaView>
270
277
  );
package/index.js CHANGED
@@ -2,7 +2,9 @@
2
2
  // Exports Components
3
3
 
4
4
  export { default as AppBar } from './components/AppBar';
5
+ export { default as AppbarAction } from './components/AppbarAction';
5
6
  export { default as BookDetail } from './components/BookDetail';
7
+ export { default as ComponentJobsFilter } from './components/ComponentJobsFilter';
6
8
  export { default as ConnectivityWarning } from './components/ConnectivityWarning';
7
9
  export { default as ContactDetail } from './components/ContactDetail';
8
10
  export { default as CourseDetail } from './components/CourseDetail';
@@ -26,10 +28,10 @@ export { default as QuickLinks } from './components/QuickLinks';
26
28
  export { default as RoomDetail } from './components/RoomDetail';
27
29
  export { default as ScaledImage } from './components/ScaledImage';
28
30
  export { default as SearchResults } from './components/SearchResults';
29
- export { default as SettingSection } from './components/SettingSection';
30
31
  export { default as SettingsDialog } from './components/SettingsDialog';
31
32
  export { default as SettingsDialogRadio } from './components/SettingsDialogRadio';
32
33
  export { default as SettingsDialogSelect } from './components/SettingsDialogSelect';
34
+ export { default as SettingSection } from './components/SettingSection';
33
35
  export { default as TimetableCodeInput } from './components/TimetableCodeInput';
34
36
  export { default as TimetableDay } from './components/TimetableDay';
35
37
  export { default as TimetableEvent } from './components/TimetableEvent';
@@ -39,7 +41,6 @@ export { default as TimetableWeek } from './components/TimetableWeek';
39
41
  export { default as TopNews } from './components/TopNews';
40
42
  export { default as TopNewsHtwk } from './components/TopNewsHtwk';
41
43
  export { default as WebView } from './components/WebView';
42
- export { default as ComponentJobsFilter } from './components/ComponentJobsFilter';
43
44
 
44
45
  // Exports Views
45
46
 
@@ -12,70 +12,69 @@
12
12
  * limitations under the License.
13
13
  */
14
14
 
15
- import React from 'react';
15
+ import React from 'react'
16
16
 
17
- import { useTheme } from "react-native-paper";
18
- import createIconSet from '@expo/vector-icons/createIconSet';
19
- import PropTypes from "prop-types";
20
- import { SvgCssUri } from 'react-native-svg';
21
- const glyphMap = {
22
- "bus": "a",
23
- "train": "b",
24
- "close": "c",
25
- "messages": "d",
26
- "menu": "e",
27
- "grid": "f",
28
- "more-horizontal": "g",
29
- "more-vertical": "h",
30
- "paperplane-outline": "i",
31
- "partlysunny": "j",
32
- "partlysunny-outline": "k",
33
- "rainy": "l",
34
- "rainy-outline": "m",
35
- "thunderstorm": "n",
36
- "thunderstorm-outline": "o",
37
- "sunny": "p",
38
- "sunny-outline": "q",
39
- "down": "r",
40
- "download": "s",
41
- "print": "t",
42
- "hilfe": "u",
43
- "back": "v",
44
- "lock": "w",
45
- "lock-open": "x",
46
- "navigation": "y",
47
- "forward": "z",
48
- "profile": "A",
49
- "opal": "B",
50
- "mensa": "C",
51
- "location": "D",
52
- "inbox": "E",
53
- "imprint": "F",
54
- "pts": "G",
55
- "feedback": "H",
56
- "book": "I",
57
- "news": "J",
58
- "up": "K",
59
- "tram": "L",
60
- "rss": "M",
61
- "map-search": "N",
62
- "m-start1": "O",
63
- "dashboard": "P",
64
- "timetable": "Q",
65
- "search": "R",
66
- "settings": "S",
67
- "coffee": "T",
68
- "check": "V",
69
- "star": "W",
70
- "star-selected": "X",
71
- "edit": "Y",
72
- "time": "A1",
73
- "open-external": "A2",
74
- "share": "1",
75
- "accessibility": "A3",
76
- };
77
- const CustomIcon = createIconSet(glyphMap, 'openasist');
17
+ import { useTheme } from 'react-native-paper'
18
+ import createIconSet from '@expo/vector-icons/createIconSet'
19
+ import PropTypes from 'prop-types'
78
20
 
21
+ const glyphMap = {
22
+ bus: 'a',
23
+ train: 'b',
24
+ close: 'c',
25
+ messages: 'd',
26
+ menu: 'e',
27
+ grid: 'f',
28
+ 'more-horizontal': 'g',
29
+ 'more-vertical': 'h',
30
+ 'paperplane-outline': 'i',
31
+ partlysunny: 'j',
32
+ 'partlysunny-outline': 'k',
33
+ rainy: 'l',
34
+ 'rainy-outline': 'm',
35
+ thunderstorm: 'n',
36
+ 'thunderstorm-outline': 'o',
37
+ sunny: 'p',
38
+ 'sunny-outline': 'q',
39
+ down: 'r',
40
+ download: 's',
41
+ print: 't',
42
+ hilfe: 'u',
43
+ back: 'v',
44
+ lock: 'w',
45
+ 'lock-open': 'x',
46
+ navigation: 'y',
47
+ forward: 'z',
48
+ profile: 'A',
49
+ opal: 'B',
50
+ mensa: 'C',
51
+ location: 'D',
52
+ inbox: 'E',
53
+ imprint: 'F',
54
+ pts: 'G',
55
+ feedback: 'H',
56
+ book: 'I',
57
+ news: 'J',
58
+ up: 'K',
59
+ tram: 'L',
60
+ rss: 'M',
61
+ 'map-search': 'N',
62
+ 'm-start1': 'O',
63
+ dashboard: 'P',
64
+ timetable: 'Q',
65
+ search: 'R',
66
+ settings: 'S',
67
+ coffee: 'T',
68
+ check: 'V',
69
+ star: 'W',
70
+ 'star-selected': 'X',
71
+ edit: 'Y',
72
+ time: 'A1',
73
+ 'open-external': 'A2',
74
+ share: '1',
75
+ accessibility: 'A3'
76
+ }
77
+ const CustomIcon = createIconSet(glyphMap, 'openasist')
79
78
 
80
79
  /**
81
80
  * Icons of the Openasist app
@@ -97,62 +96,62 @@ const CustomIcon = createIconSet(glyphMap, 'openasist');
97
96
  * Navigation-Parameters:
98
97
  * - none
99
98
  */
100
- function IconsOpenasist({ icon, iconSVG: IconSVG, size, color, accessibilityLabel, ...props }) {
101
- const theme = useTheme();
102
- const { AppIcons } = theme;
103
- const ThemeIcon = theme.icons?.[icon];
99
+ function IconsOpenasist ({ icon, iconSVG: IconSVG, size, color, accessibilityLabel, ...props }) {
100
+ const theme = useTheme()
101
+ const { AppIcons } = theme
102
+ const ThemeIcon = theme.icons?.[icon]
104
103
 
105
- const iconSize = size ?? 26;
106
- const iconAriaLabel = props?.['aria-label'] ?? accessibilityLabel ?? null;
107
- const iconAriaHidden = iconAriaLabel ? false : true;
104
+ const iconSize = size ?? 24
105
+ const iconAriaLabel = props?.['aria-label'] ?? accessibilityLabel ?? null
106
+ const iconAriaHidden = !iconAriaLabel
108
107
 
109
- const iconProps = {
110
- color: color ?? 'black',
111
- 'aria-hidden': iconAriaHidden,
112
- 'aria-label': iconAriaLabel,
113
- }
108
+ const iconProps = {
109
+ color: color ?? 'black',
110
+ 'aria-hidden': iconAriaHidden,
111
+ 'aria-label': iconAriaLabel
112
+ }
114
113
 
115
- if (IconSVG) {
116
- return (
117
- <IconSVG
118
- {...iconProps}
119
- width={iconSize}
120
- height={iconSize}
121
- />
122
- );
123
- } else if (typeof ThemeIcon === 'function') {
124
- return (
125
- <ThemeIcon
126
- {...iconProps}
127
- width={iconSize}
128
- height={iconSize}
129
- />
130
- );
131
- } else if (AppIcons) {
132
- return (
133
- <AppIcons
134
- {...iconProps}
135
- name={icon}
136
- size={iconSize}
137
- />
138
- );
139
- } else {
140
- return (
141
- <CustomIcon
142
- {...iconProps}
143
- name={icon}
144
- size={iconSize}
145
- />
146
- );
147
- }
114
+ if (IconSVG) {
115
+ return (
116
+ <IconSVG
117
+ {...iconProps}
118
+ width={iconSize}
119
+ height={iconSize}
120
+ />
121
+ )
122
+ } else if (typeof ThemeIcon === 'function') {
123
+ return (
124
+ <ThemeIcon
125
+ {...iconProps}
126
+ width={iconSize}
127
+ height={iconSize}
128
+ />
129
+ )
130
+ } else if (AppIcons) {
131
+ return (
132
+ <AppIcons
133
+ {...iconProps}
134
+ name={icon}
135
+ size={iconSize}
136
+ />
137
+ )
138
+ } else {
139
+ return (
140
+ <CustomIcon
141
+ {...iconProps}
142
+ name={icon}
143
+ size={iconSize}
144
+ />
145
+ )
146
+ }
148
147
  }
149
148
 
150
149
  // propTypes für Funktionen wird in react.js 19 entfernt
151
150
  IconsOpenasist.propTypes = {
152
- icon: PropTypes.string,
153
- iconSVG: PropTypes.func,
154
- size: PropTypes.number,
155
- color: PropTypes.string
156
- };
151
+ icon: PropTypes.string,
152
+ iconSVG: PropTypes.func,
153
+ size: PropTypes.number,
154
+ color: PropTypes.string
155
+ }
157
156
 
158
- export default IconsOpenasist;
157
+ export default IconsOpenasist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olea-bps/base",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "OLEA base library",
5
5
  "main": "index.js",
6
6
  "repository": {