select.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. console.log("@@@@@@@@@@@@@@@")
  8. console.log(Icon)
  9. let {
  10. CoreSystem,
  11. ViewSystem,
  12. ViewNode
  13. } = Library;
  14. const styles = StyleSheet.create({
  15. container: {
  16. flex: 1,
  17. borderRadius: 4,
  18. borderWidth: 1,
  19. borderColor: '#d6d7da',
  20. backgroundColor: 'red',
  21. alignItems: 'center',
  22. justifyContent: 'center',
  23. },
  24. text:{
  25. flex:1,
  26. backgroundColor:'red'
  27. }
  28. });
  29. const mStyle = StyleSheet.create({
  30. container:{
  31. flex:1,
  32. flexDirection:'row'
  33. }
  34. })
  35. export default class Select extends Tool{
  36. constructor(props){
  37. super(props)
  38. this.selectedNode = null;
  39. }
  40. editViewNode(CS,node){
  41. if(!node) return;
  42. if( this.selectedNode ) {
  43. this.selectedNode.props.selected = false;
  44. this.selectedNodeParent.props.selected = false;
  45. }
  46. node.props = {
  47. ...node.props,
  48. selected: true
  49. }
  50. this.selectedNode = node;
  51. let View = CS.getCurrentView();
  52. this.selectedNodeParent = View.getParent(node);
  53. this.selectedNodeParent.props = {
  54. ...this.selectedNodeParent.props,
  55. selected: true
  56. }
  57. }
  58. render(){
  59. let selectStyle;
  60. if(this.active){
  61. selectStyle = {backgroundColor:"#a6a6a6"}
  62. }else{
  63. selectStyle = {backgroundColor:"#F1F1F1"}
  64. }
  65. return(
  66. <View>
  67. <Button
  68. color="#f1f1f1"
  69. title={<Image name='near me'
  70. style={{width: 20, height: 20 , color:'#606060'}}
  71. source= {this.active ? require('../assets/select.svg') : require('../assets/outline.svg')}
  72. containerStyle={selectStyle}
  73. />}
  74. />
  75. </View>
  76. )
  77. }
  78. }
  79. const UnSelectedCont = StyleSheet.create({
  80. container:{
  81. padding:0,
  82. borderWidth:1
  83. }
  84. })