-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
@@ -18,10 +18,10 @@ class FileButton extends React.Component { | |||
reader.onload = function() { | |||
if (file.type.startsWith("image/")) { | |||
text = reader.result; | |||
this_ptr.props.updateData("", getTime(), text); | |||
this_ptr.props.updateData(this_ptr.props.id + 1, "", text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Такс, а этот this_ptr
я пропустил. Так делать неправильно, ведь, в js есть методы для проброса контекста bind
, apply
, call
и еще есть arrow functions
, где контекст не меняется вовсе. Это надо исправить
} | ||
|
||
cleanValue() { | ||
this.refs.textMessageForm.value = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тоже что-то странное. Данными полей надо оперировать через state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Приходи сегодня на защиту, на месте будем разбираться
|
||
var files = event.target.files; | ||
|
||
for (var i = 0; i < files.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Использовать перечисляющий метод forEach(val, ind) => {...}
|
||
for (var i = 0; i < files.length; i++) { | ||
// eslint-disable-next-line no-loop-func | ||
(function(file) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вынести в нормальную функцию и избавиться от IIFE
} | ||
|
||
updateDataMessageForm(text) { | ||
this.setState({ text: text }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ text }
5 |
Переделал проект на React. Осталась только проблема с overflow-y, то есть у MessageList не совсем корректно CSS работает. Буду рад, если подскажешь как исправить)