kusti8 / proton-native

A React environment for cross platform desktop apps
https://proton-native.js.org
MIT License
10.92k stars 360 forks source link

TypeError: Cannot read property 'setParent' of undefined #269

Closed giovanniKleinCampigoto closed 4 years ago

giovanniKleinCampigoto commented 4 years ago

Describe the bug When I'm importing a Button from proton-native, and rendering it the app crashes, with the error: TypeError: Cannot read property 'setParent' of undefined.

To Reproduce

import { Button } from 'proton-native';

return (
    <App>
      <Window style={{ width: 700, height: 768, backgroundColor: 'white' }}>
        <View>
          <Text style={processStyle}>aksjdhahdjk</Text>
          <Button>Click</Button>
        </View>
      </Window>
    </App>
  );

Expected behavior Button should be rendered with sucess.

Screenshots Captura de tela de 2020-02-26 16-12-41

Versions:

Additional context Add any other context about the problem here.

olingern commented 4 years ago

Also having the same problem on Arch linux and Node 12.14.1

olingern commented 4 years ago

Not sure why, but working from the examples I'm able to compile.

jcolag commented 4 years ago

I'm obviously not the expert, but it looks like you may need to import { App, Button View, Text, Window } from 'proton-native' instead of just Button, to get the application running.

giovanniKleinCampigoto commented 4 years ago

I'm obviously not the expert, but it looks like you may need to import { App, Button View, Text, Window } from 'proton-native' instead of just Button, to get the application running.

Thanks for the heads up, but everything is imported, it's just a snippet.

kusti8 commented 4 years ago

As seen here, Button takes no children. To pass the text to the button, you can use the title prop. I've added an error that should make this clearer in the future.