|
40 | 40 |
|
41 | 41 | -- stylua: ignore |
42 | 42 | type ListConfig = ( |
43 | | - { orderByName: boolean?, setOrder: true, initial: number?, } |
44 | | - | { orderByName: boolean?, setOrder: false?, initial: nil } |
| 43 | + { orderByName: boolean?, setOrder: true, initial: number?, key: string? } |
| 44 | + | { orderByName: boolean?, setOrder: false?, initial: nil, key: string? } |
45 | 45 | ) |
46 | 46 | local function newList(roact) |
47 | 47 | return function(config: ListConfig, elements: { [number]: Element }) |
@@ -69,7 +69,10 @@ local function newList(roact) |
69 | 69 | then "Instance" |
70 | 70 | else "None" |
71 | 71 |
|
72 | | - local instanceName = className .. " " .. count[className] |
| 72 | + local instanceName = if config.key |
| 73 | + and element.props[config.key] |
| 74 | + then element.props[config.key] |
| 75 | + else className .. " " .. count[className] |
73 | 76 | if config.orderByName and sortType ~= "None" then |
74 | 77 | index += 1 |
75 | 78 | instanceName = string.format(nameFormat, index, instanceName) |
@@ -190,8 +193,8 @@ function froact.configure<Hooks>(config: { |
190 | 193 | ) |
191 | 194 | local function applyEvent(props: any, tags: { any }) |
192 | 195 | for _, tag in tags do |
193 | | - props[(config.Roact.Event :: any)[tag]] = props["on" .. tag] |
194 | | - props["on" .. tag] = nil |
| 196 | + props[(config.Roact.Event :: any)[tag]] = props["on"..tag] |
| 197 | + props["on"..tag] = nil |
195 | 198 | end |
196 | 199 | end |
197 | 200 | -- stylua: ignore start |
@@ -396,3 +399,4 @@ function froact.configure<Hooks>(config: { |
396 | 399 | end |
397 | 400 |
|
398 | 401 | return froact |
| 402 | + |
0 commit comments