Nikatlas 5 年之前
父節點
當前提交
74e31d197e
共有 6 個文件被更改,包括 185 次插入9 次删除
  1. 0 0
      dist/lib/Module.js
  2. 0 0
      dist/modules/NativeBase/index.js
  3. 1 1
      dist/rules/Universal.css
  4. 173 0
      src/lib/Module.js
  5. 10 7
      src/modules/NativeBase/index.js
  6. 1 1
      src/rules/Universal.css

文件差異過大導致無法顯示
+ 0 - 0
dist/lib/Module.js


文件差異過大導致無法顯示
+ 0 - 0
dist/modules/NativeBase/index.js


+ 1 - 1
dist/rules/Universal.css

@@ -25,7 +25,7 @@ ROOT > ~Badge {
 	fontSize: 11;
 }
 Image > ~Text {
-	fontSize: 111;
+	fontSize: 52;
 }
 Image > Text {
 	asdfontSize: 111;

+ 173 - 0
src/lib/Module.js

@@ -10,6 +10,7 @@ export default class Module extends React.Component{
 
 	constructor(props) {
 		super(props);
+
 		this.Core = Injection.inject('Core');
 		this.Modules = Injection.inject('Modules');
 
@@ -79,4 +80,176 @@ export default class Module extends React.Component{
 	getProps() {
 		return Resolver(this.constructor.Inputs, this.props);
 	}
+
+	static getDerivedStateFromProps(props) {
+		let styleProps = {};
+		let restProps = {};
+		for(var i in props) {
+			if(StyleProps[i]) {
+				styleProps[i] = props[i];
+			} else {
+				restProps[i] = props[i];
+			}
+		}
+		return {
+			styleProps,
+			restProps
+		}
+	}
+}
+
+const StyleProps = {
+	"fontSize":1,
+	"fontFamily":1,
+	"fontWeight":1,
+	"letterSpacing":1,
+
+
+	"animationDelay":1,
+	"animationDirection":1,
+	"animationDuration":1,
+	"animationFillMode":1,
+	"animationIterationCount":1,
+	"animationKeyframes":1,
+	"animationPlayState":1,
+	"animationTimingFunction":1,
+	"transitionDelay":1,
+	"transitionDuration":1,
+	"transitionProperty":1,
+	"transitionTimingFunction":1,
+	"borderColor":1,
+	"borderBottomColor":1,
+	"borderEndColor":1,
+	"borderLeftColor":1,
+	"borderRightColor":1,
+	"borderStartColor":1,
+	"borderTopColor":1,
+	"borderRadius":1,
+	"borderBottomEndRadius":1,
+	"borderBottomLeftRadius":1,
+	"borderBottomRightRadius":1,
+	"borderBottomStartRadius":1,
+	"borderTopEndRadius":1,
+	"borderTopLeftRadius":1,
+	"borderTopRightRadius":1,
+	"borderTopStartRadius":1,
+	"borderStyle":1,
+	"borderBottomStyle":1,
+	"borderEndStyle":1,
+	"borderLeftStyle":1,
+	"borderRightStyle":1,
+	"borderStartStyle":1,
+	"borderTopStyle":1,
+	"cursor":1,
+	"touchAction":1,
+	"userSelect":1,
+	"willChange":1,
+	"alignContent":1,
+	"alignItems":1,
+	"alignSelf":1,
+	"backfaceVisibility":1,
+	"borderWidth":1,
+	"borderBottomWidth":1,
+	"borderEndWidth":1,
+	"borderLeftWidth":1,
+	"borderRightWidth":1,
+	"borderStartWidth":1,
+	"borderTopWidth":1,
+	"bottom":1,
+	"boxSizing":1,
+	"direction":1,
+	"display":1,
+	"end":1,
+	"flex":1,
+	"flexBasis":1,
+	"flexDirection":1,
+	"flexGrow":1,
+	"flexShrink":1,
+	"flexWrap":1,
+	"height":1,
+	"justifyContent":1,
+	"left":1,
+	"margin":1,
+	"marginBottom":1,
+	"marginHorizontal":1,
+	"marginEnd":1,
+	"marginLeft":1,
+	"marginRight":1,
+	"marginStart":1,
+	"marginTop":1,
+	"marginVertical":1,
+	"maxHeight":1,
+	"maxWidth":1,
+	"minHeight":1,
+	"minWidth":1,
+	"order":1,
+	"overflow":1,
+	"overflowX":1,
+	"overflowY":1,
+	"padding":1,
+	"paddingBottom":1,
+	"paddingHorizontal":1,
+	"paddingEnd":1,
+	"paddingLeft":1,
+	"paddingRight":1,
+	"paddingStart":1,
+	"paddingTop":1,
+	"paddingVertical":1,
+	"position":1,
+	"right":1,
+	"start":1,
+	"top":1,
+	"visibility":1,
+	"width":1,
+	"zIndex":1,
+	"aspectRatio":1,
+	"gridAutoColumns":1,
+	"gridAutoFlow":1,
+	"gridAutoRows":1,
+	"gridColumnEnd":1,
+	"gridColumnGap":1,
+	"gridColumnStart":1,
+	"gridRowEnd":1,
+	"gridRowGap":1,
+	"gridRowStart":1,
+	"gridTemplateColumns":1,
+	"gridTemplateRows":1,
+	"gridTemplateAreas":1,
+	"shadowColor":1,
+	"shadowOffset":1,
+	"shadowOpacity":1,
+	"shadowRadius":1,
+	"shadowSpread":1,
+	"perspective":1,
+	"perspectiveOrigin":1,
+	"transform":1,
+	"transformOrigin":1,
+	"transformStyle":1,
+	"backgroundColor":1,
+	"opacity":1,
+	"elevation":1,
+	"backdropFilter":1,
+	"backgroundAttachment":1,
+	"backgroundBlendMode":1,
+	"backgroundClip":1,
+	"backgroundImage":1,
+	"backgroundOrigin":1,
+	"backgroundPosition":1,
+	"backgroundRepeat":1,
+	"backgroundSize":1,
+	"boxShadow":1,
+	"clip":1,
+	"filter":1,
+	"outlineColor":1,
+	"outlineOffset":1,
+	"outlineStyle":1,
+	"outlineWidth":1,
+	"overscrollBehavior":1,
+	"overscrollBehaviorX":1,
+	"overscrollBehaviorY":1,
+	"scrollbarWidth":1,
+	"scrollSnapAlign":1,
+	"scrollSnapType":1,
+	"WebkitMaskImage":1,
+	"WebkitOverflowScrolling":1
 }

+ 10 - 7
src/modules/NativeBase/index.js

@@ -131,8 +131,7 @@ export class Card extends Module {
 		} = this.props;
 
 		let item = this.renderModule('Button','NativeBase');
-		console.log("ITEM : ", item);
-		return  <CardCtor {...rest}>
+		return  <CardCtor  style={this.state.styleProps} {...this.state.restProps}>
             {header ? <CardItemCtor header>
               <TextCtor>{header}</TextCtor>
             </CardItemCtor>
@@ -281,7 +280,7 @@ export class H1 extends Module {
 			content,
 			...rest
 		} = this.props;
-		return <H1Ctor {...rest}>
+		return <H1Ctor style={this.state.styleProps} {...this.state.restProps}>
 			{content}
 		</H1Ctor>
 	}
@@ -295,7 +294,7 @@ export class H2 extends Module {
 			content,
 			...rest
 		} = this.props;
-		return <H2Ctor {...rest}>
+		return <H2Ctor style={this.state.styleProps} {...this.state.restProps}>
 			{content}
 		</H2Ctor>
 	}
@@ -309,7 +308,7 @@ export class H3 extends Module {
 			content,
 			...rest
 		} = this.props;
-		return <H3Ctor {...rest}>
+		return <H3Ctor style={this.state.styleProps} {...this.state.restProps}>
 			{content}
 		</H3Ctor>
 	}
@@ -517,7 +516,7 @@ export class Text extends Module {
 			content,
 			...rest
 		} = this.props
-		return <TextCtor {...rest} >
+		return <TextCtor style={this.state.styleProps} {...this.state.restProps}>
 			{content}
 		</TextCtor>
 	}
@@ -576,6 +575,10 @@ export class View extends Module {
 }
 
 Text.Inputs = {
+	fontSize: new Types.Integer(),
+	fontWeight: new Types.Integer(),
+	fontFamily: new Types.Text(),
+	letterSpacing: new Types.Integer(),
 	uppercase: new Types.Bool().default(false),
 	content: new Types.Text().default("Hello world!")
 }
@@ -824,7 +827,7 @@ export default {
 	// Tab,
 	// TabContainer,
 	// TabHeading,
-	// Text,
+	Text,
 	// Textarea,
 	// Thumbnail,
 	// Title,

+ 1 - 1
src/rules/Universal.css

@@ -25,7 +25,7 @@ ROOT > ~Badge {
 	fontSize: 11;
 }
 Image > ~Text {
-	fontSize: 111;
+	fontSize: 52;
 }
 Image > Text {
 	asdfontSize: 111;

部分文件因文件數量過多而無法顯示