add.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. <Button
  50. color="#F1F1F1"
  51. title={<Icon name='add'
  52. color="#606060"
  53. containerStyle={selectStyle}
  54. />
  55. }
  56. />
  57. </View>
  58. )
  59. }
  60. }