select.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. let selectStyle;
  62. if(this.active){
  63. selectStyle = {backgroundColor:"#a6a6a6"}
  64. }else{
  65. selectStyle = {backgroundColor:"#F1F1F1"}
  66. }
  67. return(
  68. <View>
  69. <Button
  70. color="#f1f1f1"
  71. title={<Icon name='sc-telegram'
  72. type='evilicon'
  73. color="#606060"
  74. containerStyle={selectStyle}
  75. />}
  76. />
  77. </View>
  78. )
  79. }
  80. }
  81. const UnSelectedCont = StyleSheet.create({
  82. container:{
  83. padding:0,
  84. borderWidth:1
  85. }
  86. })