mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 21:01:31 +03:00
handleIsValid removal, Form validity check for tags and title length
This commit is contained in:
parent
09c0b2531a
commit
f88b3bd50f
@ -12,7 +12,6 @@ import globalStyles from '../../../../globalStyles';
|
||||
const TagInput = ({
|
||||
value,
|
||||
onChange,
|
||||
handleIsValid,
|
||||
componentID,
|
||||
handleTagChanged,
|
||||
intl,
|
||||
@ -57,14 +56,11 @@ const TagInput = ({
|
||||
|
||||
handleTagChanged([...cats]);
|
||||
}
|
||||
|
||||
if (handleIsValid) {
|
||||
handleIsValid(componentID, !!(_text && _text.length));
|
||||
}
|
||||
};
|
||||
const _handleOnBlur = () => {
|
||||
let cats = [];
|
||||
if (onChange) {
|
||||
let cats = text.trim().split(' ');
|
||||
cats = text.trim().split(' ');
|
||||
if (handleTagChanged && cats.length > 0) {
|
||||
cats.length > 10
|
||||
? (setWarning(intl.formatMessage({ id: 'editor.limited_tags' })), setHeight(60))
|
||||
@ -87,10 +83,6 @@ const TagInput = ({
|
||||
}
|
||||
onChange(text);
|
||||
}
|
||||
|
||||
if (handleIsValid) {
|
||||
handleIsValid(componentID, !!(text && text.length));
|
||||
}
|
||||
};
|
||||
return (
|
||||
<View style={[globalStyles.containerHorizontal16, { height: Math.max(35, height) }]}>
|
||||
|
@ -131,8 +131,10 @@ class EditorScreen extends Component {
|
||||
} else {
|
||||
isFormValid =
|
||||
get(fields, 'title', '') &&
|
||||
get(fields, 'title', '').length < 255 &&
|
||||
(get(fields, 'body', '') || (bodyText && bodyText > 0)) &&
|
||||
get(fields, 'tags', null);
|
||||
get(fields, 'tags', null) &&
|
||||
get(fields, 'tags', null).length < 10;
|
||||
}
|
||||
|
||||
this.setState({ isFormValid });
|
||||
|
Loading…
Reference in New Issue
Block a user