@expensify/react-native-live-markdown 0.1.185 → 0.1.186

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.
@@ -107,26 +107,31 @@ RootShadowNode::Unshared MarkdownCommitHook::shadowTreeWillCommit(
107
107
  rootNode = rootNode->cloneTree(
108
108
  nodes.textInput->getFamily(),
109
109
  [this, &stateData, &textInputState, &nodes](ShadowNode const &node) {
110
- auto newStateData =
111
- std::make_shared<AndroidTextInputState>(stateData);
112
- // force measurement of a map buffer
113
- newStateData->cachedAttributedStringId = 0;
114
-
115
- // setting -1 as the event counter makes sure that the update will be ignored by the java
116
- // part of the code, which is what we want as we don't change the attributed string here
117
- if (previousEventCount_.contains(nodes.textInput->getTag()) &&
110
+ std::shared_ptr<ShadowNode> newNode = nullptr;
111
+
112
+ if (stateData.cachedAttributedStringId != 0) {
113
+ auto newStateData =
114
+ std::make_shared<AndroidTextInputState>(stateData);
115
+
116
+ // force measurement of a map buffer
117
+ newStateData->cachedAttributedStringId = 0;
118
+
119
+ // setting -1 as the event counter makes sure that the update will be ignored by the java
120
+ // part of the code, which is what we want as we don't change the attributed string here
121
+ if (previousEventCount_.contains(nodes.textInput->getTag()) &&
118
122
  previousEventCount_[nodes.textInput->getTag()] == stateData.mostRecentEventCount) {
119
123
  newStateData->mostRecentEventCount = -1;
120
- } else {
124
+ } else {
121
125
  previousEventCount_[nodes.textInput->getTag()] = stateData.mostRecentEventCount;
122
- }
126
+ }
127
+
128
+ auto newState = std::make_shared<const ConcreteState<AndroidTextInputState>>(
129
+ newStateData, textInputState);
123
130
 
124
- // clone the text input with the new state
125
- auto newNode = node.clone({
126
- .state =
127
- std::make_shared<const ConcreteState<AndroidTextInputState>>(
128
- newStateData, textInputState),
129
- });
131
+ newNode = node.clone({ .state = newState });
132
+ } else {
133
+ newNode = node.clone({});
134
+ }
130
135
 
131
136
  const auto currentDecoratorProps =
132
137
  nodes.decorator->getProps()->rawProps["markdownStyle"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expensify/react-native-live-markdown",
3
- "version": "0.1.185",
3
+ "version": "0.1.186",
4
4
  "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",