nodegui / react-nodegui

Build performant, native and cross-platform desktop applications with native React + powerful CSS like styling.🚀
https://react.nodegui.org
MIT License
6.18k stars 171 forks source link

Problems rendering MenuBar with Actions #340

Closed amg98 closed 3 years ago

amg98 commented 3 years ago

Describe the bug I've been struggling in trying to make a menu bar, actions do not appear under each menu.

To Reproduce

The component below holds the menu I'm trying to render:

import React from "react";
import { MenuBar, Menu, Action, Text } from "@nodegui/react-nodegui";

class AppMenu extends React.Component {
    render() {

        return (
            <MenuBar>
                <Menu title="&amp;File">
                    <Action text="New project" />
                    <Action text="Open project" />
                </Menu>
            </MenuBar>
        );
    }
}

export default AppMenu;

Here is the main app component:

class App extends React.Component {
    render() {
        return (
            <Window
                windowTitle="SampleApp"
                minSize={minSize}
                styleSheet={styleSheet}
            >
                <AppMenu />
                <View style={containerStyle}>
                    <Text id="welcome-text">Welcome to NodeGui 🐕</Text>
                    <Text id="step-1">1. Play around</Text>
                    <Text id="step-2">2. Debug</Text>
                </View>
            </Window>
        );
    }
}

Expected behavior It's suppossed to render the menu with the specified actions. Menus show fine but not actions. When I click a menu, nothing shows up.

Desktop (please complete the following information):

amg98 commented 3 years ago

Nvm, I had to just set the "on" property with some events.