iOS:change the way created item view.

This commit is contained in:
pengfei.zhou 2021-07-23 10:15:18 +08:00 committed by osborn
parent 05655972e3
commit f75a6f8071
4 changed files with 18 additions and 18 deletions

View File

@ -119,10 +119,10 @@ public class NavBarPlugin extends DoricJavaPlugin {
final JSObject jsObject = decoder.decode().asObject();
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
@Override
public Object call() throws Exception {
public Object call() {
String viewId = jsObject.getProperty("id").asString().value();
String type = jsObject.getProperty("type").asString().value();
ViewNode node = ViewNode.create(getDoricContext(), type);
ViewNode<?> node = ViewNode.create(getDoricContext(), type);
node.setId(viewId);
node.init(new FrameLayout.LayoutParams(0, 0));
node.blend(jsObject.getProperty("props").asObject());
@ -162,10 +162,10 @@ public class NavBarPlugin extends DoricJavaPlugin {
final JSObject jsObject = decoder.decode().asObject();
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
@Override
public Object call() throws Exception {
public Object call() {
String viewId = jsObject.getProperty("id").asString().value();
String type = jsObject.getProperty("type").asString().value();
ViewNode node = ViewNode.create(getDoricContext(), type);
ViewNode<?> node = ViewNode.create(getDoricContext(), type);
node.setId(viewId);
node.init(new FrameLayout.LayoutParams(0, 0));
node.blend(jsObject.getProperty("props").asObject());
@ -205,10 +205,10 @@ public class NavBarPlugin extends DoricJavaPlugin {
final JSObject jsObject = decoder.decode().asObject();
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
@Override
public Object call() throws Exception {
public Object call() {
String viewId = jsObject.getProperty("id").asString().value();
String type = jsObject.getProperty("type").asString().value();
ViewNode node = ViewNode.create(getDoricContext(), type);
ViewNode<?> node = ViewNode.create(getDoricContext(), type);
node.setId(viewId);
node.init(new FrameLayout.LayoutParams(0, 0));
node.blend(jsObject.getProperty("props").asObject());

View File

@ -346,7 +346,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
[collectionView registerClass:[DoricFlowLayoutViewCell class] forCellWithReuseIdentifier:identifier];
DoricFlowLayoutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
if (!cell.viewNode) {
DoricFlowLayoutItemNode *itemNode = [[DoricFlowLayoutItemNode alloc] initWithContext:self.doricContext];
DoricFlowLayoutItemNode *itemNode = (DoricFlowLayoutItemNode *) [DoricViewNode create:self.doricContext withType:@"FlowLayoutItem"];
[itemNode initWithSuperNode:self];
cell.viewNode = itemNode;
[cell.contentView addSubview:itemNode.view];

View File

@ -159,7 +159,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
DoricTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId ?: @"doriccell"];
if (!cell) {
cell = [[DoricTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseId ?: @"doriccell"];
DoricListItemNode *listItemNode = [[DoricListItemNode alloc] initWithContext:self.doricContext];
DoricListItemNode *listItemNode = (DoricListItemNode *) [DoricViewNode create:self.doricContext withType:@"ListItem"];
[listItemNode initWithSuperNode:self];
cell.doricListItemNode = listItemNode;
cell.backgroundColor = [UIColor clearColor];

View File

@ -100,8 +100,8 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
- (void)afterBlended:(NSDictionary *)props {
bool needToScroll = (self.propLoop && !self.loop)
|| (![self.renderPageFuncId isEqualToString: self.propRenderPageFuncId])
|| (self.itemCount == 0 && self.propItemCount > 0);
|| (![self.renderPageFuncId isEqualToString:self.propRenderPageFuncId])
|| (self.itemCount == 0 && self.propItemCount > 0);
// handle item count
if (self.itemCount != self.propItemCount) {
@ -159,7 +159,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
NSDictionary *props = model[@"props"];
DoricSliderViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"doricCell" forIndexPath:indexPath];
if (!cell.doricSlideItemNode) {
DoricSlideItemNode *slideItemNode = [[DoricSlideItemNode alloc] initWithContext:self.doricContext];
DoricSlideItemNode *slideItemNode = (DoricSlideItemNode *) [DoricViewNode create:self.doricContext withType:@"SlideItem"];
[slideItemNode initWithSuperNode:self];
cell.doricSlideItemNode = slideItemNode;
[cell.contentView addSubview:slideItemNode.view];