select.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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(VS,node){
  38. if(!node || !node.id){
  39. let unselect = StyleSheet.create({
  40. container:{
  41. padding:0,
  42. borderWidth:0
  43. }
  44. })
  45. if(this.selectedNode.props)
  46. this.selectedNode.props.style.container = unselect.container;
  47. this.selectedNode = null;
  48. return;
  49. }
  50. this.selectedNode = node;
  51. let style = StyleSheet.create({
  52. container:{
  53. padding:5,
  54. borderWidth:2
  55. }
  56. })
  57. node.props.style.container = style.container
  58. // let EditNode = new ViewNode(Math.random(),"ViewComp",{text:"Manipulationg the dom",style:styles})
  59. //VS.views[View].addViewNode(EditNode,node)
  60. //VS.views[View].replace(node,EditNode);
  61. }
  62. render(){
  63. return(
  64. <View styles={mStyle.container}>
  65. <Button title={<Icon name='sc-telegram'
  66. type='evilicon'/>}/>
  67. <Text> Select</Text>
  68. </View>
  69. )
  70. }
  71. }
  72. const UnSelectedCont = StyleSheet.create({
  73. container:{
  74. padding:0,
  75. borderWidth:1
  76. }
  77. })