|
@@ -3,7 +3,7 @@ import ToolBox from './ToolBox';
|
|
|
import Keyboard from './keyboard';
|
|
|
import Mouse from './mouse';
|
|
|
import React from 'react';
|
|
|
-import {Dimensions, StyleSheet, View, Text , Button
|
|
|
+import {Dimensions, StyleSheet, View, Text , Button, TouchableOpacity
|
|
|
} from 'react-native';
|
|
|
import { Icon } from 'react-native-elements'
|
|
|
import Library from 'trapilib/dist/lib';
|
|
@@ -168,15 +168,22 @@ export default class Gui extends BaseSystem {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ removeFrame(routeName) {
|
|
|
+ this.CoreSystem.removePage(routeName);
|
|
|
+ this.forceUpdate();
|
|
|
+ }
|
|
|
+
|
|
|
+ addFrame(routeName) {
|
|
|
+ if(!routeName)
|
|
|
+ routeName = "Page " + (Object.keys(this.CoreSystem.Routing.topology.nodes).length + 1);
|
|
|
|
|
|
- addFrame(routeName = Math.random().toString(36).substring(7)) {
|
|
|
let VS = new Library.View();
|
|
|
let container = VS.getDefaultContainer();
|
|
|
container.props.selected = true;
|
|
|
let mainContent = new ViewNode(Math.random(), 'BaseContainer', {width: 375, height: 667});
|
|
|
VS.setContent(mainContent, container);
|
|
|
-
|
|
|
this.CoreSystem.addPage(routeName,VS);
|
|
|
+ this.CoreSystem.goto(routeName);
|
|
|
this.forceUpdate()
|
|
|
}
|
|
|
renderPageBar(){
|
|
@@ -187,14 +194,21 @@ export default class Gui extends BaseSystem {
|
|
|
let textColor = view === currentView ? PageButtons.selectedText :(null)
|
|
|
return (
|
|
|
<View style={[PageButtons.page , background ] } onClick = {(e) => {
|
|
|
- this.CoreSystem.goto(route)
|
|
|
+ console.log(e);
|
|
|
+ this.CoreSystem.goto(route);
|
|
|
this.forceUpdate()
|
|
|
}}>
|
|
|
<View style = {{ flex:1,
|
|
|
- justifyContent:'center',
|
|
|
+ justifyContent:'space-around',
|
|
|
+ flexDirection: 'row',
|
|
|
alignItems:'center'}}>
|
|
|
|
|
|
<Text style={[PageButtons.text, textColor]}>{route}</Text>
|
|
|
+ {view !== currentView && <Text style={[PageButtons.text, textColor, {color: '#77000066'}]} onClick={(e) => {
|
|
|
+ this.removeFrame(route);
|
|
|
+ e.stopPropagation();
|
|
|
+ return false;
|
|
|
+ }}>X</Text>}
|
|
|
</View>
|
|
|
</View>
|
|
|
|