fable-compiler / fable-react

Fable bindings and helpers for React and React Native
MIT License
275 stars 66 forks source link

React Error when trying to add bindings #146

Closed markpattison closed 5 years ago

markpattison commented 5 years ago

I'm trying to add bindings for more Google Maps functionality, specifically the MarkerLabel type.

My attempt is in this commit in a sample project.

I get the following errors at runtime (more detail in image). What am I doing wrong?

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

InvalidValueError: setLabel: not a string; and no text property

image

MangelMaxime commented 5 years ago

From the documentation and the error Label should be a string. You are passing a React.ReactElement to it.

So using MarkerProperties "my text" should work.

Also, the library is using the npm package react-google-maps which doesn't have a type MarkerLabel but only Marker same for the official Google documentation. They are creating new google.maps.Marker not new google.maps.MarkerLabel.

markpattison commented 5 years ago

Sorry, I linked to the wrong Google Maps docs page. Here is the documentation for the MarkerLabel interface.

But I see that this type isn't exposed in react-google-maps, so I guess we can't use it?

MangelMaxime commented 5 years ago

You can't use it directly. Last release of react-google-maps is one year old so perhaps it's outdated compared to the latest features of Google Maps.

You can always write the wrapper for MarkerLabel by looking at how it's done for the other classes.

I think we can close this issue because it's not related to the binding itself?

markpattison commented 5 years ago

Agreed. Thanks for your help!

markpattison commented 5 years ago

PS - this component looks like it might be more up-to-date. @forki ?