react-gtk icon indicating copy to clipboard operation
react-gtk copied to clipboard

Please give an example how eventhandlers ar used.

Open rockiger opened this issue 5 years ago • 5 comments

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.

rockiger avatar May 09 '19 20:05 rockiger

@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.

clayrisser avatar May 10 '19 00:05 clayrisser

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

  • react-style declarative programming, that has a great user base,
  • reactive state management and
  • has access to the node ecosystem

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.

rockiger avatar May 10 '19 07:05 rockiger

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 avatar May 10 '19 08:05 clayrisser

Building examples and documentation is always welcome too :)

clayrisser avatar May 10 '19 08:05 clayrisser

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

clayrisser avatar Dec 09 '23 14:12 clayrisser