@bm-fe/react-native-ui-components 1.1.3 → 1.1.4
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/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Bitmart Card.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Bitmart Card.imageset/Property 1=Bitmart Card.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Contents.json +6 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Credit Debit Card.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Credit Debit Card.imageset/Property 1=Credit Debit Card.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Crypto Prepaid Card.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Crypto Prepaid Card.imageset/Property 1=Crypto Prepaid Card.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Mobile Recharge.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Mobile Recharge.imageset/Mobile Recharge.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/P2P Trading.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/P2P Trading.imageset/Property 1=P2P Trading.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/SEPA Deposit.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/SEPA Deposit.imageset/SEPA Deposit.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Third-Party Payment.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/BuyCrypto/Third-Party Payment.imageset/Property 1=Third-Party Payment.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Components/Contents.json +6 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/Contents.json +6 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/checkmark.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/checkmark.imageset/checkmark.pdf +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/close_icon.imageset/Contents.json +22 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/close_icon.imageset/close_icon@2x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/close_icon.imageset/close_icon@3x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/cross.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/cross.imageset/cross.pdf +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/progress.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/progress.imageset/progress.pdf +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/progress_circular.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/progress_circular.imageset/progress_circular.pdf +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/refresh_footer_dark.imageset/Contents.json +22 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/refresh_footer_dark.imageset/refresh_footer_dark@2x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/refresh_footer_dark.imageset/refresh_footer_dark@3x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/refresh_footer_light.imageset/Contents.json +22 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/refresh_footer_light.imageset/refresh_footer_light@2x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/refresh_footer_light.imageset/refresh_footer_light@3x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/search_icon.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/search_icon.imageset/Group 13994.svg +7 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_dark_chose.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_dark_chose.imageset/Frame.svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_list_arrow.imageset/Contents.json +22 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_list_arrow.imageset/sheet_list_arrow@2x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_list_arrow.imageset/sheet_list_arrow@3x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_list_cell_checkbox.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_list_cell_checkbox.imageset/Frame (1).svg +3 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_list_chose.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/sheet_list_chose.imageset/Frame.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/slider_bubble.imageset/Contents.json +22 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/slider_bubble.imageset/slider_bubble@2x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/slider_bubble.imageset/slider_bubble@3x.png +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/spot_second_floor_refresh_arrow.imageset/Contents.json +21 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Assets.xcassets/spot_second_floor_refresh_arrow.imageset/spot_second_floor_refresh_arrow.svg +8 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Font/Alexandria-Medium.ttf +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Font/Alexandria-Regular.ttf +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Assets/Font/Alexandria-SemiBold.ttf +0 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/BMFont/BMFont.swift +82 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/BMFont/UIFontExtensions.swift +120 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/AlertView/BMComponentAlertController.swift +574 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/Buttons/BMComponentButton+Examples.swift +77 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/Buttons/BMComponentButton.swift +373 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/Buttons/BMComponentButtonConfiguration.swift +181 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/Popup/BMComponentPopupController.swift +312 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/SegmentView/BMComponentSegmentedTitleCell.swift +294 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/SegmentView/BMComponentSegmentedTitleDataSource.swift +49 -0
- package/ios/Modules/BMUIComponents/BMUIComponents/Classes/Components/SegmentView/BMComponentSegmentedView.swift +292 -0
- package/ios/Modules/BMUIComponents/LICENSE +19 -0
- package/ios/Modules/BMUIComponents/README.md +29 -0
- package/package.json +3 -1
- package/react-native-ui-components.podspec +33 -4
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
//
|
|
2
|
+
// BMComponentSegmentedView.swift
|
|
3
|
+
// BMComponents
|
|
4
|
+
//
|
|
5
|
+
// Created by james on 2026/1/13.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
import BMTheme
|
|
10
|
+
import BMCore
|
|
11
|
+
import SnapKit
|
|
12
|
+
|
|
13
|
+
// MARK: - 图标位置
|
|
14
|
+
public enum BMComponentSegmentedIconPosition {
|
|
15
|
+
/// 图标在文字右边
|
|
16
|
+
case trailing
|
|
17
|
+
/// 图标在文字上面
|
|
18
|
+
case top
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Secondary 下划线宽度样式
|
|
22
|
+
public enum BMComponentSegmentedUnderlineWidth {
|
|
23
|
+
/// 下划线宽度随文字长度
|
|
24
|
+
case auto
|
|
25
|
+
/// 固定宽度下划线
|
|
26
|
+
case fixed(CGFloat)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MARK: - 样式类型
|
|
30
|
+
public enum BMComponentSegmentedStyle {
|
|
31
|
+
/// 主要项目标签:文字加粗、深色,无下划线,可带图标和徽章
|
|
32
|
+
case primary
|
|
33
|
+
/// 次要项目标签:文字加粗、深色、细下划线,可带图标和徽章
|
|
34
|
+
case secondary(underlineWidth: BMComponentSegmentedUnderlineWidth = .auto)
|
|
35
|
+
/// 三级项目标签:胶囊形按钮样式,可带图标和徽章
|
|
36
|
+
case tertiary
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// MARK: - 标签项配置
|
|
40
|
+
public struct BMComponentSegmentedItem {
|
|
41
|
+
public let title: String
|
|
42
|
+
public let icon: UIImage? // 图标
|
|
43
|
+
public let iconPosition: BMComponentSegmentedIconPosition // 图标位置
|
|
44
|
+
public let badge: BMComponentSegmentedBadge? // 徽章(文字徽章或红点)
|
|
45
|
+
|
|
46
|
+
public init(title: String,
|
|
47
|
+
icon: UIImage? = nil,
|
|
48
|
+
badge: BMComponentSegmentedBadge? = nil,
|
|
49
|
+
iconPosition: BMComponentSegmentedIconPosition = .trailing){
|
|
50
|
+
self.title = title
|
|
51
|
+
self.icon = icon
|
|
52
|
+
self.badge = badge
|
|
53
|
+
self.iconPosition = iconPosition
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: - 徽章类型
|
|
58
|
+
public enum BMComponentSegmentedBadge {
|
|
59
|
+
/// 文字徽章(如 "New")
|
|
60
|
+
case text(String, backgroundColor: UIColor = UIColor(red: 0.2, green: 0.6, blue: 1.0, alpha: 1.0))
|
|
61
|
+
/// 红点徽章(默认8pt,确保可见性)
|
|
62
|
+
case dot(color: UIColor = .red, size: CGFloat = 8)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// MARK: - BMComponentSegmentedView 主类
|
|
66
|
+
//open class BMComponentSegmentedView: UIView {
|
|
67
|
+
//
|
|
68
|
+
// // MARK: - Properties
|
|
69
|
+
// public var style: BMComponentSegmentedStyle = .primary {
|
|
70
|
+
// didSet {
|
|
71
|
+
// setupStyle()
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
74
|
+
//
|
|
75
|
+
// public var items: [BMComponentSegmentedItem] = [] {
|
|
76
|
+
// didSet {
|
|
77
|
+
// reloadData()
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
//
|
|
81
|
+
// private var _selectedIndex: Int = 0
|
|
82
|
+
// public var selectedIndex: Int {
|
|
83
|
+
// get {
|
|
84
|
+
// return _selectedIndex
|
|
85
|
+
// }
|
|
86
|
+
// set {
|
|
87
|
+
// _selectedIndex = newValue
|
|
88
|
+
// // 只有在数据源已设置且数据已加载时才调用 selectItemAt
|
|
89
|
+
// // 否则会在 reloadData() 中处理
|
|
90
|
+
// if dataSource != nil && !items.isEmpty && segmentedView.dataSource != nil {
|
|
91
|
+
// // 确保索引有效
|
|
92
|
+
// if _selectedIndex >= 0 && _selectedIndex < items.count {
|
|
93
|
+
// segmentedView.selectItemAt(index: _selectedIndex)
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
96
|
+
// }
|
|
97
|
+
// }
|
|
98
|
+
//
|
|
99
|
+
// public var onSelectedIndexChanged: ((Int) -> Void)?
|
|
100
|
+
//
|
|
101
|
+
// // MARK: - UI Components
|
|
102
|
+
// private lazy var containerView: UIView = {
|
|
103
|
+
// let view = UIView()
|
|
104
|
+
// view.backgroundColor = .clear
|
|
105
|
+
// return view
|
|
106
|
+
// }()
|
|
107
|
+
//
|
|
108
|
+
// private lazy var segmentedView: JXSegmentedView = {
|
|
109
|
+
// let view = JXSegmentedView()
|
|
110
|
+
// return view
|
|
111
|
+
// }()
|
|
112
|
+
//
|
|
113
|
+
// private var dataSource: JXSegmentedBaseDataSource?
|
|
114
|
+
// private var indicator: JXSegmentedIndicatorBaseView?
|
|
115
|
+
//
|
|
116
|
+
// // MARK: - Initialization
|
|
117
|
+
// public override init(frame: CGRect) {
|
|
118
|
+
// super.init(frame: frame)
|
|
119
|
+
// setupUI()
|
|
120
|
+
// }
|
|
121
|
+
//
|
|
122
|
+
// required public init?(coder: NSCoder) {
|
|
123
|
+
// super.init(coder: coder)
|
|
124
|
+
// setupUI()
|
|
125
|
+
// }
|
|
126
|
+
//
|
|
127
|
+
// // MARK: - Setup
|
|
128
|
+
// private func setupUI() {
|
|
129
|
+
// addSubview(containerView)
|
|
130
|
+
// containerView.addSubview(segmentedView)
|
|
131
|
+
//
|
|
132
|
+
// containerView.snp.makeConstraints { make in
|
|
133
|
+
// make.edges.equalToSuperview()
|
|
134
|
+
// }
|
|
135
|
+
//
|
|
136
|
+
// segmentedView.snp.makeConstraints { make in
|
|
137
|
+
// make.edges.equalToSuperview()
|
|
138
|
+
// }
|
|
139
|
+
//
|
|
140
|
+
// segmentedView.delegate = self
|
|
141
|
+
// setupStyle()
|
|
142
|
+
// }
|
|
143
|
+
//
|
|
144
|
+
// private func setupStyle() {
|
|
145
|
+
// // 清除旧的指示器
|
|
146
|
+
// indicator?.removeFromSuperview()
|
|
147
|
+
// indicator = nil
|
|
148
|
+
// // 根据样式创建 DataSource 和 Indicator
|
|
149
|
+
// switch style {
|
|
150
|
+
// case .primary:
|
|
151
|
+
// setupPrimaryStyle()
|
|
152
|
+
// case .secondary(let underlineWidth):
|
|
153
|
+
// setupSecondaryStyle(underlineWidth: underlineWidth)
|
|
154
|
+
// case .tertiary:
|
|
155
|
+
// setupTertiaryStyle()
|
|
156
|
+
// }
|
|
157
|
+
// reloadData()
|
|
158
|
+
// }
|
|
159
|
+
//
|
|
160
|
+
// // MARK: - Style Setup Methods
|
|
161
|
+
// private func setupPrimaryStyle() {
|
|
162
|
+
// let dataSource = BMComponentSegmentedTitleDataSource()
|
|
163
|
+
// dataSource.titles = items.map { $0.title }
|
|
164
|
+
// dataSource.titleNormalColor = BMCexThemeColor.secondaryColor.currentUIColor()
|
|
165
|
+
// dataSource.titleSelectedColor = BMCexThemeColor.primaryColor.currentUIColor()
|
|
166
|
+
// dataSource.titleNormalFont = UIFont.H7Font
|
|
167
|
+
// dataSource.titleSelectedFont = UIFont.H7Font // 通过 isTitleStrokeWidthEnabled 实现加粗效果
|
|
168
|
+
// dataSource.isTitleStrokeWidthEnabled = true
|
|
169
|
+
// dataSource.titleSelectedStrokeWidth = -1
|
|
170
|
+
// dataSource.isTitleZoomEnabled = false
|
|
171
|
+
// dataSource.itemSpacing = 20
|
|
172
|
+
//
|
|
173
|
+
// dataSource.icons = items.map { $0.icon }
|
|
174
|
+
// dataSource.iconPositions = items.map { $0.iconPosition }
|
|
175
|
+
// dataSource.badges = items.map { $0.badge }
|
|
176
|
+
//
|
|
177
|
+
// self.dataSource = dataSource
|
|
178
|
+
// segmentedView.dataSource = dataSource
|
|
179
|
+
// // Primary 样式不需要指示器,仅通过文字颜色和粗细区分
|
|
180
|
+
// segmentedView.indicators = []
|
|
181
|
+
// containerView.backgroundColor = .clear
|
|
182
|
+
// containerView.layer.cornerRadius = 0
|
|
183
|
+
// }
|
|
184
|
+
//
|
|
185
|
+
// private func setupSecondaryStyle(underlineWidth: BMComponentSegmentedUnderlineWidth) {
|
|
186
|
+
// let dataSource = BMComponentSegmentedTitleDataSource()
|
|
187
|
+
// dataSource.titles = items.map { $0.title }
|
|
188
|
+
// dataSource.titleNormalColor = BMCexThemeColor.secondaryColor.currentUIColor()
|
|
189
|
+
// dataSource.titleSelectedColor = BMCexThemeColor.primaryColor.currentUIColor()
|
|
190
|
+
// dataSource.titleNormalFont = UIFont.H7Font
|
|
191
|
+
// dataSource.titleSelectedFont = UIFont.H7Font // 通过 isTitleStrokeWidthEnabled 实现加粗效果
|
|
192
|
+
// dataSource.isTitleStrokeWidthEnabled = true
|
|
193
|
+
// dataSource.titleSelectedStrokeWidth = -1
|
|
194
|
+
// dataSource.isTitleZoomEnabled = false
|
|
195
|
+
// dataSource.itemSpacing = 20
|
|
196
|
+
//
|
|
197
|
+
// dataSource.icons = items.map { $0.icon }
|
|
198
|
+
// dataSource.iconPositions = items.map { $0.iconPosition }
|
|
199
|
+
// dataSource.badges = items.map { $0.badge }
|
|
200
|
+
//
|
|
201
|
+
// self.dataSource = dataSource
|
|
202
|
+
// segmentedView.dataSource = dataSource
|
|
203
|
+
//
|
|
204
|
+
// // Secondary 样式使用细下划线
|
|
205
|
+
// let indicator = JXSegmentedIndicatorLineView()
|
|
206
|
+
// indicator.indicatorColor = BMCexThemeColor.primaryColor.currentUIColor()
|
|
207
|
+
// indicator.indicatorHeight = 1 // 细下划线
|
|
208
|
+
// // 根据配置设置下划线宽度
|
|
209
|
+
// switch underlineWidth {
|
|
210
|
+
// case .auto:
|
|
211
|
+
// indicator.indicatorWidth = JXSegmentedViewAutomaticDimension // 随文字长度
|
|
212
|
+
// case .fixed(let width):
|
|
213
|
+
// indicator.indicatorWidth = width // 固定宽度
|
|
214
|
+
// }
|
|
215
|
+
// indicator.indicatorPosition = .bottom
|
|
216
|
+
// indicator.verticalOffset = 0
|
|
217
|
+
// self.indicator = indicator
|
|
218
|
+
// segmentedView.indicators = [indicator]
|
|
219
|
+
//
|
|
220
|
+
// containerView.backgroundColor = .clear
|
|
221
|
+
// containerView.layer.cornerRadius = 0
|
|
222
|
+
// }
|
|
223
|
+
//
|
|
224
|
+
// private func setupTertiaryStyle() {
|
|
225
|
+
// let dataSource = BMComponentSegmentedTitleDataSource()
|
|
226
|
+
// dataSource.titles = items.map { $0.title }
|
|
227
|
+
// dataSource.titleNormalColor = BMCexThemeColor.secondaryColor.currentUIColor() // 未选中:灰色
|
|
228
|
+
// dataSource.titleSelectedColor = .white // 选中:白色
|
|
229
|
+
// dataSource.titleNormalFont = UIFont.H7Font
|
|
230
|
+
// dataSource.titleSelectedFont = UIFont.H7Font
|
|
231
|
+
// dataSource.isTitleZoomEnabled = false
|
|
232
|
+
// dataSource.itemSpacing = 8
|
|
233
|
+
//
|
|
234
|
+
// dataSource.icons = items.map { $0.icon }
|
|
235
|
+
// dataSource.iconPositions = items.map { $0.iconPosition }
|
|
236
|
+
// dataSource.badges = items.map { $0.badge }
|
|
237
|
+
//
|
|
238
|
+
// self.dataSource = dataSource
|
|
239
|
+
// segmentedView.dataSource = dataSource
|
|
240
|
+
//
|
|
241
|
+
// // Tertiary 样式使用背景块指示器
|
|
242
|
+
// let indicator = JXSegmentedIndicatorBackgroundView()
|
|
243
|
+
// indicator.indicatorColor = BMCexThemeColor.primaryColor.currentUIColor() // 主色背景
|
|
244
|
+
// indicator.indicatorHeight = 32
|
|
245
|
+
// indicator.indicatorWidthIncrement = 16
|
|
246
|
+
// indicator.indicatorPosition = .center
|
|
247
|
+
// indicator.indicatorCornerRadius = 16 // 胶囊形
|
|
248
|
+
// self.indicator = indicator
|
|
249
|
+
// segmentedView.indicators = [indicator]
|
|
250
|
+
//
|
|
251
|
+
// // Tertiary 样式需要容器背景
|
|
252
|
+
// containerView.backgroundColor = UIColor(white: 0.95, alpha: 1.0)
|
|
253
|
+
// containerView.layer.cornerRadius = 8
|
|
254
|
+
// containerView.layer.borderWidth = 0
|
|
255
|
+
// }
|
|
256
|
+
//
|
|
257
|
+
// // MARK: - Data Reload
|
|
258
|
+
// private func reloadData() {
|
|
259
|
+
// guard !items.isEmpty else { return }
|
|
260
|
+
//
|
|
261
|
+
// // 确保 selectedIndex 在有效范围内
|
|
262
|
+
// let validIndex = max(0, min(_selectedIndex, items.count - 1))
|
|
263
|
+
// if validIndex != _selectedIndex {
|
|
264
|
+
// _selectedIndex = validIndex
|
|
265
|
+
// }
|
|
266
|
+
//
|
|
267
|
+
// dataSource?.reloadData(selectedIndex: _selectedIndex)
|
|
268
|
+
// segmentedView.reloadData()
|
|
269
|
+
//
|
|
270
|
+
// // 确保在数据加载完成后再选择
|
|
271
|
+
// DispatchQueue.main.async { [weak self] in
|
|
272
|
+
// guard let self = self else { return }
|
|
273
|
+
// if self._selectedIndex >= 0 && self._selectedIndex < self.items.count {
|
|
274
|
+
// self.segmentedView.selectItemAt(index: self._selectedIndex)
|
|
275
|
+
// }
|
|
276
|
+
// }
|
|
277
|
+
// }
|
|
278
|
+
//
|
|
279
|
+
// // MARK: - Public Methods
|
|
280
|
+
// public func reloadSegmentData() {
|
|
281
|
+
// setupStyle()
|
|
282
|
+
// }
|
|
283
|
+
//}
|
|
284
|
+
//
|
|
285
|
+
//// MARK: - JXSegmentedView Delegate
|
|
286
|
+
//extension BMComponentSegmentedView: JXSegmentedViewDelegate {
|
|
287
|
+
// public func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
|
|
288
|
+
// // 直接更新内部变量,避免触发 didSet 中的 selectItemAt(因为已经选中了)
|
|
289
|
+
// _selectedIndex = index
|
|
290
|
+
// onSelectedIndexChanged?(index)
|
|
291
|
+
// }
|
|
292
|
+
//}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 wlwZLP <james@ponyft.com>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# BMUIComponents
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/wlwZLP/BMUIComponents)
|
|
4
|
+
[](https://cocoapods.org/pods/BMUIComponents)
|
|
5
|
+
[](https://cocoapods.org/pods/BMUIComponents)
|
|
6
|
+
[](https://cocoapods.org/pods/BMUIComponents)
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
To run the example project, clone the repo, and run `pod install` from the Example directory first.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
BMUIComponents is available through [CocoaPods](https://cocoapods.org). To install
|
|
17
|
+
it, simply add the following line to your Podfile:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
pod 'BMUIComponents'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Author
|
|
24
|
+
|
|
25
|
+
wlwZLP, james@ponyft.com
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
BMUIComponents is available under the MIT license. See the LICENSE file for more info.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bm-fe/react-native-ui-components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "React Native UI Components Library",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"android/design/proguard-rules.pro",
|
|
16
16
|
"android/design/consumer-rules.pro",
|
|
17
17
|
"ios/DemoProject/NativeDesign",
|
|
18
|
+
"ios/Modules/BMUIComponents/BMUIComponents/Classes",
|
|
19
|
+
"ios/Modules/BMUIComponents/BMUIComponents/Assets",
|
|
18
20
|
"react-native-ui-components.podspec",
|
|
19
21
|
"react-native.config.js",
|
|
20
22
|
"README.md",
|
|
@@ -11,13 +11,42 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.authors = { "bm-fe" => "bm-fe@bitmart.com" }
|
|
12
12
|
s.platforms = { :ios => "13.0" }
|
|
13
13
|
s.source = { :git => "", :tag => "#{s.version}" }
|
|
14
|
+
s.swift_version = "5.0"
|
|
14
15
|
|
|
15
|
-
#
|
|
16
|
-
|
|
16
|
+
# ─── 源码 ───
|
|
17
|
+
# RN ViewManager 桥接层
|
|
18
|
+
# BMUIComponents 直接内联(消费方没有此 pod,内联避免找不到)
|
|
19
|
+
# BMCore / BMTheme 消费方已有,声明为 dependency 由 CocoaPods 复用,不重复编译
|
|
20
|
+
s.source_files = [
|
|
21
|
+
"ios/DemoProject/NativeDesign/**/*.{h,m,swift}",
|
|
22
|
+
"ios/Modules/BMUIComponents/BMUIComponents/Classes/**/*.{h,m,swift}"
|
|
23
|
+
]
|
|
17
24
|
|
|
25
|
+
# ─── 资源:BMUIComponents 字体 / 图片 ───
|
|
26
|
+
s.resource_bundles = {
|
|
27
|
+
"BMUIComponents" => [
|
|
28
|
+
"ios/Modules/BMUIComponents/BMUIComponents/Assets/**/*"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
s.frameworks = "UIKit"
|
|
33
|
+
|
|
34
|
+
# ─── 依赖 ───
|
|
35
|
+
|
|
36
|
+
# React Native
|
|
18
37
|
s.dependency "React-Core"
|
|
19
|
-
|
|
38
|
+
|
|
39
|
+
# 消费方已有的私有 pod,CocoaPods 会直接复用,不重复编译
|
|
40
|
+
s.dependency "BMCore"
|
|
41
|
+
s.dependency "BMTheme"
|
|
42
|
+
|
|
43
|
+
# BMUIComponents 的公共 pod 依赖
|
|
44
|
+
s.dependency "RxSwift"
|
|
45
|
+
s.dependency "RxCocoa"
|
|
46
|
+
s.dependency "RxRelay"
|
|
47
|
+
s.dependency "SnapKit"
|
|
48
|
+
|
|
49
|
+
# RN 桥接层 SVG 图标支持
|
|
20
50
|
s.dependency "SDWebImage"
|
|
21
51
|
s.dependency "SDWebImageSVGCoder"
|
|
22
|
-
s.dependency "SnapKit"
|
|
23
52
|
end
|