react-native-windows 0.74.38 → 0.74.39

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.
@@ -152,6 +152,7 @@ type ButtonProps = $ReadOnly<{|
152
152
  accessible?: ?boolean,
153
153
  accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
154
154
  onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
155
+ onAccessibilityTap?: ?() => void, // Windows
155
156
  accessibilityState?: ?AccessibilityState,
156
157
 
157
158
  /**
@@ -331,6 +332,7 @@ const Button: React.AbstractComponent<
331
332
  accessibilityHint,
332
333
  accessibilityLanguage,
333
334
  onAccessibilityAction,
335
+ onAccessibilityTap, // Windows
334
336
  tabIndex,
335
337
  } = props;
336
338
  const buttonStyles: Array<ViewStyleProp> = [styles.button];
@@ -389,6 +391,7 @@ const Button: React.AbstractComponent<
389
391
  accessibilityLanguage={accessibilityLanguage}
390
392
  accessibilityRole="button"
391
393
  accessibilityState={_accessibilityState}
394
+ onAccessibilityTap={onAccessibilityTap} // Windows
392
395
  importantForAccessibility={_importantForAccessibility}
393
396
  hasTVPreferredFocus={hasTVPreferredFocus}
394
397
  nextFocusDown={nextFocusDown}
@@ -116,25 +116,25 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
116
116
 
117
117
  //@cmember Show the scroll bar
118
118
  BOOL TxShowScrollBar(INT fnBar, BOOL fShow) override {
119
- assert(false);
119
+ // assert(false);
120
120
  return {};
121
121
  }
122
122
 
123
123
  //@cmember Enable the scroll bar
124
124
  BOOL TxEnableScrollBar(INT fuSBFlags, INT fuArrowflags) override {
125
- assert(false);
125
+ // assert(false);
126
126
  return {};
127
127
  }
128
128
 
129
129
  //@cmember Set the scroll range
130
130
  BOOL TxSetScrollRange(INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw) override {
131
- assert(false);
131
+ // assert(false);
132
132
  return {};
133
133
  }
134
134
 
135
135
  //@cmember Set the scroll position
136
136
  BOOL TxSetScrollPos(INT fnBar, INT nPos, BOOL fRedraw) override {
137
- assert(false);
137
+ // assert(false);
138
138
  return {};
139
139
  }
140
140
 
@@ -377,8 +377,11 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
377
377
 
378
378
  //@cmember Get the bits representing requested scroll bars for the window
379
379
  HRESULT TxGetScrollBars(DWORD *pdwScrollBar) override {
380
- // TODO support scrolling
381
- *pdwScrollBar = 0;
380
+ if (m_outer->m_multiline) {
381
+ *pdwScrollBar = WS_VSCROLL | WS_HSCROLL | ES_AUTOVSCROLL | ES_AUTOHSCROLL;
382
+ } else {
383
+ *pdwScrollBar = WS_HSCROLL | ES_AUTOHSCROLL;
384
+ }
382
385
  return S_OK;
383
386
  }
384
387
 
@@ -1042,6 +1045,12 @@ void WindowsTextInputComponentView::updateProps(
1042
1045
  autoCapitalizeOnUpdateProps(oldTextInputProps.autoCapitalize, newTextInputProps.autoCapitalize);
1043
1046
  }
1044
1047
 
1048
+ if (oldTextInputProps.textAlign != newTextInputProps.textAlign) {
1049
+ // Let UpdateParaFormat() to refresh the text field with the new text alignment.
1050
+ m_propBitsMask |= TXTBIT_PARAFORMATCHANGE;
1051
+ m_propBits |= TXTBIT_PARAFORMATCHANGE;
1052
+ }
1053
+
1045
1054
  UpdatePropertyBits();
1046
1055
  }
1047
1056
 
@@ -1305,7 +1314,15 @@ void WindowsTextInputComponentView::UpdateParaFormat() noexcept {
1305
1314
  m_pf.cbSize = sizeof(PARAFORMAT2);
1306
1315
  m_pf.dwMask = PFM_ALL;
1307
1316
 
1308
- m_pf.wAlignment = PFA_LEFT;
1317
+ auto &textAlign = windowsTextInputProps().textAlign;
1318
+
1319
+ if (textAlign == facebook::react::TextAlignment::Center) {
1320
+ m_pf.wAlignment = PFA_CENTER;
1321
+ } else if (textAlign == facebook::react::TextAlignment::Right) {
1322
+ m_pf.wAlignment = PFA_RIGHT;
1323
+ } else {
1324
+ m_pf.wAlignment = PFA_LEFT;
1325
+ }
1309
1326
 
1310
1327
  m_pf.cTabCount = 1;
1311
1328
  m_pf.rgxTabs[0] = lDefaultTab;
@@ -1475,6 +1492,9 @@ WindowsTextInputComponentView::createVisual() noexcept {
1475
1492
  winrt::check_hresult(g_pfnCreateTextServices(nullptr, m_textHost.get(), spUnk.put()));
1476
1493
  spUnk.as(m_textServices);
1477
1494
 
1495
+ LRESULT res;
1496
+ winrt::check_hresult(m_textServices->TxSendMessage(EM_SETTEXTMODE, TM_PLAINTEXT, 0, &res));
1497
+
1478
1498
  m_caretVisual = m_compContext.CreateCaretVisual();
1479
1499
  visual.InsertAt(m_caretVisual.InnerVisual(), 0);
1480
1500
  m_caretVisual.IsVisible(false);
@@ -5,6 +5,8 @@
5
5
 
6
6
  #include "WindowsTextInputEventEmitter.h"
7
7
 
8
+ #include <react/renderer/core/graphicsConversions.h>
9
+
8
10
  namespace facebook::react {
9
11
 
10
12
  void WindowsTextInputEventEmitter::onChange(OnChange event) const {
@@ -46,4 +48,23 @@ void WindowsTextInputEventEmitter::onKeyPress(OnKeyPress event) const {
46
48
  });
47
49
  }
48
50
 
51
+ static jsi::Value textInputMetricsContentSizePayload(
52
+ jsi::Runtime &runtime,
53
+ const WindowsTextInputEventEmitter::OnContentSizeChange &event) {
54
+ auto payload = jsi::Object(runtime);
55
+ {
56
+ auto contentSize = jsi::Object(runtime);
57
+ contentSize.setProperty(runtime, "width", event.contentSize.width);
58
+ contentSize.setProperty(runtime, "height", event.contentSize.height);
59
+ payload.setProperty(runtime, "contentSize", contentSize);
60
+ }
61
+ return payload;
62
+ };
63
+
64
+ void WindowsTextInputEventEmitter::onContentSizeChange(OnContentSizeChange event) const {
65
+ dispatchEvent("textInputContentSizeChange", [event = std::move(event)](jsi::Runtime &runtime) {
66
+ return textInputMetricsContentSizePayload(runtime, event);
67
+ });
68
+ }
69
+
49
70
  } // namespace facebook::react
@@ -36,10 +36,16 @@ class WindowsTextInputEventEmitter : public ViewEventEmitter {
36
36
  std::string key;
37
37
  };
38
38
 
39
+ struct OnContentSizeChange {
40
+ int target;
41
+ facebook::react::Size contentSize;
42
+ };
43
+
39
44
  void onChange(OnChange value) const;
40
45
  void onSelectionChange(const OnSelectionChange &value) const;
41
46
  void onSubmitEditing(OnSubmitEditing value) const;
42
47
  void onKeyPress(OnKeyPress value) const;
48
+ void onContentSizeChange(OnContentSizeChange value) const;
43
49
  };
44
50
 
45
51
  } // namespace facebook::react
@@ -47,7 +47,10 @@ WindowsTextInputProps::WindowsTextInputProps(
47
47
  autoCapitalize(convertRawProp(context, rawProps, "autoCapitalize", sourceProps.autoCapitalize, {})),
48
48
  clearTextOnSubmit(convertRawProp(context, rawProps, "clearTextOnSubmit", sourceProps.clearTextOnSubmit, {false})),
49
49
  submitKeyEvents(convertRawProp(context, rawProps, "submitKeyEvents", sourceProps.submitKeyEvents, {})),
50
- autoFocus(convertRawProp(context, rawProps, "autoFocus", sourceProps.autoFocus, {false})) {}
50
+ autoFocus(convertRawProp(context, rawProps, "autoFocus", sourceProps.autoFocus, {false})),
51
+ textAlign(
52
+ convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, facebook::react::TextAlignment::Left)) {
53
+ }
51
54
 
52
55
  void WindowsTextInputProps::setProp(
53
56
  const PropsParserContext &context,
@@ -4,6 +4,7 @@
4
4
  #pragma once
5
5
 
6
6
  #include <react/components/rnwcore/Props.h>
7
+ #include <react/renderer/attributedstring/conversions.h>
7
8
  #include <react/renderer/components/text/BaseTextProps.h>
8
9
  #include <react/renderer/core/propsConversions.h>
9
10
 
@@ -118,6 +119,7 @@ class WindowsTextInputProps final : public ViewProps, public BaseTextProps {
118
119
  bool clearTextOnSubmit{false};
119
120
  std::vector<CompWindowsTextInputSubmitKeyEventsStruct> submitKeyEvents{};
120
121
  bool autoFocus{false};
122
+ facebook::react::TextAlignment textAlign{};
121
123
  };
122
124
 
123
125
  } // namespace facebook::react
@@ -158,11 +158,10 @@ Size WindowsTextInputShadowNode::measureContent(
158
158
  const LayoutContext &layoutContext,
159
159
  const LayoutConstraints &layoutConstraints) const {
160
160
  if (getStateData().cachedAttributedStringId != 0) {
161
+ facebook::react::ParagraphAttributes paragraphAttributes{};
162
+ paragraphAttributes.maximumNumberOfLines = getConcreteProps().multiline ? 0 : 1;
161
163
  return m_textLayoutManager
162
- ->measureCachedSpannableById(
163
- getStateData().cachedAttributedStringId,
164
- {}, // TODO getConcreteProps().paragraphAttributes
165
- layoutConstraints)
164
+ ->measureCachedSpannableById(getStateData().cachedAttributedStringId, paragraphAttributes, layoutConstraints)
166
165
  .size;
167
166
  }
168
167
 
@@ -183,13 +182,11 @@ Size WindowsTextInputShadowNode::measureContent(
183
182
 
184
183
  TextLayoutContext textLayoutContext;
185
184
  textLayoutContext.pointScaleFactor = layoutContext.pointScaleFactor;
185
+ facebook::react::ParagraphAttributes paragraphAttributes{};
186
+ paragraphAttributes.maximumNumberOfLines = getConcreteProps().multiline ? 0 : 1;
186
187
  return m_textLayoutManager
187
188
  ->measure(
188
- AttributedStringBox{attributedString},
189
- {}, // TODO getConcreteProps().paragraphAttributes,
190
- textLayoutContext,
191
- layoutConstraints,
192
- nullptr)
189
+ AttributedStringBox{attributedString}, paragraphAttributes, textLayoutContext, layoutConstraints, nullptr)
193
190
  .size;
194
191
  }
195
192
 
@@ -50,7 +50,6 @@ void AnimationDriver::StartAnimation() {
50
50
  animatedValue->PropertySet().StartAnimation(ValueAnimatedNode::s_valueName, animation);
51
51
  animatedValue->AddActiveAnimation(m_id);
52
52
  }
53
- scopedBatch.End();
54
53
 
55
54
  m_scopedBatchCompletedToken = scopedBatch.Completed(
56
55
  [weakSelf = weak_from_this(), weakManager = m_manager, id = m_id, tag = m_animatedValueTag](auto sender, auto) {
@@ -74,6 +73,8 @@ void AnimationDriver::StartAnimation() {
74
73
  }
75
74
  });
76
75
 
76
+ scopedBatch.End();
77
+
77
78
  m_animation = animation;
78
79
  m_scopedBatch = scopedBatch;
79
80
  }
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.74.38</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.74.39</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>74</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>38</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>39</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>0438560b807679d6b74c3410fe2b9502300256ba</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>238eab86141194a61a233a3fec3b4f22a7a3b0f9</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.74.38",
3
+ "version": "0.74.39",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",