kusti8 / proton-native

A React environment for cross platform desktop apps

Home Page:https://proton-native.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'setParent' of undefined

giovanniKleinCampigoto opened this issue · comments

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:

  • OS: Ubuntu
  • Version 19.04
  • Node version v12.14.1

Additional context
Add any other context about the problem here.

Also having the same problem on Arch linux and Node 12.14.1

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

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.

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.

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.