shirakaba / react-nativescript

React renderer for NativeScript
https://react-nativescript.netlify.com
MIT License
280 stars 14 forks source link

Unable to use $GridLayout in jsx/tsx #38

Closed Lelelo1 closed 5 years ago

Lelelo1 commented 5 years ago

$GridLayout

Using "react-nativescript": "^0.11.0",. And there appears to be no problem creating GridLayouts in componentDidMount and adding them.

shirakaba commented 5 years ago

~I may have made children mandatory for that component (evidently a bad idea); does the error resolve upon adding a child component?~

shirakaba commented 5 years ago

Wait, forget that, I misread it.

See at the end of the error message that the rows and columns properties are missing.

In NativeScript Core, those are optional, but in React NativeScript, I set them up as mandatory. I'll have to amend that. In the meantime, you should write:

<$GridLayout rows={[]} columns={[]}>
</$GridLayout>

See my sample app for examples of how to fill in the rows and columns properties on GridLayout in React NativeScript v0.11.0:

https://github.com/shirakaba/rpstrackerrns/blob/master/app/views/pages/detail/DetailPage.tsx#L604

In a future version of RNS, I'd like to accept strings instead of the strongly-typed ItemSpecs here, as they're very annoying to write out.

Lelelo1 commented 5 years ago

Yes the following worked:

<$GridLayout rows={[]} columns={[]}>

</$GridLayout>