add.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import Tool from '../Systems/Tool';
  2. import { View , Text , Button , TextInput , StyleSheet} from 'react-native';
  3. import { Icon } from 'react-native-elements'
  4. import React from 'react';
  5. import Library from 'trapilib/dist/lib';
  6. let {
  7. CoreSystem,
  8. ViewSystem,
  9. ViewNode,
  10. Node
  11. } = Library;
  12. export default class Add extends Tool{
  13. constructor(){
  14. super()
  15. this.selectedNode = null;
  16. }
  17. editViewNode(CS,node){
  18. if(!node) return;
  19. if( this.selectedNode ) {
  20. this.selectedNode.props.selected = false;
  21. }
  22. node.props = {
  23. ...node.props,
  24. selected: true
  25. }
  26. this.selectedNode = node;
  27. let viewName = CS.Routing.getCurrentView();
  28. let View = CS.ViewSystem.getView(viewName);
  29. let rows = View.getRows(this.selectedNode);
  30. View.setRows(this.selectedNode,rows.length + 1)
  31. rows = View.getRows(this.selectedNode)
  32. View.setColumns(rows[rows.length-1],1)
  33. rows[rows.length-1].props.selected = true;
  34. /*
  35. rows.forEach((row) => {
  36. View.setColumns(row,1);
  37. row.props.selected = true})
  38. */
  39. }
  40. render(){
  41. let selectStyle;
  42. if(this.active){
  43. selectStyle = {backgroundColor:"#a6a6a6"}
  44. }else{
  45. selectStyle = {backgroundColor:"#F1F1F1"}
  46. }
  47. return(
  48. <View>
  49. <Icon name='add'
  50. color="#606060"
  51. containerStyle={selectStyle}
  52. />
  53. </View>
  54. )
  55. }
  56. }