mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-13 09:34:20 +03:00
commit
537cc5e877
@ -26,7 +26,7 @@ export default ({ getState, item, setState }) => {
|
||||
|
||||
setState({ text: newText }, () => {
|
||||
setTimeout(() => {
|
||||
setState({ selection: newSelection });
|
||||
setState({ newSelection });
|
||||
}, 300);
|
||||
});
|
||||
};
|
||||
|
@ -36,6 +36,6 @@ export default ({
|
||||
};
|
||||
}
|
||||
setState({ text: newText }, () => {
|
||||
setState({ selection: newSelection });
|
||||
setState({ newSelection });
|
||||
});
|
||||
};
|
||||
|
@ -13,15 +13,14 @@ export default ({ getState, item, setState }) => {
|
||||
} else {
|
||||
newPosition = selection.end + item.wrapper.length * 2;
|
||||
}
|
||||
|
||||
const extra = {
|
||||
selection: {
|
||||
newSelection: {
|
||||
start: newPosition,
|
||||
end: newPosition,
|
||||
},
|
||||
};
|
||||
setState({ text: newText }, () => {
|
||||
setTimeout(() => {
|
||||
setState({ ...extra });
|
||||
}, 25);
|
||||
setState({ ...extra });
|
||||
});
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ export default ({ getState, item, setState }) => {
|
||||
);
|
||||
}
|
||||
const extra = {
|
||||
selection: {
|
||||
newSelection: {
|
||||
start: newPosition,
|
||||
end: newPosition,
|
||||
},
|
||||
|
@ -24,6 +24,7 @@ export default class MarkdownEditorView extends Component {
|
||||
this.state = {
|
||||
text: props.draftBody || '',
|
||||
selection: { start: 0, end: 0 },
|
||||
newSelection: null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -79,21 +80,25 @@ export default class MarkdownEditorView extends Component {
|
||||
};
|
||||
|
||||
_handleOnSelectionChange = (event) => {
|
||||
this.setState({
|
||||
selection: event.nativeEvent.selection,
|
||||
});
|
||||
const { newSelection } = this.state;
|
||||
|
||||
if (newSelection) {
|
||||
this.setState({
|
||||
selection: newSelection,
|
||||
newSelection: null,
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
selection: event.nativeEvent.selection,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_getState = () => {
|
||||
this.setState({
|
||||
selection: {
|
||||
start: 1,
|
||||
end: 1,
|
||||
},
|
||||
});
|
||||
return this.state;
|
||||
};
|
||||
|
||||
|
||||
_renderPreview = () => {
|
||||
const { text } = this.state;
|
||||
|
||||
@ -180,7 +185,7 @@ export default class MarkdownEditorView extends Component {
|
||||
id: isReply ? 'editor.reply_placeholder' : 'editor.default_placeholder',
|
||||
})}
|
||||
placeholderTextColor="#c1c5c7"
|
||||
selection={Platform.OS === 'ios' ? selection : undefined}
|
||||
selection={selection}
|
||||
selectionColor="#357ce6"
|
||||
style={styles.textWrapper}
|
||||
underlineColorAndroid="transparent"
|
||||
|
Loading…
Reference in New Issue
Block a user