-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work with MaterialUI TextFields #10
Comments
@abinavseelan branch <InputTrigger
trigger={{
keyCode: 50,
shiftKey: true,
}}
onStart={handleMention}
>
{setRef => {
return <TextInputWithError {...props} inputRef={setRef} />; //wrapper for material ui text-field
}}
</InputTrigger> Could you give some update about this Branch and when it'll be merged with master? I tried to work with an npm github reference but it didn't work properly. I had to copy your index.js and utils.js and that's how I know it's working. Thanks! 🙏 Notes: |
The reason github ref doesn't work is because the built files aren't included in the github repo, They're somehow built inside npm's servers, I'm not too familiar with their system. However if you use the branch with the following: |
@CylonOven Thanks for the reply. Unfortunately, this is not a personal project and I won't be able to include an extra step such a |
One other option, in the case that this project isn't going to respond to any of their PRs / issues is to create a new file that imports this component, then over-rides the methods that have been updated / you have problems with, with working methods, then re-export it, and input this new component rather than the original . I'm using the quilll editor, which required a lot of hacking inside this package due to it's not a normal HTML element, and if I didn't have an option to use own own fork of the project that's what I would do. |
@CylonOven Yeah, that sounds like a good idea, Thanks man! ⭐️ |
@CylonOven draft version for my InputTrigger extension import React from "react";
import PropTypes from "prop-types";
import ReactInputTrigger from "react-input-trigger";
// CUSTOM function override of react-input-trigger,https://github.com/abinavseelan/react-input-trigger
/* eslint-disable */
class InputTrigger extends ReactInputTrigger {
/*
* Those changes have been made by the repository owner in branch bugfix/broken-ref. this file should be REMOVE once this PR will be merged with master.
* */
constructor(args) {
super(args);
this.setRef = this.setRef.bind(this);
this.element = null;
}
setRef(element) {
if (element && Object.hasOwnProperty.call(element, "current")) {
this.element = element.current;
} else {
this.element = element;
}
}
render() {
const {
children,
endTrigger,
onCancel,
onStart,
onType,
trigger,
...rest
} = this.props;
return (
<div
role="textbox"
tabIndex={-1}
onKeyDown={this.handleTrigger}
{...rest}
>
{children(this.setRef)}
</div>
);
}
}
InputTrigger.propTypes = {
...InputTrigger.propTypes,
children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
};
InputTrigger.defaultProps = {
trigger: {
keyCode: null,
shiftKey: false,
ctrlKey: false,
metaKey: false,
},
onStart: () => {},
onCancel: () => {},
onType: () => {},
endTrigger: () => {},
};
export default InputTrigger; Hopefully, @abinavseelan will see this and he would like to merge his changes to master 🤞 . |
@charly-palencia, @dominikbulaj So sorry about not being able to respond to these issues earlier! We've published a beta version npm install [email protected] Thanks a lot for your support! |
We're still updating the docs to reflect this change before we publish the release. Meanwhile, in order to test this out please use the following steps 🙂 : If using
|
Do we have an idea of when the new release featuring Thanks. |
Any update on this @abinavseelan ? |
thank you for that material ui textfield example above. adding input ref is working but I am seeing this warning in console
by the way I am using version |
Hi,
I wanted to implement
react-input-trigger
to project I work on. There I use MaterialUI and TextFields.However
react-input-trigger
fails withonStart
My component is as simple as:
Seems error comes from dependency
textarea-caret-position
https://github.com/component/textarea-caret-position/blob/master/index.js#L71Any idea how to make it work? It seems to me that it works only with html tags (textarea or input) and not React components, am I right?
The text was updated successfully, but these errors were encountered: