add.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. console.log(rows[rows.length-1])
  33. View.setColumns(rows[rows.length-1],1)
  34. rows[rows.length-1].props.selected = true;
  35. /*
  36. rows.forEach((row) => {
  37. View.setColumns(row,1);
  38. row.props.selected = true})
  39. */
  40. }
  41. render(){
  42. return(
  43. <View style={{backgroundColor:"red"}}>
  44. <Button style={{backgroundColor:"red"}}
  45. title={<Icon name='add'
  46. color="#606060"
  47. />}
  48. />
  49. </View>
  50. )
  51. }
  52. }