select.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import Tool from '../Systems/Tool';
  2. import {View , Text , Button,StyleSheet} from 'react-native';
  3. import React from 'react';
  4. import { Icon } from 'react-native-elements'
  5. import Library from 'trapilib/dist/lib';
  6. let {
  7. CoreSystem,
  8. ViewSystem,
  9. ViewNode
  10. } = Library;
  11. const styles = StyleSheet.create({
  12. container: {
  13. flex: 1,
  14. borderRadius: 4,
  15. borderWidth: 1,
  16. borderColor: '#d6d7da',
  17. backgroundColor: 'red',
  18. alignItems: 'center',
  19. justifyContent: 'center',
  20. },
  21. text:{
  22. flex:1,
  23. backgroundColor:'red'
  24. }
  25. });
  26. const mStyle = StyleSheet.create({
  27. container:{
  28. flex:1,
  29. flexDirection:'row'
  30. }
  31. })
  32. export default class Select extends Tool{
  33. constructor(props){
  34. super(props)
  35. this.selectedNode = null;
  36. }
  37. editViewNode(CS,node){
  38. if(!node) return;
  39. if( this.selectedNode ) {
  40. this.selectedNode.props.selected = false;
  41. this.selectedNodeParent.props.selected = false;
  42. }
  43. node.props = {
  44. ...node.props,
  45. selected: true
  46. }
  47. this.selectedNode = node;
  48. let viewName = CS.Routing.getCurrentView();
  49. let View = CS.ViewSystem.getView(viewName);
  50. this.selectedNodeParent = View.getParent(node);
  51. console.log(this.selectedNodeParent)
  52. this.selectedNodeParent.props = {
  53. ...this.selectedNodeParent.props,
  54. selected: true
  55. }
  56. // let EditNode = new ViewNode(Math.random(),"ViewComp",{text:"Manipulationg the dom",style:styles})
  57. //VS.views[View].addViewNode(EditNode,node)
  58. //VS.views[View].replace(node,EditNode);
  59. }
  60. render(){
  61. return(
  62. <View styles={mStyle.container}>
  63. <Button title={<Icon name='sc-telegram'
  64. type='evilicon'
  65. color="#606060"/>}/>
  66. </View>
  67. )
  68. }
  69. }
  70. const UnSelectedCont = StyleSheet.create({
  71. container:{
  72. padding:0,
  73. borderWidth:1
  74. }
  75. })