@onekeyfe/react-native-native-list 3.0.113 → 3.0.114
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/README.md +3 -57
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +1 -17
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +34 -545
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +2 -26
- package/ios/NativeListCell.swift +20 -504
- package/ios/NativeListDesignAssets.swift +0 -8
- package/ios/RNCNativeListView.swift +7 -85
- package/lib/module/validation.js +1 -129
- package/lib/module/web/NativeListWebEngine.js +5 -357
- package/lib/typescript/src/models.d.ts +2 -82
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +1 -26
- package/package.json +2 -2
- package/src/models.ts +3 -121
- package/src/validation.ts +0 -206
- package/src/web/NativeListWebEngine.ts +4 -578
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
package/README.md
CHANGED
|
@@ -112,10 +112,9 @@ second delta.
|
|
|
112
112
|
| `activity` | Transaction/activity with amounts and up to three actions |
|
|
113
113
|
| `message` | Notification/message with bounded body lines and thumbnail |
|
|
114
114
|
| `dataRow` | Two to four fixed table columns, optional index/checkbox |
|
|
115
|
-
| `market` | Recycled token, stock, or perpetual quote row |
|
|
116
115
|
| `mediaTile` | Gallery or browser-preview tile |
|
|
117
|
-
| `metricCard` | KPI or fixed Activity/Performance portfolio card
|
|
118
|
-
| `sectionHeader` | Sticky/group, tri-state, or fixed list-summary header
|
|
116
|
+
| `metricCard` | KPI or fixed Activity/Performance portfolio card |
|
|
117
|
+
| `sectionHeader` | Sticky/group, tri-state, or fixed list-summary header |
|
|
119
118
|
| `action` | Fixed action row or fixed footer |
|
|
120
119
|
| `system` | Loading, retry, end marker, or bounded spacer |
|
|
121
120
|
|
|
@@ -163,59 +162,6 @@ Bold faces and use them before the platform-font fallback. Their semantic
|
|
|
163
162
|
icons and checkbox marks are the same vector paths as the OneKey component
|
|
164
163
|
library, rendered by Core Graphics/UIKit on iOS and Canvas on Android.
|
|
165
164
|
|
|
166
|
-
### Market rows
|
|
167
|
-
|
|
168
|
-
`market` is a fixed native/DOM template, not a React `renderItem`. Its default
|
|
169
|
-
token/perpetual geometry uses a 32-point leading image with a 16-point network
|
|
170
|
-
corner; stock uses a 40-point image. The trailing change block is 80×32 with an
|
|
171
|
-
8-point radius. All displayed values are already formatted strings; compact
|
|
172
|
-
zero runs can use `priceSegments`, `subtitleSegments`, or
|
|
173
|
-
`change.textSegments` with `{ style: 'subscript' }`.
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
const btc = {
|
|
177
|
-
type: 'market',
|
|
178
|
-
key: 'btc',
|
|
179
|
-
variant: 'token',
|
|
180
|
-
leading: { kind: 'token', image: btcImage, networkImage: bitcoinImage },
|
|
181
|
-
title: 'BTC',
|
|
182
|
-
subtitle: '$1.23B',
|
|
183
|
-
price: '$64,230.00',
|
|
184
|
-
change: { text: '+2.40%', tone: 'positive' },
|
|
185
|
-
badges: [
|
|
186
|
-
{
|
|
187
|
-
key: 'community',
|
|
188
|
-
iconName: 'verified',
|
|
189
|
-
tone: 'success',
|
|
190
|
-
actionKey: 'market.communityInfo',
|
|
191
|
-
accessibilityLabel: 'Community recognized',
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
pressInActionKey: 'market.prewarm',
|
|
195
|
-
pressActionKey: 'market.open',
|
|
196
|
-
longPressActionKey: 'market.menu',
|
|
197
|
-
diagnostics: { imageBindActionKey: 'market.imageBind' },
|
|
198
|
-
} satisfies MarketRow;
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Badges accept localized text, a bounded remote image, or the single built-in
|
|
202
|
-
`iconName: 'verified'` glyph. A badge `actionKey` emits independently with an
|
|
203
|
-
anchor whose source is `marketBadge`. Market long press fires after 800 ms and
|
|
204
|
-
is cancelled when the pointer moves more than 10 logical pixels or the list
|
|
205
|
-
scrolls. The optional diagnostic action fires when a row binds an image; quote-
|
|
206
|
-
only patches (`price`, `priceSegments`, `change`, `accessibilityLabel`, and
|
|
207
|
-
`revision`) update visible labels without rebinding that image.
|
|
208
|
-
|
|
209
|
-
`style` is deliberately finite: row padding/gaps, image width/height/shape/
|
|
210
|
-
corner radius/content fit, title/subtitle/price/change font size, weight,
|
|
211
|
-
color, line height, one-or-two-line truncation and alignment, plus change-block
|
|
212
|
-
width/height/radius. Omitting it preserves the defaults. Loading, empty, retry,
|
|
213
|
-
and pagination states use the existing `system` rows with
|
|
214
|
-
`presentation: 'market'`. Loading rows accept `loadingStyle: 'skeleton'` for
|
|
215
|
-
the 56-point token skeleton or `'spinner'` for the centered 52-point pagination
|
|
216
|
-
indicator. Use `accessibilityLabel` for loading announcements. Omitting
|
|
217
|
-
`loadingStyle` preserves each platform's existing loading rendering.
|
|
218
|
-
|
|
219
165
|
For native reorder, set `capabilities.reorderable` and mark eligible rail rows
|
|
220
166
|
with `draggable: true`, or add a `drag` trailing accessory to an identity row.
|
|
221
167
|
Reordering never crosses a `sectionKey` boundary.
|
|
@@ -361,7 +307,7 @@ by the iOS wallet list's 120 Hz tail behavior.
|
|
|
361
307
|
| Activity rows | `components/TxHistoryListView/TxHistoryListItem.tsx` |
|
|
362
308
|
| Message rows | `Notifications/components/NotificationListView.tsx` |
|
|
363
309
|
| Data rows | `Perp/components/TokenSelector/PerpTokenSelectorRow.tsx` |
|
|
364
|
-
| Media tile rows | `Home/components/NFTListView/NFTListItem.tsx`
|
|
310
|
+
| Media tile rows | `Home/components/NFTListView/NFTListItem.tsx` |
|
|
365
311
|
| Metric card rows | `Perp/components/Portfolio/PerpPortfolioContent.tsx` |
|
|
366
312
|
| Section header rows | `AllNetworksManager/NetworksSectionList.tsx`, `TxHistoryListView/TxHistorySectionHeader.tsx` |
|
|
367
313
|
| Action rows | `TokenManager/TokenManagerList.tsx`, `Discovery/pages/BookmarkListModal/index.tsx` |
|
|
@@ -92,10 +92,6 @@ internal class NativeListAdapter(
|
|
|
92
92
|
position: Int,
|
|
93
93
|
payloads: MutableList<Any>,
|
|
94
94
|
) {
|
|
95
|
-
if (payloads.isNotEmpty() && payloads.all { it == MARKET_QUOTE_PAYLOAD }) {
|
|
96
|
-
itemAt(position)?.let { holder.rowView.bindMarketQuote(it, theme) }
|
|
97
|
-
return
|
|
98
|
-
}
|
|
99
95
|
// OneKey patch: an unknown payload must retain full binding; validated echoes keep images alive.
|
|
100
96
|
// if (payloads.contains(SELECTION_PAYLOAD)) {
|
|
101
97
|
if (payloads.isNotEmpty() && payloads.all { it == SELECTION_PAYLOAD || it == SELECTION_ECHO_PAYLOAD }) {
|
|
@@ -187,18 +183,7 @@ internal class NativeListAdapter(
|
|
|
187
183
|
override fun getChangePayload(oldItem: NativeListItem, newItem: NativeListItem): Any? =
|
|
188
184
|
if (oldItem.key == newItem.key && oldItem.type == newItem.type &&
|
|
189
185
|
newItem.selectionUpdateFromContent == oldItem.content
|
|
190
|
-
) SELECTION_ECHO_PAYLOAD else
|
|
191
|
-
|
|
192
|
-
private fun isMarketQuoteUpdate(oldItem: NativeListItem, newItem: NativeListItem): Boolean {
|
|
193
|
-
if (oldItem.type != "market" || newItem.type != "market") return false
|
|
194
|
-
fun stableContent(item: NativeListItem): String {
|
|
195
|
-
val value = JSONObject(item.json.toString())
|
|
196
|
-
listOf("revision", "price", "priceSegments", "change", "accessibilityLabel")
|
|
197
|
-
.forEach(value::remove)
|
|
198
|
-
return value.toString()
|
|
199
|
-
}
|
|
200
|
-
return stableContent(oldItem) == stableContent(newItem)
|
|
201
|
-
}
|
|
186
|
+
) SELECTION_ECHO_PAYLOAD else null
|
|
202
187
|
}
|
|
203
188
|
}
|
|
204
189
|
}
|
|
@@ -206,4 +191,3 @@ internal class NativeListAdapter(
|
|
|
206
191
|
internal const val SELECTION_PAYLOAD = "selection"
|
|
207
192
|
// OneKey patch: internal payload, never exposed through the serialized row contract.
|
|
208
193
|
internal const val SELECTION_ECHO_PAYLOAD = "selectionEcho"
|
|
209
|
-
internal const val MARKET_QUOTE_PAYLOAD = "marketQuote"
|