nitin42 / terminal-in-react

👨‍💻 A component that renders a terminal
http://terminal-in-react.surge.sh/
MIT License
2.12k stars 151 forks source link

It appears "allowTabs" does not work #81

Open jloveric opened 4 years ago

jloveric commented 4 years ago

It seems the "allowTabs" option, setting to true or false does nothing? Whether it's set to true or false, you can still add new tabs. Also is there a way to get rid of the tab bar completely? I was thinking allowTabs would do that.

jloveric commented 4 years ago

Ok, some very strange things are happening. The tab starts out saying "bash", but if I type a command, "Holy cow" say, and move to a different browser tab then back to the browser tab containing the terminal then where there was once "bash" it now says "Holy". This is a super simple app with nothing more than the Terminal.

1) Create simple terminal app and go to the browser to view. 2) The tab should say "bash" 3) type something in the command "Holy Cow" - the command has to have at least 2 words it seems 4) go to a different browser tab and come back to the tab containing the terminal 5) The tab that said "bash" now says "Holy".

Could be a bug in one of the dependencies. Here is the code - I'm using the pass though.

import React, { Component } from 'react'; import Terminal from 'terminal-in-react'; import './App.css';

function App() {
  return (

        <Terminal
          hideTopBar='true'
          allowTabs='true'
          startState="maximised"
          color='green'
          backgroundColor='black'
          barColor='black'
          style={{ fontWeight: "bold", fontSize: "1em", width: "100%" }}
          commandPassThrough={cmd => { 
            return `You said ${cmd.join(' ')}! `
          }}
          msg='Hello World
        />

    );

}
export default App;

Terminal1 Terminal2

jloveric commented 4 years ago

For now you can visit https://jloveric.github.io/ to see what I'm talking about as I have the terminal example running there.

camisatx commented 4 years ago

Try putting your boolean based variables within curly brackets, like this:

<Terminal
  hideTopBar={true}
  allowTabs={true}
/>

Otherwise React detects them as strings and not booleans.