@ledvance/base 1.1.3 → 1.1.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.
package/package.json
CHANGED
|
@@ -2,15 +2,11 @@ import {View} from 'react-native'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import LdvColorSlider from './ldvColorSlider'
|
|
4
4
|
import {hex2Hsv, hsv2Hex} from '../utils'
|
|
5
|
-
import Spacer from './Spacer'
|
|
6
5
|
import LdvPresetView from './ldvPresetView'
|
|
7
|
-
import {Utils} from 'tuya-panel-kit'
|
|
8
6
|
import LdvSaturation from './ldvSaturation'
|
|
9
7
|
import LdvColorBrightness from './ldvColorBrightness'
|
|
10
8
|
import I18n from '../i18n/index'
|
|
11
9
|
|
|
12
|
-
const {convertX: cx} = Utils.RatioUtils
|
|
13
|
-
|
|
14
10
|
export interface ColorAdjustViewProps {
|
|
15
11
|
h: number
|
|
16
12
|
s: number
|
|
@@ -35,14 +31,12 @@ const ColorAdjustView = (props: ColorAdjustViewProps) => {
|
|
|
35
31
|
}}/>
|
|
36
32
|
<LdvPresetView
|
|
37
33
|
type={'color'}
|
|
38
|
-
style={{height: cx(60)}}
|
|
39
34
|
onPress={(item) => {
|
|
40
35
|
const hsv = hex2Hsv(item.color)
|
|
41
36
|
if (hsv) {
|
|
42
37
|
props.onHSVChangeComplete(hsv.h, hsv.s, hsv.v)
|
|
43
38
|
}
|
|
44
39
|
}}/>
|
|
45
|
-
<Spacer height={cx(10)}/>
|
|
46
40
|
<LdvSaturation
|
|
47
41
|
value={props.s}
|
|
48
42
|
onValueChange={s => {
|
|
@@ -55,20 +55,21 @@ const colors = [
|
|
|
55
55
|
const LdvPresetView = (props) => {
|
|
56
56
|
const {type, onPress} = props
|
|
57
57
|
let dataSource = type == 'temperature' ? temperatures : colors
|
|
58
|
-
return (
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onPress(
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
return (
|
|
59
|
+
<View style={styles.container}>
|
|
60
|
+
{dataSource.map((item, index) =>
|
|
61
|
+
<TouchableOpacity
|
|
62
|
+
key={index}
|
|
63
|
+
style={[styles.item, {backgroundColor: item.color}]}
|
|
64
|
+
onPress={() => {
|
|
65
|
+
onPress(item)
|
|
66
|
+
}}/>)}
|
|
67
|
+
</View>
|
|
68
|
+
)
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
const styles = StyleSheet.create({
|
|
70
72
|
container: {
|
|
71
|
-
flex: 1,
|
|
72
73
|
flexDirection: 'row',
|
|
73
74
|
justifyContent: 'space-between',
|
|
74
75
|
alignItems: 'center',
|