Lelelo1 / rns-reactify

0 stars 0 forks source link

Props should be picked from the NativeScript component #13

Open Lelelo1 opened 5 years ago

Lelelo1 commented 5 years ago

Currently all properties of the NativeScript component are added to the reactified component. Only some of them should be made be available in the jsx. They are currently here made by hard worker @shirakaba

This issue currently causes a crash when adding an event handler to onLoaded in jsx. Looking at the method signature - i'ts invalid to that found in rns:

reactified component: reactify

a component in rns: Screenshot 2019-10-25 at 17 07 45

Lelelo1 commented 5 years ago

They are now picked

But assigning a method to onLoaded (and possibly in other cases as well) - still reassigns the nativescript method causing a crash - when they should only assign to the react-nativescript prop.

I will rename onLoaded to loaded as a temporary fix.

Lelelo1 commented 5 years ago

I will rename onLoaded to loaded as a temporary fix.

No. As it effects more than one method. The problem appears to be that any nativescript property can be changed in the jsx - regardless of the props actually set on the react component. It's possible to change the backgroundcolor even though the prop has been removed.

So in the the case of onLoaded both the nativescript implementation and the react-nativescript runs.

Lelelo1 commented 5 years ago

both the nativescript implementation and the react-nativescript runs.

Currently I have tried to reproduce in react-nativescript with react-nativescript components, they don't have props on them though and I can't set any property in the jsx. _StackLayout, _GridLayout for example.

I can however remove the backgroundColor in NativeScriptComponentTypings and still be able to set a color in the $StackLayout, $GridLayout - which is similar to what I found out in rns-reactify

Lelelo1 commented 5 years ago

A problem when picking the nativescript props is that the props of the plugins will not be included. So I will go without picking props for now.