feat:delete gravity in Stack

This commit is contained in:
pengfei.zhou 2019-11-16 16:09:24 +08:00
parent 009c723bc8
commit 3f4b336205
4 changed files with 10 additions and 15 deletions

View File

@ -51,14 +51,8 @@ public class StackNode extends GroupNode<FrameLayout> {
@Override @Override
protected void blend(FrameLayout view, String name, JSValue prop) { protected void blend(FrameLayout view, String name, JSValue prop) {
switch (name) {
case "gravity":
view.setForegroundGravity(prop.asNumber().toInt());
break;
default:
super.blend(view, name, prop); super.blend(view, name, prop);
} }
}
@Override @Override
protected ViewGroup.LayoutParams generateDefaultLayoutParams() { protected ViewGroup.LayoutParams generateDefaultLayoutParams() {

View File

@ -17,6 +17,7 @@ package pub.doric.shader.list;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.github.pengfeizhou.jscore.JSObject;
import com.github.pengfeizhou.jscore.JSValue; import com.github.pengfeizhou.jscore.JSValue;
import pub.doric.DoricContext; import pub.doric.DoricContext;
@ -45,4 +46,11 @@ public class ListItemNode extends StackNode {
super.blend(view, name, prop); super.blend(view, name, prop);
} }
} }
@Override
public void blend(JSObject jsObject) {
super.blend(jsObject);
getDoricLayer().getLayoutParams().width = getLayoutParams().width;
getDoricLayer().getLayoutParams().height = getLayoutParams().height;
}
} }

View File

@ -29,10 +29,6 @@ - (DoricStackView *)build {
} }
- (void)blendView:(DoricStackView *)view forPropName:(NSString *)name propValue:(id)prop { - (void)blendView:(DoricStackView *)view forPropName:(NSString *)name propValue:(id)prop {
if ([name isEqualToString:@"gravity"]) {
view.gravity = (DoricGravity) [(NSNumber *) prop integerValue];
} else {
[super blendView:view forPropName:name propValue:prop]; [super blendView:view forPropName:name propValue:prop];
} }
}
@end @end

View File

@ -17,12 +17,9 @@ import { LayoutConfig, Group, Property, IView } from "./view";
import { Gravity } from "../util/gravity"; import { Gravity } from "../util/gravity";
export interface IStack extends IView { export interface IStack extends IView {
gravity?: Gravity
} }
export class Stack extends Group implements IStack { export class Stack extends Group implements IStack {
@Property
gravity?: Gravity
} }