Nikatlas 5 éve
szülő
commit
136c4e08dc
4 módosított fájl, 96 hozzáadás és 4 törlés
  1. 68 0
      Components/Alignment.js
  2. 13 1
      Systems/SideBar.js
  3. 3 2
      yalc.lock
  4. 12 1
      yarn.lock

+ 68 - 0
Components/Alignment.js

@@ -0,0 +1,68 @@
+import React, { useState } from 'react';
+import {View , Text, TextInput, Button,StyleSheet} from 'react-native';
+import { Icon } from 'react-native-elements'
+
+export default class TextEditor extends React.Component {
+	constructor(props) {
+		super(props);
+	}
+
+	getStyle(i) {
+		switch(i) {
+			case 0:
+				return {
+					alignItems: 'flex-start'
+				} 
+			case 1:
+				return {
+					alignItems: 'center'
+				} 
+			case 2:
+				return {
+					alignItems: 'flex-end'
+				} 
+			case 3:
+				return {
+					alignItems: 'stretch'
+				} 
+		}
+	}
+	set(i) {
+		let style = this.getStyle(i);
+		this.props.onSelect && this.props.onSelect(style);
+	}
+	render() {
+		let iconStyle = styles.iconStyle;
+		return (
+			<View style={styles.container}>
+				<Icon name="format-align-left" iconStyle={iconStyle} onClick={() => this.set(0)}/>
+				<Icon name="format-align-center" iconStyle={iconStyle} onClick={() => this.set(1)}/>
+				<Icon name="format-align-right" iconStyle={iconStyle} onClick={() => this.set(2)}/>
+				<Icon name="format-align-justify" iconStyle={iconStyle} onClick={() => this.set(3)}/>
+			</View>
+		);
+	}
+}
+
+const styles = StyleSheet.create({
+	container:{
+		padding:15,
+		flexDirection: 'row',
+		justifyContent: 'space-around',
+		borderBottomColor: '#B4B4B4',
+        borderBottomWidth: 1
+	},
+	defaultInput: {
+		marginTop:6,
+		borderWidth:1,
+		width:200
+	},
+	title: {
+
+	},
+	iconStyle: {
+		fontSize: 18,
+		opacity: 0.6,
+		cursor: 'pointer'
+	}
+})

+ 13 - 1
Systems/SideBar.js

@@ -4,6 +4,8 @@ import Library from 'trapilib/dist/lib';
 import { TextInput, Image, Button } from 'react-native';
 
 import TextEditor from '../Components/TextEditor';
+import Alignment from '../Components/Alignment';
+
 // import Numbers from '../Components/Numbers';
 // import ColorEditor from '../Components/ColorEditor';
 import TypeHandler from '../Components/TypeHandler.js';
@@ -64,6 +66,13 @@ export default class SideBar extends BaseSystem {
 		node.props[key] = text;
 		this.forceUpdate();
     }
+    editNodeStyle(node, style) {
+    	node.props = {
+    		...node.props,
+    		...style
+    	}
+    	this.forceUpdate();
+    }
 
     createHandler(Structure, viewNodeProps, key, onChange) {
     	let Editor = TypeHandler(Structure);
@@ -80,6 +89,7 @@ export default class SideBar extends BaseSystem {
 				editorProps.value = viewNodeProps[key];
 				break;
 			case DataTypes.Types.Integer:
+			case DataTypes.Types.Real:
 			case DataTypes.Types.Bool:
 				editorProps.number = viewNodeProps[key];
 				break;
@@ -144,7 +154,9 @@ export default class SideBar extends BaseSystem {
 
 		return (
   			<View>
-  				<Text style={SideBarStyle.title}>Side Bar</Text>
+  				<Alignment onSelect={(style) => this.editNodeStyle(selectedNode, style)} />
+
+
   				{StyleData.length > 0 ? (
   				<View key={Math.random()}>
   					<select onChange={(event) => {

+ 3 - 2
yalc.lock

@@ -2,8 +2,9 @@
   "version": "v1",
   "packages": {
     "trapilib": {
-      "signature": "aee1c675df0c20355846a68f9b804e38",
-      "file": true
+      "signature": "91bcddc53ea8c747cf405a4122aaedbc",
+      "file": true,
+      "replaced": "http://git.onarbooks.com/Klapi/TrapiLib.git"
     }
   }
 }

+ 12 - 1
yarn.lock

@@ -5716,9 +5716,20 @@ [email protected]:
   resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
   integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
 
+"trapilib@file:.yalc/trapilib":
+  version "1.1.1-91bcddc5"
+  dependencies:
+    expo "^34.0.0-experiment.8"
+    prop-types "^15.7.2"
+    react "16.8.3"
+    react-dom "^16.8.6"
+    react-native "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz"
+    react-native-elements "^1.1.0"
+    react-native-web "^0.11.5"
+
 "trapilib@http://git.onarbooks.com/Klapi/TrapiLib.git":
   version "1.1.1"
-  resolved "http://git.onarbooks.com/Klapi/TrapiLib.git#fd2d66f1ce2dedfd4eb7fb3d9ced30815dd3ccfa"
+  resolved "http://git.onarbooks.com/Klapi/TrapiLib.git#012e5e20b494eb5bf997fc930c15605187f04bf2"
   dependencies:
     expo "^34.0.0-experiment.8"
     prop-types "^15.7.2"