clayrisser / react-gtk

react Native bridge for gtk desktop applications
https://clayrisser.com
MIT License
303 stars 19 forks source link

Please give an example how eventhandlers ar used. #13

Open rockiger opened 5 years ago

rockiger commented 5 years ago

Hello, awesome project! I believe this project and the node-gtk project could boost app development on Linux.

I am trying to recreate the gjs tutorial and I can't figure out how to do event handling.

For example I want to do handle a click event on a button:

import React, { Component } from 'react';
import { render, Button, Box } from '@react-gtk/binding';

class App extends Component {

  onClicked() {
      console.log("clicked");

  }
  render() {
    return (
        <Button label="Click Here" clicked={this.onClicked} />
    );
  }
}

render(<App />, 'Hello World');

The event name would be clicked but I don't know how to handle the event in my component.

clayrisser commented 5 years ago

@rockiger sorry I don't have events supported yet. I will try and get it working soon.

I would love to know what you are using this project for. Would love to feature it in the README.md.

rockiger commented 5 years ago

Hi, I would like to convert my electron app Akiee to react-gtk. Right now it is an Electron app with React and Blueprintjs.

I tried to use proton-native. But the cross platform approach of proton doesn't work for me. It uses the smallest common denominator on any platform. I think a "learn once write anywhere" approach is much more feasible.

I think an approach with

is pure gold for the Linux ecosystem. So far Linux has Python and Qt which imo sucks in comparison to Electron and React.

Let me know if I can be of any assistance. I am mainly involved with web programming, but maybe I can learn something to help you.

clayrisser commented 5 years ago

So the goal of react-gtk is ultimately to have 2 projects. react-gtk is a direct mapping to the gtk library, so names of components and events basically match the gtk docs.

react-native-gtk will be built on top of react-gtk and will ultimately have an identical api to react-native.

Right now the biggest way you can help is just use the project and report bugs.

clayrisser commented 5 years ago

Building examples and documentation is always welcome too :)

clayrisser commented 6 months ago

Sorry for the long long wait. We will have a stable version of this with GTK4 support ready by Christmas 2023! Please join the discord for live updates and feedback.

https://discord.gg/qv7GT5xctw