mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 11:21:41 +03:00
handleIsValid removal, Form validity check for tags and title length
This commit is contained in:
parent
f6b490ecf1
commit
a1e0223b20
@ -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