react-native-windows 0.0.0-canary.431 → 0.0.0-canary.435

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.
@@ -58,4 +58,9 @@
58
58
  <FmtDir>$([MSBuild]::NormalizeDirectory($(FmtDir)))</FmtDir>
59
59
  </PropertyGroup>
60
60
 
61
- </Project>
61
+ <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
62
+ <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
63
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
64
+ </PropertyGroup>
65
+
66
+ </Project>
@@ -4,4 +4,9 @@
4
4
  <!-- This import will noop when customer code is built. This import is here to help building the bits in the react-native-windows repository. -->
5
5
  <Import Condition="Exists($([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../')))" Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
6
6
 
7
- </Project>
7
+ <!--Allow implicitly restoring PackageReference dependencies in C++ projects using the Visual Studio IDE.-->
8
+ <Target Name="BeforeResolveReferences" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(MSBuildProjectExtension)' == '.vcxproj'">
9
+ <MSBuild Projects="$(MSBuildProjectFile)" Targets="Restore" />
10
+ </Target>
11
+
12
+ </Project>
@@ -44,7 +44,7 @@ AnimationDriver::~AnimationDriver() {
44
44
  void AnimationDriver::StartAnimation() {
45
45
  const auto [animation, scopedBatch] = MakeAnimation(m_config);
46
46
  if (auto const animatedValue = GetAnimatedValue()) {
47
- animatedValue->PropertySet().StartAnimation(ValueAnimatedNode::s_offsetName, animation);
47
+ animatedValue->PropertySet().StartAnimation(ValueAnimatedNode::s_valueName, animation);
48
48
  animatedValue->AddActiveAnimation(m_id);
49
49
  }
50
50
  scopedBatch.End();
@@ -58,7 +58,6 @@ void AnimationDriver::StartAnimation() {
58
58
  if (auto manager = weakManager.lock()) {
59
59
  if (auto const animatedValue = manager->GetValueAnimatedNode(tag)) {
60
60
  animatedValue->RemoveActiveAnimation(id);
61
- animatedValue->FlattenOffset();
62
61
  }
63
62
  manager->RemoveActiveAnimation(id);
64
63
  }
@@ -70,7 +69,7 @@ void AnimationDriver::StartAnimation() {
70
69
 
71
70
  void AnimationDriver::StopAnimation(bool ignoreCompletedHandlers) {
72
71
  if (const auto animatedValue = GetAnimatedValue()) {
73
- animatedValue->PropertySet().StopAnimation(ValueAnimatedNode::s_offsetName);
72
+ animatedValue->PropertySet().StopAnimation(ValueAnimatedNode::s_valueName);
74
73
  if (!ignoreCompletedHandlers) {
75
74
  animatedValue->RemoveActiveAnimation(m_id);
76
75
 
@@ -37,11 +37,11 @@ std::tuple<comp::CompositionAnimation, comp::CompositionScopedBatch> CalculatedA
37
37
  std::chrono::milliseconds duration(static_cast<int>(keyFrames.size() / 60.0f * 1000.0f));
38
38
  animation.Duration(duration);
39
39
  auto normalizedProgress = 0.0f;
40
- // We are animating the values offset property which should start at 0.
41
- animation.InsertKeyFrame(normalizedProgress, 0.0f, easingFunction);
40
+ auto fromValue = static_cast<float>(GetAnimatedValue()->RawValue());
41
+ animation.InsertKeyFrame(normalizedProgress, fromValue, easingFunction);
42
42
  for (const auto keyFrame : keyFrames) {
43
43
  normalizedProgress = std::min(normalizedProgress + 1.0f / keyFrames.size(), 1.0f);
44
- animation.InsertKeyFrame(normalizedProgress, keyFrame - static_cast<float>(m_startValue), easingFunction);
44
+ animation.InsertKeyFrame(normalizedProgress, keyFrame, easingFunction);
45
45
  }
46
46
 
47
47
  if (m_iterations == -1) {
@@ -11,7 +11,7 @@ DivisionAnimatedNode::DivisionAnimatedNode(
11
11
  int64_t tag,
12
12
  const folly::dynamic &config,
13
13
  const std::shared_ptr<NativeAnimatedNodeManager> &manager)
14
- : ValueAnimatedNode(tag, config, manager) {
14
+ : ValueAnimatedNode(tag, manager) {
15
15
  for (const auto &inputNode : config.find(s_inputName).dereference().second) {
16
16
  if (m_firstInput == s_firstInputUnset) {
17
17
  m_firstInput = static_cast<int64_t>(inputNode.asDouble());
@@ -30,7 +30,7 @@ DivisionAnimatedNode::DivisionAnimatedNode(
30
30
  for (const auto tag : nodes) {
31
31
  const auto identifier = L"n" + std::to_wstring(tag);
32
32
  anim.SetReferenceParameter(identifier, manager->GetValueAnimatedNode(tag)->PropertySet());
33
- expr = expr + L" / (" + identifier + L"." + s_valueName + L" " + identifier + L"." + s_offsetName + L")";
33
+ expr = expr + L" / (" + identifier + L"." + s_valueName + L" + " + identifier + L"." + s_offsetName + L")";
34
34
  }
35
35
  return expr;
36
36
  }());
@@ -40,7 +40,7 @@ std::tuple<comp::CompositionAnimation, comp::CompositionScopedBatch> FrameAnimat
40
40
  auto fromValue = GetAnimatedValue()->RawValue();
41
41
  for (auto frame : m_frames) {
42
42
  normalizedProgress = std::min(normalizedProgress += step, 1.0f);
43
- animation.InsertKeyFrame(normalizedProgress, static_cast<float>(frame * (m_toValue - fromValue)));
43
+ animation.InsertKeyFrame(normalizedProgress, static_cast<float>(fromValue + frame * (m_toValue - fromValue)));
44
44
  }
45
45
 
46
46
  if (m_iterations == -1) {
@@ -23,13 +23,6 @@ xaml::XamlRoot TryGetXamlRoot(const XamlView &view) {
23
23
  return root;
24
24
  }
25
25
 
26
- comp::Compositor GetCompositor(const XamlView &view) {
27
- if (auto window = xaml::Window::Current()) {
28
- return window.Compositor();
29
- }
30
- return GetCompositor();
31
- }
32
-
33
26
  thread_local comp::Compositor tlsCompositor{nullptr};
34
27
 
35
28
  void SetCompositor(const comp::Compositor &compositor) {
@@ -41,9 +34,9 @@ void SetCompositor(const comp::Compositor &compositor) {
41
34
  }
42
35
  }
43
36
 
44
- comp::Compositor GetCompositor() {
45
- if (!IsXamlIsland()) {
46
- return xaml::Window::Current().Compositor();
37
+ comp::Compositor GetCompositor(const XamlView &view) {
38
+ if (auto window = xaml::Window::Current()) {
39
+ return window.Compositor();
47
40
  }
48
41
  #ifndef USE_WINUI3
49
42
  assert(tlsCompositor != nullptr);
@@ -42,8 +42,7 @@ inline winrt::IPropertyValue GetTagAsPropertyValue(XamlView view) {
42
42
  }
43
43
 
44
44
  xaml::XamlRoot TryGetXamlRoot(const XamlView &view);
45
- comp::Compositor GetCompositor(const XamlView &view);
45
+ comp::Compositor GetCompositor(const XamlView &view = nullptr);
46
46
  void SetCompositor(const comp::Compositor &compositor);
47
- comp::Compositor GetCompositor();
48
47
 
49
48
  } // namespace Microsoft::ReactNative
@@ -37,5 +37,11 @@
37
37
  <HermesNoDLLCopy Condition="'$(UseHermes)' != 'true'">true</HermesNoDLLCopy>
38
38
  </PropertyGroup>
39
39
 
40
+ <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
41
+ <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
42
+ <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
43
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
44
+ </PropertyGroup>
45
+
40
46
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Generated\PackageVersion.g.props" />
41
47
  </Project>
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <!--
2
+ <!--
3
3
  Copyright (c) Microsoft Corporation.
4
4
  Licensed under the MIT License.
5
5
 
@@ -8,9 +8,15 @@
8
8
  Microsoft.ReactNative.
9
9
  -->
10
10
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="ReactNativeWindowsValidateProps">
11
-
11
+
12
12
  <Target Name="ReactNativeWindowsValidateProps">
13
13
  <Error Condition="'$(ReactNativeWindowsDirNotSet)' == 'true'" Text="'ReactNativeWindowsDir' should be set to the resolved location of the `react-native-windows` package. See https://aka.ms/ReactNativeWindowsDir." />
14
14
  </Target>
15
15
 
16
+ <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.targets -->
17
+ <!--Allow implicitly restoring PackageReference dependencies in C++ projects using the Visual Studio IDE.-->
18
+ <Target Name="BeforeResolveReferences" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(MSBuildProjectExtension)' == '.vcxproj'">
19
+ <MSBuild Projects="$(MSBuildProjectFile)" Targets="Restore" />
20
+ </Target>
21
+
16
22
  </Project>
@@ -10,7 +10,7 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.0.0-canary.431</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.0.0-canary.435</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
package/README.md CHANGED
@@ -54,7 +54,7 @@ Search the [existing issues](https://github.com/microsoft/react-native-windows/i
54
54
  - Ensure the [appropriate template](https://github.com/microsoft/react-native-windows/issues/new/choose) is used when filing your issue(s).
55
55
 
56
56
  ## Contributing
57
- See [Contributing guidelines](https://github.com/microsoft/react-native-windows/blob/main/docs/contributing.md) for how to setup your fork of the repo and start a PR to contribute to React Native for Windows.
57
+ See [Contributing guidelines](https://github.com/microsoft/react-native-windows/blob/main/CONTRIBUTING.md) for how to setup your fork of the repo and start a PR to contribute to React Native for Windows.
58
58
 
59
59
  [good first issue](https://github.com/microsoft/react-native-windows/labels/good%20first%20issue) and [help wanted](https://github.com/microsoft/react-native-windows/labels/help%20wanted) are great starting points for PRs.
60
60
 
@@ -98,8 +98,6 @@ WinRTWebSocketResource::WinRTWebSocketResource(
98
98
  IDataWriter &&writer,
99
99
  vector<ChainValidationResult> &&certExceptions)
100
100
  : m_socket{std::move(socket)}, m_writer{std::move(writer)} {
101
- m_socket.MessageReceived({this, &WinRTWebSocketResource::OnMessageReceived});
102
-
103
101
  for (const auto &certException : certExceptions) {
104
102
  m_socket.Control().IgnorableServerCertificateErrors().Append(certException);
105
103
  }
@@ -288,36 +286,6 @@ fire_and_forget WinRTWebSocketResource::PerformClose() noexcept {
288
286
  m_closePerformed.Set();
289
287
  }
290
288
 
291
- void WinRTWebSocketResource::OnMessageReceived(
292
- IWebSocket const &sender,
293
- IMessageWebSocketMessageReceivedEventArgs const &args) {
294
- try {
295
- string response;
296
- IDataReader reader = args.GetDataReader();
297
- auto len = reader.UnconsumedBufferLength();
298
- if (args.MessageType() == SocketMessageType::Utf8) {
299
- reader.UnicodeEncoding(UnicodeEncoding::Utf8);
300
- vector<uint8_t> data(len);
301
- reader.ReadBytes(data);
302
-
303
- response = string(CheckedReinterpretCast<char *>(data.data()), data.size());
304
- } else {
305
- auto buffer = reader.ReadBuffer(len);
306
- winrt::hstring data = CryptographicBuffer::EncodeToBase64String(buffer);
307
-
308
- response = winrt::to_string(std::wstring_view(data));
309
- }
310
-
311
- if (m_readHandler) {
312
- m_readHandler(response.length(), response, args.MessageType() == SocketMessageType::Binary);
313
- }
314
- } catch (hresult_error const &e) {
315
- if (m_errorHandler) {
316
- m_errorHandler({HResultToString(e), ErrorType::Receive});
317
- }
318
- }
319
- }
320
-
321
289
  void WinRTWebSocketResource::Synchronize() noexcept {
322
290
  // Ensure sequence of other operations
323
291
  if (m_connectRequested) {
@@ -330,6 +298,35 @@ void WinRTWebSocketResource::Synchronize() noexcept {
330
298
  #pragma region IWebSocketResource
331
299
 
332
300
  void WinRTWebSocketResource::Connect(string &&url, const Protocols &protocols, const Options &options) noexcept {
301
+ m_socket.MessageReceived(
302
+ [self = shared_from_this()](IWebSocket const &sender, IMessageWebSocketMessageReceivedEventArgs const &args) {
303
+ try {
304
+ string response;
305
+ IDataReader reader = args.GetDataReader();
306
+ auto len = reader.UnconsumedBufferLength();
307
+ if (args.MessageType() == SocketMessageType::Utf8) {
308
+ reader.UnicodeEncoding(UnicodeEncoding::Utf8);
309
+ vector<uint8_t> data(len);
310
+ reader.ReadBytes(data);
311
+
312
+ response = string(CheckedReinterpretCast<char *>(data.data()), data.size());
313
+ } else {
314
+ auto buffer = reader.ReadBuffer(len);
315
+ winrt::hstring data = CryptographicBuffer::EncodeToBase64String(buffer);
316
+
317
+ response = winrt::to_string(std::wstring_view(data));
318
+ }
319
+
320
+ if (self->m_readHandler) {
321
+ self->m_readHandler(response.length(), response, args.MessageType() == SocketMessageType::Binary);
322
+ }
323
+ } catch (hresult_error const &e) {
324
+ if (self->m_errorHandler) {
325
+ self->m_errorHandler({HResultToString(e), ErrorType::Receive});
326
+ }
327
+ }
328
+ });
329
+
333
330
  m_readyState = ReadyState::Connecting;
334
331
 
335
332
  for (const auto &header : options) {
@@ -51,9 +51,6 @@ class WinRTWebSocketResource : public IWebSocketResource, public std::enable_sha
51
51
  winrt::fire_and_forget PerformWrite(std::string &&message, bool isBinary) noexcept;
52
52
  winrt::fire_and_forget PerformClose() noexcept;
53
53
 
54
- void OnMessageReceived(
55
- winrt::Windows::Networking::Sockets::IWebSocket const &sender,
56
- winrt::Windows::Networking::Sockets::IMessageWebSocketMessageReceivedEventArgs const &args);
57
54
  void Synchronize() noexcept;
58
55
 
59
56
  public:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.0.0-canary.431",
3
+ "version": "0.0.0-canary.435",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "@react-native-community/cli": "^6.0.0",
27
27
  "@react-native-community/cli-platform-android": "^6.0.0",
28
28
  "@react-native-community/cli-platform-ios": "^6.0.0",
29
- "@react-native-windows/cli": "0.0.0-canary.107",
29
+ "@react-native-windows/cli": "0.0.0-canary.108",
30
30
  "@react-native-windows/virtualized-list": "0.0.0-canary.22",
31
31
  "@react-native/assets": "1.0.0",
32
32
  "@react-native/normalize-color": "2.0.0",
@@ -31,7 +31,6 @@
31
31
  // Abe Dolinger <https://github.com/256hz>
32
32
  // Dominique Richard <https://github.com/doumart>
33
33
  // Mohamed Shaban <https://github.com/drmas>
34
- // André Krüger <https://github.com/akrger>
35
34
  // Jérémy Barbet <https://github.com/jeremybarbet>
36
35
  // Christian Ost <https://github.com/ca057>
37
36
  // David Sheldrick <https://github.com/ds300>
@@ -4150,7 +4149,7 @@ export class FlatList<ItemT = any> extends React.Component<FlatListProps<ItemT>>
4150
4149
  /**
4151
4150
  * Provides a reference to the underlying host component
4152
4151
  */
4153
- getNativeScrollRef: () => React.RefObject<View> | React.RefObject<ScrollViewComponent> | null | undefined;
4152
+ getNativeScrollRef: () => React.ElementRef<typeof View> | React.ElementRef<typeof ScrollViewComponent> | null | undefined;
4154
4153
 
4155
4154
  getScrollableNode: () => any;
4156
4155