select.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import Tool from '../Systems/Tool';
  2. import {View , Text , Button,StyleSheet , Image} from 'react-native';
  3. import React from 'react';
  4. //import { Icon } from 'react-native-elements'
  5. import Icon from "react-native-vector-icons/MaterialIcons";
  6. import Library from 'trapilib/dist/lib';
  7. let {
  8. CoreSystem,
  9. ViewSystem,
  10. ViewNode
  11. } = Library;
  12. const styles = StyleSheet.create({
  13. container: {
  14. flex: 1,
  15. borderRadius: 4,
  16. borderWidth: 1,
  17. borderColor: '#d6d7da',
  18. backgroundColor: 'red',
  19. alignItems: 'center',
  20. justifyContent: 'center',
  21. },
  22. text:{
  23. flex:1,
  24. backgroundColor:'red'
  25. }
  26. });
  27. const mStyle = StyleSheet.create({
  28. container:{
  29. flex:1,
  30. flexDirection:'row'
  31. }
  32. })
  33. export default class Select extends Tool{
  34. constructor(props){
  35. super(props)
  36. this.selectedNode = null;
  37. }
  38. editViewNode(CS,node){
  39. if(!node) return;
  40. if( this.selectedNode ) {
  41. this.selectedNode.props.selected = false;
  42. }
  43. node.props = {
  44. ...node.props,
  45. selected: true
  46. }
  47. this.selectedNode = node;
  48. let View = CS.getCurrentView();
  49. this.selectedNodeParent = View.getParent(node);
  50. }
  51. render(){
  52. let selectStyle;
  53. if(this.active){
  54. selectStyle = {backgroundColor:"#a6a6a6"}
  55. }else{
  56. selectStyle = {backgroundColor:"#F1F1F1"}
  57. }
  58. return(
  59. <View>
  60. <Image name='near me'
  61. style={{width: 20, height: 20}}
  62. source= {this.active ? require('../assets/select.svg') : require('../assets/outline.svg')}
  63. containerStyle={selectStyle}
  64. />
  65. </View>
  66. )
  67. }
  68. }
  69. const UnSelectedCont = StyleSheet.create({
  70. container:{
  71. padding:0,
  72. borderWidth:1
  73. }
  74. })