@ledvance/base 1.0.5 → 1.0.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.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.5",
7
+ "version": "1.0.6",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -3,6 +3,7 @@ import { PropsWithChildren } from 'react';
3
3
  interface CardProps extends PropsWithChildren<ViewProps> {
4
4
  shadowHeight?: number | undefined;
5
5
  onPress?: () => void;
6
+ onLongPress?: () => void;
6
7
  containerStyle?: StyleProp<ViewStyle>;
7
8
  }
8
9
  export default function Card(props: CardProps): JSX.Element;
@@ -7,6 +7,7 @@ const cx = Utils.RatioUtils.convertX
7
7
  interface CardProps extends PropsWithChildren<ViewProps> {
8
8
  shadowHeight?: number | undefined
9
9
  onPress?: () => void
10
+ onLongPress?: () => void
10
11
  containerStyle?: StyleProp<ViewStyle>
11
12
  }
12
13
 
@@ -27,7 +28,7 @@ export default function Card(props: CardProps) {
27
28
  },
28
29
  borderRadius: cx(10),
29
30
  }, props.style]}>
30
- <TouchableOpacity disabled={!(!!props.onPress)} onPress={props.onPress}>
31
+ <TouchableOpacity disabled={!(!!props.onPress)} onPress={props.onPress} onLongPress={props.onLongPress}>
31
32
  <View style={props.containerStyle}>{props.children}</View>
32
33
  </TouchableOpacity>
33
34
  </View>
@@ -5,6 +5,7 @@ interface LdvPickerViewProps {
5
5
  setHour: (string: any) => void;
6
6
  setMinute: (string: any) => void;
7
7
  style?: StyleProp<ViewStyle> | undefined;
8
+ unit?: string[];
8
9
  }
9
10
  declare const LdvPickerView: (props: LdvPickerViewProps) => JSX.Element;
10
11
  export default LdvPickerView;
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
2
+ import { StyleProp, StyleSheet, View, ViewStyle, Text } from 'react-native'
3
3
  import { Picker, Utils } from 'tuya-panel-kit'
4
4
  import _ from 'lodash'
5
5
 
@@ -16,15 +16,17 @@ interface LdvPickerViewProps {
16
16
  minute: string,
17
17
  setHour: (string) => void,
18
18
  setMinute: (string) => void,
19
- style?: StyleProp<ViewStyle> | undefined
19
+ style?: StyleProp<ViewStyle> | undefined,
20
+ unit?:string[]
20
21
  }
21
22
 
22
23
  const LdvPickerView = (props: LdvPickerViewProps) => {
23
24
 
24
- const { hour, minute, setHour, setMinute } = props
25
+ const { hour, minute, unit, setHour, setMinute } = props
25
26
 
26
27
  return (
27
28
  <View style={[styles.pickerContainer, props.style]}>
29
+ <View style={styles.picContainer}>
28
30
  <Picker
29
31
  style={[styles.picker, styles.pickerLeft]}
30
32
  theme={pickerTheme}
@@ -37,6 +39,13 @@ const LdvPickerView = (props: LdvPickerViewProps) => {
37
39
  <Picker.Item key={value} value={value} label={value} />
38
40
  ))}
39
41
  </Picker>
42
+ {unit ? <View style={styles.pickerUnit}>
43
+ <Text style={{ color: '#000', fontSize: convertX(18) }}>
44
+ {unit[0]}
45
+ </Text>
46
+ </View> : null}
47
+ </View>
48
+ <View style={styles.picContainer}>
40
49
  <Picker
41
50
  style={[styles.picker, styles.pickerLeft]}
42
51
  theme={pickerTheme}
@@ -46,9 +55,14 @@ const LdvPickerView = (props: LdvPickerViewProps) => {
46
55
  onValueChange={value => setMinute(value as string)}>
47
56
  {minutes.map((value) => (
48
57
  <Picker.Item key={value} value={value} label={value} />
49
- ))}
58
+ ))}
50
59
  </Picker>
51
-
60
+ {unit ? <View style={styles.pickerUnit}>
61
+ <Text style={{ color: '#000', fontSize: convertX(18) }}>
62
+ {unit[1]}
63
+ </Text>
64
+ </View> : null}
65
+ </View>
52
66
  </View>
53
67
  )
54
68
  }
@@ -63,6 +77,15 @@ const styles = StyleSheet.create({
63
77
  },
64
78
  pickerLeft: {},
65
79
  pickerItem: {},
80
+ picContainer:{
81
+ flex: 1,
82
+ position: 'relative'
83
+ },
84
+ pickerUnit: {
85
+ position: 'absolute',
86
+ right: convertX(20),
87
+ top: '44%'
88
+ },
66
89
  })
67
90
 
68
91
  export default LdvPickerView