@expensify/react-native-live-markdown 0.1.53 → 0.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ export default class InputHistory {
16
16
 
17
17
  debounceTime: number;
18
18
 
19
- constructor(depth: number, debounceTime = 200) {
19
+ constructor(depth: number, debounceTime = 150) {
20
20
  this.depth = depth;
21
21
  this.history = [];
22
22
  this.historyIndex = 0;
@@ -61,6 +61,7 @@ export default class InputHistory {
61
61
  if (this.history.length > 0) {
62
62
  const lastItem = this.history[this.history.length - 1];
63
63
  if (lastItem && text === lastItem.text) {
64
+ this.historyIndex = this.history.length - 1;
64
65
  return;
65
66
  }
66
67
  }
@@ -80,7 +81,8 @@ export default class InputHistory {
80
81
  undo(): HistoryItem | null {
81
82
  if (this.currentText !== null && this.timeout) {
82
83
  clearTimeout(this.timeout);
83
- return this.history[this.history.length - 1] || null;
84
+ this.timeout = null;
85
+ return this.history[this.historyIndex] || null;
84
86
  }
85
87
 
86
88
  if (this.history.length === 0 || this.historyIndex - 1 < 0) {