@ledvance/ui-biz-bundle 1.1.65 → 1.1.66

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,138 @@
1
+ import {FlatList, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
2
+ import React from 'react'
3
+ import {useNavigation, useRoute} from '@react-navigation/core'
4
+ import {Utils} from 'tuya-panel-kit'
5
+ import Spacer from '@ledvance/base/src/components/Spacer'
6
+ import I18n from '@ledvance/base/src/i18n'
7
+ import Card from '@ledvance/base/src/components/Card'
8
+ import res from '@ledvance/base/src/res'
9
+
10
+ const cx = Utils.RatioUtils.convertX
11
+
12
+ export interface SelectPageData<T> {
13
+ text: string
14
+ selected: boolean
15
+ value: T
16
+ }
17
+
18
+ export interface SelectPageParams<T> {
19
+ title: string
20
+ data: SelectPageData<T>[]
21
+ onSelect: (selectPageData: SelectPageData<T>) => void
22
+ }
23
+
24
+ const SelectPage = () => {
25
+ const params = useRoute().params as SelectPageParams<any>
26
+ const navigation = useNavigation()
27
+ return (
28
+ <View style={styles.root}>
29
+ <View style={styles.topBar}>
30
+ <View style={styles.topContent}>
31
+ <Text style={styles.title}>{params.title}</Text>
32
+ <TouchableOpacity
33
+ onPress={() => {
34
+ navigation.goBack()
35
+ }}>
36
+ <Text style={styles.cancel}>{I18n.getLang('auto_scan_system_cancel')}</Text>
37
+ </TouchableOpacity>
38
+ </View>
39
+ <View style={styles.line}/>
40
+ </View>
41
+ <ScrollView nestedScrollEnabled={true}>
42
+ <View>
43
+ <Spacer height={cx(40)}/>
44
+ <Card style={styles.card}>
45
+ <FlatList
46
+ data={params.data}
47
+ renderItem={({item}) => {
48
+ return (
49
+ <TouchableOpacity
50
+ onPress={() => {
51
+ params.onSelect(item)
52
+ navigation.goBack()
53
+ }}>
54
+ <View style={styles.item}>
55
+ <Text style={styles.itemText}>{item.text}</Text>
56
+ <Image
57
+ style={[
58
+ styles.itemIcon,
59
+ {
60
+ opacity: item.selected ? 1 : 0,
61
+ },
62
+ ]}
63
+ source={{uri: res.ic_check}}/>
64
+ </View>
65
+ </TouchableOpacity>
66
+ )
67
+ }}
68
+ ItemSeparatorComponent={() => <View style={styles.itemLine}/>}
69
+ keyExtractor={(_, index) => `${index}`}/>
70
+ </Card>
71
+ <Spacer height={cx(40)}/>
72
+ </View>
73
+ </ScrollView>
74
+ </View>
75
+ )
76
+ }
77
+
78
+ const styles = StyleSheet.create({
79
+ root: {
80
+ flex: 1,
81
+ },
82
+ topBar: {
83
+ backgroundColor: '#eaeaea',
84
+ },
85
+ line: {
86
+ height: cx(1),
87
+ backgroundColor: '#d9d9d9',
88
+ },
89
+ topContent: {
90
+ paddingVertical: cx(30),
91
+ flexDirection: 'row',
92
+ alignItems: 'center',
93
+ },
94
+ cancel: {
95
+ marginStart: cx(16),
96
+ color: '#f60',
97
+ fontSize: cx(17),
98
+ fontFamily: 'helvetica_neue_lt_std_roman',
99
+ },
100
+ title: {
101
+ width: '100%',
102
+ position: 'absolute',
103
+ start: 0,
104
+ textAlign: 'center',
105
+ color: '#000',
106
+ fontSize: cx(17),
107
+ paddingHorizontal: cx(110),
108
+ fontFamily: 'helvetica_neue_lt_std_bd',
109
+ },
110
+ card: {
111
+ marginHorizontal: cx(16),
112
+ },
113
+ item: {
114
+ height: cx(44),
115
+ flexDirection: 'row',
116
+ alignItems: 'center',
117
+ },
118
+ itemText: {
119
+ flex: 1,
120
+ marginStart: cx(13),
121
+ color: '#000',
122
+ fontSize: cx(17),
123
+ fontFamily: 'helvetica_neue_lt_std_roman',
124
+ },
125
+ itemLine: {
126
+ height: cx(1),
127
+ marginStart: cx(13),
128
+ backgroundColor: '#ccc',
129
+ },
130
+ itemIcon: {
131
+ width: cx(30),
132
+ height: cx(30),
133
+ marginEnd: cx(13),
134
+ tintColor: '#f60',
135
+ },
136
+ })
137
+
138
+ export default SelectPage
@@ -1,12 +0,0 @@
1
- import { Dialog } from 'tuya-panel-kit'
2
- import Strings from '@ledvance/base/src/i18n'
3
-
4
- export const showDeleteMoodDialog = (onConfirm: (data: any, args: { close: () => void }) => void) => {
5
- Dialog.confirm({
6
- title: Strings.getLang('string_light_pp_dialog_sm_ed_headline_d'),
7
- subTitle: Strings.getLang(`strip_light_static_mood_edit_dialog_text`),
8
- cancelText: Strings.getLang('cancel_dialog_delete_item_sleepschedule_answer_no_text'),
9
- confirmText: Strings.getLang('cancel_dialog_delete_item_sleepschedule_answer_yes_text'),
10
- onConfirm: onConfirm,
11
- })
12
- }