Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
react-onsenui Types are incomplete ?
-
Hi there :) I’m new to Onsen and this community, glad to be part of it :)
Wanted to know if anyone else out there is using react-onsenui types ?npm install onsenui react-onsenui --save-dev
I have found that a few (or many) of the components are missing, for example you can find Input but not Checkbox or SearchInput
If I try to create my custom React component which will render the ons-search-input tag, it works except for the events which won’t fire.
class TestApp extends React.Component { constructor() { super(); } HandleChange() { console.log("change fired... "); } render() { var CustomTag = 'ons-search-input'; var rval = <CustomTag placeholder='jatartapa' onChange={this.HandleChange} /> ; return rval; } }
So I would like to know what’s up with the type definitions offered here: https://onsen.io/v2/guide/react/
And also, out of curiosity, I would like to know why the events are not firing if I create the custom onsen tag.Have a nice weekend :)
Agustin.
-
@SharpDev Hi, welcome aboard! Do you mean that
Checkbox
andSearchInput
React component don’t work in your app? They should be available if your have a recent version ofreact-onsenui
andonsenui
. Works here.
-
I’m saying that I’m using Typescript to create a React APP that uses OnsenUI.
In implement the OnsenUI components it’s necessary the react-onsenui types for the best typescript experience, but not all of the components are typed.npm install @types/react-onsenui --save-dev
Brings this: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-onsenui/index.d.ts
And if you take a look, you will not find Checkbox or SearchInput (to name a few) react-onsenui components.If I use bare javascript it will work but in Typescript I see compilation errors saying that some components were not found in onsenui-react.
I hope it makes sense :)
-
@SharpDev Oh, I see! I was confused because we didn’t actually published any types for
react-onsenui
, I wasn’t aware of that package. However, we do publish type definition foronsenui
which can be found here (they are also distributed insideonsenui
npm package). Perhaps you can use that to update React types, it shouldn’t be too much :)