Skip to content

How to remove a Window component? #54

@elviosak

Description

@elviosak

Hi, im trying to use a second window to make a file/folder picker (i didn't find anything, but is there a simpler way to do it? maybe some widget, or something from the os?), but i can't figure out if theres a way to close it from the javascript side (should close according to some user input), after watching this video https://youtu.be/8jH5gaEEDv4?t=1376 , i tried this:

function App() {
  const [showWindow, setShowWindow] = useState(false);
  const toggleWindow = () => {
    setShowWindow(!showWindow);
  };
  return (
    <>
      <Window windowTitle="Hello 👋🏽" size={mainWindowSize}>
        <View>
          <Button text="Toggle Window" on={{ clicked: toggleWindow }}></Button>
        </View>
      </Window>
      {showWindow && (
        <Window
          windowTitle="Second Window"
          size={secondWindowSize}
        >
          <View>
            <Text>Second Window</Text>
          </View>
        </Window>
      )}
    </>
  );
}

but the second window doesn't close when showWindow is toggled to false, and when it is toggled to true, it opens another "Second Window".

Screenshot_2019-11-11_00-15-01

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions