select.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. }
  45. node.props = {
  46. ...node.props,
  47. selected: true
  48. }
  49. this.selectedNode = node;
  50. let View = CS.getCurrentView();
  51. this.selectedNodeParent = View.getParent(node);
  52. }
  53. render(){
  54. let selectStyle;
  55. if(this.active){
  56. selectStyle = {backgroundColor:"#a6a6a6"}
  57. }else{
  58. selectStyle = {backgroundColor:"#F1F1F1"}
  59. }
  60. return(
  61. <View>
  62. <Button
  63. color="#f1f1f1"
  64. title={<Image name='near me'
  65. style={{width: 20, height: 20 , color:'#606060'}}
  66. source= {this.active ? require('../assets/select.svg') : require('../assets/outline.svg')}
  67. containerStyle={selectStyle}
  68. />}
  69. />
  70. </View>
  71. )
  72. }
  73. }
  74. const UnSelectedCont = StyleSheet.create({
  75. container:{
  76. padding:0,
  77. borderWidth:1
  78. }
  79. })