@olea-bps/base 1.1.6 → 1.1.7

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.
@@ -32,14 +32,15 @@ import {
32
32
  Headline,
33
33
  List,
34
34
  useTheme,
35
- } from "react-native-paper";
35
+ } from 'react-native-paper';
36
36
 
37
- import { useTranslation } from "react-i18next";
37
+ import { useTranslation } from 'react-i18next';
38
38
 
39
- import componentStyles from './styles';
40
39
  import AppbarComponent from '../AppBar';
41
40
  import AppbarAction from '../AppbarAction';
42
- import { default as Icon } from '../../libraries/icons-openasist';
41
+ import IconListItem from '../IconListItem';
42
+
43
+ import componentStyles from './styles';
43
44
 
44
45
  /**
45
46
  * Contact Detail Component
@@ -191,12 +192,12 @@ export default function ContactDetailComponent({ contact, ...restProps }) {
191
192
  }
192
193
  }
193
194
  >
194
- <List.Item
195
+ <IconListItem
195
196
  title={title}
196
197
  description={telephoneNumber}
197
198
  descriptionStyle={themeStyles.textLighter}
198
199
  titleStyle={themeStyles.searchDetailTitle}
199
- right={props => <Icon {...props} icon={'call'} />}
200
+ icon={'call'}
200
201
  />
201
202
  </TouchableOpacity>
202
203
  )
@@ -0,0 +1,56 @@
1
+ import {
2
+ useCallback,
3
+ useMemo,
4
+ } from 'react';
5
+ import {
6
+ StyleSheet,
7
+ } from 'react-native';
8
+
9
+ import {
10
+ List,
11
+ useTheme,
12
+ } from 'react-native-paper';
13
+
14
+ import { default as Icon } from '../../libraries/icons-openasist';
15
+
16
+ import componentStyles from './styles';
17
+
18
+ /**
19
+ * Ein Listenelement, welches ein Icon auf der rechten Seite anzeigt.
20
+ * Es können alle Properties der {@link List.Item}-Komponente verwendet werden, außer die `right`-Property.
21
+ * Die `right`-Property wird für das Einbinden des Icons benutzt.
22
+ *
23
+ * @param {object} props
24
+ * @param {string} props.icon Iconname des anzuzeigenen Icons. Für mögliche Werte siehe {@link Icon}
25
+ */
26
+ export default function IconListItem({ icon, ...listItemProps }) {
27
+ const theme = useTheme();
28
+
29
+ const styles = useMemo(
30
+ () => StyleSheet.create(componentStyles(theme)),
31
+ [theme, componentStyles]
32
+ );
33
+
34
+ const listItemIcon = useCallback(
35
+ listIconProps =>
36
+ <List.Icon
37
+ {...listIconProps}
38
+ icon={
39
+ props =>
40
+ <Icon
41
+ {...props}
42
+ icon={icon}
43
+ />
44
+ }
45
+ />
46
+ ,
47
+ [icon]
48
+ );
49
+
50
+ return (
51
+ <List.Item
52
+ {...listItemProps}
53
+ right={listItemIcon}
54
+ />
55
+ );
56
+ }
@@ -0,0 +1,4 @@
1
+ export default function (theme) {
2
+ return {
3
+ }
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olea-bps/base",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "OLEA base library",
5
5
  "main": "index.js",
6
6
  "repository": {