Merge pull request #2 from status-im/fix/submit-form

Fix/submit form
This commit is contained in:
Iuri Matias 2019-02-04 06:56:42 -05:00 committed by GitHub
commit 5ebc1f9c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@areknawo/rex": "^2.0.0",
"@babel/runtime-corejs2": "^7.3.1",
"@material-ui/core": "^3.5.1",
"@material-ui/icons": "^3.0.1",
"@types/jest": "^23.3.13",

View File

@ -60,7 +60,7 @@ const keyDownHandler = (e, typingEvent, setValue, value) => {
else if (e.keyCode === 13) {
e.preventDefault();
const form = ChatRoomForm.current;
form.dispatchEvent(new Event("submit"));
form.submitForm();
}
typingEvent(e)
};
@ -152,6 +152,7 @@ class ChatRoom extends Component {
))}
</AutoScrollList>
<Formik
ref={ChatRoomForm}
initialValues={{ chatInput: '' }}
onSubmit={(values, { setSubmitting, resetForm }) => {
const { chatInput } = values;
@ -170,7 +171,7 @@ class ChatRoom extends Component {
setFieldValue
}) => (
<div className="chat-input">
<form onSubmit={handleSubmit} style={formStyle} ref={ChatRoomForm}>
<form onSubmit={handleSubmit} style={formStyle}>
<Button onClick={(e) => this.uploadFileDialog()}><AddCircle /></Button>
<TextField
id="chatInput"

View File

@ -832,6 +832,14 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-transform-typescript" "^7.1.0"
"@babel/runtime-corejs2@^7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.3.1.tgz#0c113242e2328f9674d42703a89bee6ebebe9a82"
integrity sha512-YpO13776h3e6Wy8dl2J8T9Qwlvopr+b4trCEhHE+yek6yIqV8sx6g3KozdHMbXeBpjosbPi+Ii5Z7X9oXFHUKA==
dependencies:
core-js "^2.5.7"
regenerator-runtime "^0.12.0"
"@babel/runtime@7.1.5":
version "7.1.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.1.5.tgz#4170907641cf1f61508f563ece3725150cc6fe39"
@ -3934,7 +3942,7 @@ core-js@^1.0.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=
core-js@^2.4.0, core-js@^2.5.0:
core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.7:
version "2.6.3"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.3.tgz#4b70938bdffdaf64931e66e2db158f0892289c49"
integrity sha512-l00tmFFZOBHtYhN4Cz7k32VM7vTn3rE2ANjQDxdEN6zmXZ/xq1jQuutnmHvMG1ZJ7xd72+TA5YpUK8wz3rWsfQ==