feat:fix click subview of ListItem or PageItem
This commit is contained in:
parent
353ff356a5
commit
1dba8d7b10
@ -44,7 +44,12 @@ public class ListNode extends SuperNode<RecyclerView> {
|
||||
|
||||
@Override
|
||||
protected void blendSubNode(JSObject subProperties) {
|
||||
listAdapter.blendSubNode(subProperties);
|
||||
ViewNode node = getSubNodeById(subProperties.getProperty("id").asString().value());
|
||||
if (node != null) {
|
||||
node.blend(subProperties.getProperty("props").asObject());
|
||||
} else {
|
||||
listAdapter.blendSubNode(subProperties);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +77,12 @@ public class SliderNode extends SuperNode<RecyclerView> {
|
||||
|
||||
@Override
|
||||
protected void blendSubNode(JSObject subProperties) {
|
||||
slideAdapter.blendSubNode(subProperties);
|
||||
ViewNode node = getSubNodeById(subProperties.getProperty("id").asString().value());
|
||||
if (node != null) {
|
||||
node.blend(subProperties.getProperty("props").asObject());
|
||||
} else {
|
||||
slideAdapter.blendSubNode(subProperties);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,4 +3,5 @@ export default [
|
||||
'src/Snake',
|
||||
'src/ListDemo',
|
||||
'src/ScrollerDemo',
|
||||
'src/SliderDemo',
|
||||
]
|
@ -24,25 +24,30 @@ class SliderPanel extends Panel {
|
||||
height: 50,
|
||||
}),
|
||||
slider({
|
||||
itemCount: 3,
|
||||
itemCount: 100,
|
||||
renderPage: (idx) => {
|
||||
return slideItem(text({
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.WRAP_CONTENT,
|
||||
widthSpec: LayoutSpec.AT_MOST,
|
||||
heightSpec: LayoutSpec.EXACTLY,
|
||||
alignment: gravity().center(),
|
||||
},
|
||||
text: `Cell At Line ${idx}`,
|
||||
text: `Page At Line ${idx}`,
|
||||
textAlignment: gravity().center(),
|
||||
textColor: Color.parse("#ffffff"),
|
||||
textSize: 20,
|
||||
height: 50,
|
||||
bgColor: Color.parse('#00ff00'),
|
||||
height: 300,
|
||||
bgColor: Color.parse(colors[idx % colors.length]),
|
||||
}).also(it => {
|
||||
let start = idx
|
||||
it.onClick = () => {
|
||||
it.bgColor = Color.parse(colors[++start % colors.length])
|
||||
}
|
||||
}))
|
||||
},
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.AT_MOST,
|
||||
heightSpec: LayoutSpec.AT_MOST,
|
||||
heightSpec: LayoutSpec.WRAP_CONTENT,
|
||||
},
|
||||
}),
|
||||
]).also(it => {
|
||||
|
@ -4,7 +4,7 @@ import { Stack } from "./layout";
|
||||
export function slideItem(item: View) {
|
||||
return (new SlideItem).also((it) => {
|
||||
it.layoutConfig = {
|
||||
widthSpec: LayoutSpec.WRAP_CONTENT,
|
||||
widthSpec: LayoutSpec.AT_MOST,
|
||||
heightSpec: LayoutSpec.WRAP_CONTENT,
|
||||
}
|
||||
it.addChild(item)
|
||||
|
Reference in New Issue
Block a user