react-native-windows 0.0.0-canary.440 → 0.0.0-canary.441

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.
Files changed (30) hide show
  1. package/Directory.Build.targets +3 -2
  2. package/Libraries/AppTheme/AppTheme.js +83 -47
  3. package/Libraries/AppTheme/AppThemeTypes.d.ts +47 -22
  4. package/Libraries/AppTheme/NativeAppTheme.js +32 -0
  5. package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -7
  6. package/Microsoft.ReactNative/Base/CoreNativeModules.h +0 -2
  7. package/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.cpp +3 -1
  8. package/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.h +1 -1
  9. package/Microsoft.ReactNative/Modules/Animated/DecayAnimationDriver.cpp +5 -6
  10. package/Microsoft.ReactNative/Modules/Animated/DecayAnimationDriver.h +1 -3
  11. package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +5 -1
  12. package/Microsoft.ReactNative/Modules/Animated/SpringAnimationDriver.cpp +4 -1
  13. package/Microsoft.ReactNative/Modules/Animated/SpringAnimationDriver.h +1 -1
  14. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +60 -45
  15. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +22 -23
  16. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +6 -7
  17. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +0 -2
  18. package/PropertySheets/External/Microsoft.ReactNative.Common.targets +3 -2
  19. package/PropertySheets/Generated/PackageVersion.g.props +1 -1
  20. package/codegen/NativeAppThemeSpec.g.h +57 -0
  21. package/index.windows.js +5 -2
  22. package/package.json +1 -1
  23. package/rntypes/index.d.ts +6 -1
  24. package/typings-index.d.ts +0 -1
  25. package/typings-index.js +0 -1
  26. package/typings-index.js.map +1 -1
  27. package/Libraries/AppTheme/AppTheme.d.ts +0 -13
  28. package/Libraries/AppTheme/AppTheme.js.map +0 -1
  29. package/Libraries/AppTheme/AppThemeTypes.js +0 -8
  30. package/Libraries/AppTheme/AppThemeTypes.js.map +0 -1
@@ -5,8 +5,9 @@
5
5
  <Import Condition="Exists($([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../')))" Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
6
6
 
7
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" />
8
+ <Target Name="BeforeResolveReferences" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
9
+ <MSBuild Projects="$(SolutionPath)" Targets="Restore" Properties="RestoreProjectStyle=PackageReference" />
10
+ <MSBuild Projects="$(SolutionPath)" Targets="Restore" Properties="RestoreProjectStyle=PackagesConfig;RestorePackagesConfig=true" />
10
11
  </Target>
11
12
 
12
13
  </Project>
@@ -1,47 +1,83 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- 'use strict';
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AppTheme = void 0;
9
- const react_native_1 = require("react-native");
10
- // We previously gracefully handled importing AppTheme in the Jest environment.
11
- // Mock the NM until we have a coherent story for exporting our own Jest mocks,
12
- // or remove this API.
13
- const NativeAppTheme = react_native_1.NativeModules.RTCAppTheme || {
14
- initialHighContrast: false,
15
- initialHighContrastColors: {
16
- ButtonFaceColor: '',
17
- ButtonTextColor: '',
18
- GrayTextColor: '',
19
- HighlightColor: '',
20
- HighlightTextColor: '',
21
- HotlightColor: '',
22
- WindowColor: '',
23
- WindowTextColor: '',
24
- },
25
- };
26
- class AppThemeModule extends react_native_1.NativeEventEmitter {
27
- constructor() {
28
- super();
29
- this._highContrastColors = NativeAppTheme.initialHighContrastColors;
30
- this._isHighContrast = NativeAppTheme.initialHighContrast;
31
- this.addListener('highContrastChanged', (nativeEvent) => {
32
- this._isHighContrast = nativeEvent.isHighContrast;
33
- this._highContrastColors = nativeEvent.highContrastColors;
34
- });
35
- }
36
- addListener(eventName, listener) {
37
- return super.addListener(eventName, listener);
38
- }
39
- get isHighContrast() {
40
- return this._isHighContrast;
41
- }
42
- get currentHighContrastColors() {
43
- return this._highContrastColors;
44
- }
45
- }
46
- exports.AppTheme = new AppThemeModule();
47
- //# sourceMappingURL=AppTheme.js.map
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ * @flow strict-local
7
+ */
8
+
9
+ import EventEmitter, {
10
+ type EventSubscription,
11
+ } from '../vendor/emitter/EventEmitter';
12
+ import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
13
+ import NativeAppTheme, {
14
+ type AppThemeData,
15
+ type HighContrastColors,
16
+ } from './NativeAppTheme';
17
+
18
+ // Default values here are used in jest environment, or when native module otherwise not availiable
19
+ let _isHighContrast = false;
20
+ let _highContrastColors = {
21
+ ButtonFaceColor: '',
22
+ ButtonTextColor: '',
23
+ GrayTextColor: '',
24
+ HighlightColor: '',
25
+ HighlightTextColor: '',
26
+ HotlightColor: '',
27
+ WindowColor: '',
28
+ WindowTextColor: '',
29
+ };
30
+
31
+ type AppThemeListener = (nativeEvent: AppThemeData) => void;
32
+ const eventEmitter = new EventEmitter<{
33
+ highContrastChanged: [AppThemeData],
34
+ }>();
35
+
36
+ type NativeAppThemeEventDefinitions = {
37
+ highContrastChanged: [AppThemeData],
38
+ };
39
+
40
+ if (NativeAppTheme) {
41
+ _isHighContrast = NativeAppTheme.getConstants().isHighContrast;
42
+ _highContrastColors = NativeAppTheme.getConstants().highContrastColors;
43
+
44
+ const nativeEventEmitter =
45
+ new NativeEventEmitter<NativeAppThemeEventDefinitions>(null);
46
+ nativeEventEmitter.addListener(
47
+ 'highContrastChanged',
48
+ (newAppTheme: AppThemeData) => {
49
+ _isHighContrast = newAppTheme.isHighContrast;
50
+ _highContrastColors = newAppTheme.highContrastColors;
51
+ eventEmitter.emit('highContrastChanged', newAppTheme);
52
+ },
53
+ );
54
+ }
55
+
56
+ module.exports = {
57
+ // $FlowFixMe[unsafe-getters-setters]
58
+ get isHighContrast(): boolean {
59
+ return _isHighContrast;
60
+ },
61
+
62
+ // $FlowFixMe[unsafe-getters-setters]
63
+ get currentHighContrastColors(): HighContrastColors {
64
+ return _highContrastColors;
65
+ },
66
+
67
+ /**
68
+ * Add an event handler that is fired when appearance preferences change.
69
+ */
70
+ addListener(
71
+ eventName: 'highContrastChanged',
72
+ listener: AppThemeListener,
73
+ ): EventSubscription {
74
+ return eventEmitter.addListener(eventName, listener);
75
+ },
76
+
77
+ removeListener(
78
+ eventName: 'highContrastChanged',
79
+ listener: AppThemeListener,
80
+ ): void {
81
+ eventEmitter.removeListener(eventName, listener);
82
+ },
83
+ };
@@ -1,22 +1,47 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- /**
7
- * Color information for high contrast
8
- */
9
- export interface IHighContrastColors {
10
- ButtonFaceColor: string;
11
- ButtonTextColor: string;
12
- GrayTextColor: string;
13
- HighlightColor: string;
14
- HighlightTextColor: string;
15
- HotlightColor: string;
16
- WindowColor: string;
17
- WindowTextColor: string;
18
- }
19
- export interface IHighContrastChangedEvent {
20
- isHighContrast: boolean;
21
- highContrastColors: IHighContrastColors;
22
- }
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ * @format
5
+ */
6
+
7
+ import {EmitterSubscription} from 'react-native';
8
+
9
+ /**
10
+ * Color information for high contrast
11
+ */
12
+ export interface IHighContrastColors {
13
+ ButtonFaceColor: string;
14
+ ButtonTextColor: string;
15
+ GrayTextColor: string;
16
+ HighlightColor: string;
17
+ HighlightTextColor: string;
18
+ HotlightColor: string;
19
+ WindowColor: string;
20
+ WindowTextColor: string;
21
+ }
22
+
23
+ export interface IHighContrastChangedEvent {
24
+ isHighContrast: boolean;
25
+ highContrastColors: IHighContrastColors;
26
+ }
27
+
28
+ export type AppTheme = {
29
+ addListener(
30
+ eventName: 'highContrastChanged',
31
+ listener: (nativeEvent: IHighContrastChangedEvent) => void,
32
+ ): EmitterSubscription;
33
+
34
+ /**
35
+ * @deprecated Use remove method on the EmitterSubscription returned from addListener
36
+ */
37
+ removeListener(
38
+ eventName: 'highContrastChanged',
39
+ listener: (nativeEvent: IHighContrastChangedEvent) => void,
40
+ ): void;
41
+
42
+ isHighContrast: boolean;
43
+
44
+ currentHighContrastColors: IHighContrastColors;
45
+ };
46
+
47
+ export const AppTheme: AppTheme;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @flow strict
6
+ * @format
7
+ */
8
+
9
+ import type {TurboModule} from '../TurboModule/RCTExport';
10
+ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
11
+
12
+ export type HighContrastColors = {|
13
+ ButtonFaceColor: string,
14
+ ButtonTextColor: string,
15
+ GrayTextColor: string,
16
+ HighlightColor: string,
17
+ HighlightTextColor: string,
18
+ HotlightColor: string,
19
+ WindowColor: string,
20
+ WindowTextColor: string,
21
+ |};
22
+
23
+ export type AppThemeData = {|
24
+ isHighContrast: boolean,
25
+ highContrastColors: HighContrastColors,
26
+ |};
27
+
28
+ export interface Spec extends TurboModule {
29
+ +getConstants: () => AppThemeData;
30
+ }
31
+
32
+ export default (TurboModuleRegistry.get<Spec>('AppTheme'): ?Spec);
@@ -7,7 +7,6 @@
7
7
  // Modules
8
8
  #include <AsyncStorageModule.h>
9
9
  #include <Modules/Animated/NativeAnimatedModule.h>
10
- #include <Modules/AppThemeModuleUwp.h>
11
10
  #include <Modules/AppearanceModule.h>
12
11
  #include <Modules/AsyncStorageModuleWin32.h>
13
12
  #include <Modules/ClipboardModule.h>
@@ -43,7 +42,6 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
43
42
  const std::shared_ptr<facebook::react::MessageQueueThread> &batchingUIMessageQueue,
44
43
  const std::shared_ptr<facebook::react::MessageQueueThread>
45
44
  &jsMessageQueue, // JS engine thread (what we use for external modules)
46
- std::shared_ptr<AppTheme> &&appTheme,
47
45
  Mso::CntPtr<AppearanceChangeListener> &&appearanceListener,
48
46
  Mso::CntPtr<Mso::React::IReactContext> &&context) noexcept {
49
47
  std::vector<facebook::react::NativeModuleDescription> modules;
@@ -58,11 +56,6 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
58
56
  [batchingUIMessageQueue]() { return facebook::react::CreateTimingModule(batchingUIMessageQueue); },
59
57
  batchingUIMessageQueue);
60
58
 
61
- modules.emplace_back(
62
- AppThemeModule::Name,
63
- [appTheme = std::move(appTheme)]() mutable { return std::make_unique<AppThemeModule>(std::move(appTheme)); },
64
- batchingUIMessageQueue);
65
-
66
59
  modules.emplace_back(
67
60
  NativeAnimatedModule::name,
68
61
  [context = std::move(context)]() mutable { return std::make_unique<NativeAnimatedModule>(std::move(context)); },
@@ -3,7 +3,6 @@
3
3
 
4
4
  #pragma once
5
5
 
6
- #include <Modules/AppThemeModuleUwp.h>
7
6
  #include <Modules/AppearanceModule.h>
8
7
  #include <React.h>
9
8
  #include <Shared/NativeModuleProvider.h>
@@ -27,7 +26,6 @@ struct ViewManagerProvider;
27
26
  std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
28
27
  const std::shared_ptr<facebook::react::MessageQueueThread> &batchingUIMessageQueue,
29
28
  const std::shared_ptr<facebook::react::MessageQueueThread> &jsMessageQueue,
30
- std::shared_ptr<AppTheme> &&appTheme,
31
29
  Mso::CntPtr<AppearanceChangeListener> &&appearanceListener,
32
30
  Mso::CntPtr<Mso::React::IReactContext> &&context) noexcept;
33
31
 
@@ -23,13 +23,15 @@ std::tuple<comp::CompositionAnimation, comp::CompositionScopedBatch> CalculatedA
23
23
  std::vector<float> keyFrames;
24
24
  bool done = false;
25
25
  double time = 0;
26
+ std::optional<double> previousValue = std::nullopt;
26
27
  while (!done) {
27
28
  time += 1.0f / 60.0f;
28
29
  auto [currentValue, currentVelocity] = GetValueAndVelocityForTime(time);
29
30
  keyFrames.push_back(currentValue);
30
- if (IsAnimationDone(currentValue, currentVelocity)) {
31
+ if (IsAnimationDone(currentValue, previousValue, currentVelocity)) {
31
32
  done = true;
32
33
  }
34
+ previousValue = currentValue;
33
35
  }
34
36
  return keyFrames;
35
37
  }();
@@ -18,7 +18,7 @@ class CalculatedAnimationDriver : public AnimationDriver {
18
18
  protected:
19
19
  virtual std::tuple<float, double> GetValueAndVelocityForTime(double time) = 0;
20
20
 
21
- virtual bool IsAnimationDone(double currentValue, double currentVelocity) = 0;
21
+ virtual bool IsAnimationDone(double currentValue, std::optional<double> previousValue, double currentVelocity) = 0;
22
22
  double m_startValue{0};
23
23
  };
24
24
  } // namespace Microsoft::ReactNative
@@ -26,12 +26,11 @@ std::tuple<float, double> DecayAnimationDriver::GetValueAndVelocityForTime(doubl
26
26
  42.0f); // we don't need the velocity, so set it to a dummy value
27
27
  }
28
28
 
29
- bool DecayAnimationDriver::IsAnimationDone(double currentValue, double /*currentVelocity*/) {
30
- return (std::abs(ToValue() - currentValue) < 0.1);
31
- }
32
-
33
- double DecayAnimationDriver::ToValue() {
34
- return m_startValue + m_velocity / (1 - m_deceleration);
29
+ bool DecayAnimationDriver::IsAnimationDone(
30
+ double currentValue,
31
+ std::optional<double> previousValue,
32
+ double /*currentVelocity*/) {
33
+ return previousValue.has_value() && std::abs(currentValue - previousValue.value()) < 0.1;
35
34
  }
36
35
 
37
36
  } // namespace Microsoft::ReactNative
@@ -16,11 +16,9 @@ class DecayAnimationDriver : public CalculatedAnimationDriver {
16
16
  const folly::dynamic &config,
17
17
  const std::shared_ptr<NativeAnimatedNodeManager> &manager);
18
18
 
19
- double ToValue() override;
20
-
21
19
  protected:
22
20
  std::tuple<float, double> GetValueAndVelocityForTime(double time) override;
23
- bool IsAnimationDone(double currentValue, double currentVelocity) override;
21
+ bool IsAnimationDone(double currentValue, std::optional<double> previousValue, double currentVelocity) override;
24
22
 
25
23
  private:
26
24
  double m_velocity{0};
@@ -134,7 +134,11 @@ void NativeAnimatedNodeManager::StopAnimation(int64_t animationId, bool isTracki
134
134
  const auto nodeTag = animation->AnimatedValueTag();
135
135
  if (nodeTag != -1) {
136
136
  const auto deferredAnimation = m_deferredAnimationForValues.find(nodeTag);
137
- if (deferredAnimation != m_deferredAnimationForValues.end() && deferredAnimation->second == animationId) {
137
+ if (deferredAnimation != m_deferredAnimationForValues.end()) {
138
+ // We can assume that the currently deferred animation is the one
139
+ // being stopped given the constraint that only one animation can
140
+ // be active for a given value node.
141
+ assert(deferredAnimation->second == animationId);
138
142
  // If the animation is deferred, just remove the deferred animation
139
143
  // entry as two animations cannot animate the same value concurrently.
140
144
  m_deferredAnimationForValues.erase(nodeTag);
@@ -29,7 +29,10 @@ SpringAnimationDriver::SpringAnimationDriver(
29
29
  m_iterations = static_cast<int>(config.find(s_iterationsParameterName).dereference().second.asDouble());
30
30
  }
31
31
 
32
- bool SpringAnimationDriver::IsAnimationDone(double currentValue, double currentVelocity) {
32
+ bool SpringAnimationDriver::IsAnimationDone(
33
+ double currentValue,
34
+ std::optional<double> /*previousValue*/,
35
+ double currentVelocity) {
33
36
  return (
34
37
  IsAtRest(currentVelocity, currentValue, m_endValue) ||
35
38
  (m_overshootClampingEnabled && IsOvershooting(currentValue)));
@@ -22,7 +22,7 @@ class SpringAnimationDriver : public CalculatedAnimationDriver {
22
22
 
23
23
  protected:
24
24
  std::tuple<float, double> GetValueAndVelocityForTime(double time) override;
25
- bool IsAnimationDone(double currentValue, double currentVelocity) override;
25
+ bool IsAnimationDone(double currentValue, std::optional<double> previousValue, double currentVelocity) override;
26
26
 
27
27
  private:
28
28
  bool IsAtRest(double currentVelocity, double currentPosition, double endValue);
@@ -29,17 +29,20 @@ using namespace winrt::Microsoft::ReactNative;
29
29
 
30
30
  namespace Microsoft::ReactNative {
31
31
 
32
+ static const React::ReactPropertyId<React::ReactNonAbiValue<std::shared_ptr<AppThemeHolder>>>
33
+ &AppThemeHolderPropertyId() noexcept {
34
+ static const React::ReactPropertyId<React::ReactNonAbiValue<std::shared_ptr<AppThemeHolder>>> prop{
35
+ L"ReactNative.AppTheme", L"AppThemeHolder"};
36
+ return prop;
37
+ }
38
+
32
39
  //
33
- // AppTheme
40
+ // AppThemeHolder
34
41
  //
35
42
 
36
- AppTheme::AppTheme(
37
- const Mso::React::IReactContext &context,
38
- const std::shared_ptr<facebook::react::MessageQueueThread> &defaultQueueThread)
39
- : m_context(&context), m_queueThread(defaultQueueThread) {
43
+ AppThemeHolder::AppThemeHolder(const Mso::React::IReactContext &context) : m_context(&context) {
40
44
  if (auto currentApp = xaml::TryGetCurrentApplication()) {
41
- m_isHighContrast = getIsHighContrast();
42
- m_highContrastColors = getHighContrastColors();
45
+ NotifyHighContrastChanged();
43
46
 
44
47
  if (IsWinUI3Island()) {
45
48
  m_wmSubscription = SubscribeToWindowMessage(
@@ -53,57 +56,69 @@ AppTheme::AppTheme(
53
56
  }
54
57
  }
55
58
 
56
- bool AppTheme::getIsHighContrast() const {
57
- return m_accessibilitySettings.HighContrast();
59
+ ReactNativeSpecs::AppThemeSpec_AppThemeData AppThemeHolder::GetConstants() noexcept {
60
+ return m_appThemeData;
58
61
  }
59
62
 
60
- // Returns the RBG values for the 8 relevant High Contrast elements.
61
- folly::dynamic AppTheme::getHighContrastColors() const {
62
- winrt::Windows::UI::Color ButtonFaceColor = m_uiSettings.UIElementColor(winrt::UIElementType::ButtonFace);
63
- winrt::Windows::UI::Color ButtonTextColor = m_uiSettings.UIElementColor(winrt::UIElementType::ButtonText);
64
- winrt::Windows::UI::Color GrayTextColor = m_uiSettings.UIElementColor(winrt::UIElementType::GrayText);
65
- winrt::Windows::UI::Color HighlightColor = m_uiSettings.UIElementColor(winrt::UIElementType::Highlight);
66
- winrt::Windows::UI::Color HighlightTextColor = m_uiSettings.UIElementColor(winrt::UIElementType::HighlightText);
67
- winrt::Windows::UI::Color HotlightColor = m_uiSettings.UIElementColor(winrt::UIElementType::Hotlight);
68
- winrt::Windows::UI::Color WindowColor = m_uiSettings.UIElementColor(winrt::UIElementType::Window);
69
- winrt::Windows::UI::Color WindowTextColor = m_uiSettings.UIElementColor(winrt::UIElementType::WindowText);
70
-
71
- folly::dynamic rbgValues = folly::dynamic::object("ButtonFaceColor", formatRGB(ButtonFaceColor))(
72
- "ButtonTextColor", formatRGB(ButtonTextColor))("GrayTextColor", formatRGB(GrayTextColor))(
73
- "HighlightColor", formatRGB(HighlightColor))("HighlightTextColor", formatRGB(HighlightTextColor))(
74
- "HotlightColor", formatRGB(HotlightColor))("WindowColor", formatRGB(WindowColor))(
75
- "WindowTextColor", formatRGB(WindowTextColor));
76
- return rbgValues;
63
+ /*static*/ void AppThemeHolder::InitAppThemeHolder(const Mso::React::IReactContext &context) noexcept {
64
+ auto appThemeHolder = std::make_shared<AppThemeHolder>(context);
65
+ winrt::Microsoft::ReactNative::ReactPropertyBag pb{context.Properties()};
66
+ pb.Set(AppThemeHolderPropertyId(), std::move(appThemeHolder));
77
67
  }
78
68
 
79
- /*static*/ std::string AppTheme::formatRGB(winrt::Windows::UI::Color ElementColor) {
80
- char colorChars[8];
81
- sprintf_s(colorChars, "#%02x%02x%02x", ElementColor.R, ElementColor.G, ElementColor.B);
82
- return colorChars;
83
- }
69
+ void AppThemeHolder::SetCallback(
70
+ const React::ReactPropertyBag &propertyBag,
71
+ Mso::Functor<void(React::JSValueObject &&)> &&callback) noexcept {
72
+ auto holder = propertyBag.Get(AppThemeHolderPropertyId());
84
73
 
85
- void AppTheme::fireEvent(std::string const &eventName, folly::dynamic &&eventData) const {
86
- m_context->CallJSFunction("RCTDeviceEventEmitter", "emit", folly::dynamic::array(eventName, std::move(eventData)));
74
+ (*holder)->m_notifyCallback = std::move(callback);
87
75
  }
88
76
 
89
- void AppTheme::NotifyHighContrastChanged() const {
90
- folly::dynamic eventData =
91
- folly::dynamic::object("highContrastColors", getHighContrastColors())("isHighContrast", getIsHighContrast());
92
- this->
77
+ void AppThemeHolder::NotifyHighContrastChanged() noexcept {
78
+ m_appThemeData.isHighContrast = m_accessibilitySettings.HighContrast();
79
+ m_appThemeData.highContrastColors.ButtonFaceColor =
80
+ FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::ButtonFace));
81
+ m_appThemeData.highContrastColors.ButtonTextColor =
82
+ FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::ButtonText));
83
+ m_appThemeData.highContrastColors.GrayTextColor =
84
+ FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::GrayText));
85
+ m_appThemeData.highContrastColors.HighlightColor =
86
+ FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::Highlight));
87
+ m_appThemeData.highContrastColors.HighlightTextColor =
88
+ FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::HighlightText));
89
+ m_appThemeData.highContrastColors.HotlightColor =
90
+ FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::Hotlight));
91
+ m_appThemeData.highContrastColors.WindowColor = FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::Window));
92
+ m_appThemeData.highContrastColors.WindowTextColor =
93
+ FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::WindowText));
94
+
95
+ if (m_notifyCallback) {
96
+ auto writer = MakeJSValueTreeWriter();
97
+ WriteValue(writer, m_appThemeData);
98
+ m_notifyCallback(TakeJSValue(writer).MoveObject());
99
+ }
100
+ }
93
101
 
94
- fireEvent("highContrastChanged", std::move(eventData));
102
+ /*static*/ std::string AppThemeHolder::FormatRGB(winrt::Windows::UI::Color ElementColor) {
103
+ char colorChars[8];
104
+ sprintf_s(colorChars, "#%02x%02x%02x", ElementColor.R, ElementColor.G, ElementColor.B);
105
+ return colorChars;
95
106
  }
96
107
 
97
- AppThemeModule::AppThemeModule(std::shared_ptr<AppTheme> &&appTheme) : m_appTheme(std::move(appTheme)) {}
108
+ void AppTheme::Initialize(React::ReactContext const &reactContext) noexcept {
109
+ m_context = reactContext;
98
110
 
99
- auto AppThemeModule::getConstants() -> std::map<std::string, folly::dynamic> {
100
- return {
101
- {"initialHighContrast", folly::dynamic{m_appTheme->getIsHighContrast()}},
102
- {"initialHighContrastColors", folly::dynamic{m_appTheme->getHighContrastColors()}}};
111
+ AppThemeHolder::SetCallback(
112
+ m_context.Properties(), [weakThis = weak_from_this()](React::JSValueObject &&appThemeInfo) {
113
+ if (auto strongThis = weakThis.lock()) {
114
+ strongThis->m_context.EmitJSEvent(L"RCTDeviceEventEmitter", L"highContrastChanged", appThemeInfo);
115
+ }
116
+ });
103
117
  }
104
118
 
105
- auto AppThemeModule::getMethods() -> std::vector<facebook::xplat::module::CxxModule::Method> {
106
- return {};
119
+ ReactNativeSpecs::AppThemeSpec_AppThemeData AppTheme::GetConstants() noexcept {
120
+ winrt::Microsoft::ReactNative::ReactPropertyBag pb{m_context.Properties()};
121
+ return (*pb.Get(AppThemeHolderPropertyId()))->GetConstants();
107
122
  }
108
123
 
109
124
  } // namespace Microsoft::ReactNative
@@ -9,48 +9,47 @@
9
9
  #include <cxxreact/MessageQueueThread.h>
10
10
  #include <winrt/Windows.UI.ViewManagement.h>
11
11
 
12
+ #include "../../codegen/NativeAppThemeSpec.g.h"
13
+ #include <NativeModules.h>
14
+
12
15
  namespace Microsoft::ReactNative {
13
16
 
14
- class AppTheme : public std::enable_shared_from_this<AppTheme> {
17
+ class AppThemeHolder {
15
18
  public:
16
- AppTheme(
17
- const Mso::React::IReactContext &reactContext,
18
- const std::shared_ptr<facebook::react::MessageQueueThread> &defaultQueueThread);
19
+ AppThemeHolder(const Mso::React::IReactContext &reactContext);
19
20
 
20
- bool getIsHighContrast() const;
21
- folly::dynamic getHighContrastColors() const;
21
+ static void InitAppThemeHolder(const Mso::React::IReactContext &context) noexcept;
22
+ ReactNativeSpecs::AppThemeSpec_AppThemeData GetConstants() noexcept;
23
+ static void SetCallback(
24
+ const React::ReactPropertyBag &propertyBag,
25
+ Mso::Functor<void(React::JSValueObject &&)> &&callback) noexcept;
22
26
 
23
27
  private:
24
28
  // High Contrast Color helper method
25
- static std::string formatRGB(winrt::Windows::UI::Color ElementColor);
26
- void NotifyHighContrastChanged() const;
27
- void fireEvent(std::string const &eventName, folly::dynamic &&eventData) const;
29
+ static std::string FormatRGB(winrt::Windows::UI::Color ElementColor);
30
+ void NotifyHighContrastChanged() noexcept;
28
31
 
29
32
  Mso::CntPtr<const Mso::React::IReactContext> m_context;
30
- std::shared_ptr<facebook::react::MessageQueueThread> m_queueThread;
31
- bool m_isHighContrast{false};
32
- folly::dynamic m_highContrastColors;
33
+ Mso::Functor<void(React::JSValueObject &&)> m_notifyCallback;
34
+ ReactNativeSpecs::AppThemeSpec_AppThemeData m_appThemeData;
33
35
  winrt::Windows::UI::ViewManagement::AccessibilitySettings m_accessibilitySettings{};
34
36
  winrt::Windows::UI::ViewManagement::AccessibilitySettings::HighContrastChanged_revoker m_highContrastChangedRevoker{};
35
37
  winrt::Windows::UI::ViewManagement::UISettings m_uiSettings{};
36
38
  winrt::Microsoft::ReactNative::ReactNotificationSubscription m_wmSubscription;
37
39
  };
38
40
 
39
- class AppThemeModule : public facebook::xplat::module::CxxModule {
40
- public:
41
- static constexpr const char *Name = "RTCAppTheme";
41
+ REACT_MODULE(AppTheme)
42
+ struct AppTheme : public std::enable_shared_from_this<AppTheme> {
43
+ using ModuleSpec = ReactNativeSpecs::AppThemeSpec;
42
44
 
43
- AppThemeModule(std::shared_ptr<AppTheme> &&appTheme);
45
+ REACT_GET_CONSTANTS(GetConstants)
46
+ ReactNativeSpecs::AppThemeSpec_AppThemeData GetConstants() noexcept;
44
47
 
45
- // CxxModule
46
- std::string getName() override {
47
- return Name;
48
- };
49
- auto getConstants() -> std::map<std::string, folly::dynamic> override;
50
- auto getMethods() -> std::vector<Method> override;
48
+ REACT_INIT(Initialize)
49
+ void Initialize(React::ReactContext const &reactContext) noexcept;
51
50
 
52
51
  private:
53
- std::shared_ptr<AppTheme> m_appTheme;
52
+ winrt::Microsoft::ReactNative::ReactContext m_context;
54
53
  };
55
54
 
56
55
  } // namespace Microsoft::ReactNative
@@ -41,6 +41,7 @@
41
41
  #include "Modules/AccessibilityInfoModule.h"
42
42
  #include "Modules/AlertModule.h"
43
43
  #include "Modules/AppStateModule.h"
44
+ #include "Modules/AppThemeModuleUwp.h"
44
45
  #include "Modules/ClipboardModule.h"
45
46
  #endif
46
47
  #include "Modules/DevSettingsModule.h"
@@ -285,6 +286,9 @@ void ReactInstanceWin::LoadModules(
285
286
  registerTurboModule(
286
287
  L"AppState", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::AppState>());
287
288
 
289
+ registerTurboModule(
290
+ L"AppTheme", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::AppTheme>());
291
+
288
292
  registerTurboModule(
289
293
  L"LogBox", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::LogBox>());
290
294
 
@@ -331,8 +335,7 @@ void ReactInstanceWin::Initialize() noexcept {
331
335
  // Objects that must be created on the UI thread
332
336
  if (auto strongThis = weakThis.GetStrongPtr()) {
333
337
  #ifndef CORE_ABI
334
- strongThis->m_appTheme = std::make_shared<Microsoft::ReactNative::AppTheme>(
335
- strongThis->GetReactContext(), strongThis->m_uiMessageThread.LoadWithLock());
338
+ Microsoft::ReactNative::AppThemeHolder::InitAppThemeHolder(strongThis->GetReactContext());
336
339
  Microsoft::ReactNative::I18nManager::InitI18nInfo(
337
340
  winrt::Microsoft::ReactNative::ReactPropertyBag(strongThis->Options().Properties));
338
341
  strongThis->m_appearanceListener = Mso::Make<Microsoft::ReactNative::AppearanceChangeListener>(
@@ -380,11 +383,7 @@ void ReactInstanceWin::Initialize() noexcept {
380
383
  // Acquire default modules and then populate with custom modules.
381
384
  // Note that some of these have custom thread affinity.
382
385
  std::vector<facebook::react::NativeModuleDescription> cxxModules = Microsoft::ReactNative::GetCoreModules(
383
- m_batchingUIThread,
384
- m_jsMessageThread.Load(),
385
- std::move(m_appTheme),
386
- std::move(m_appearanceListener),
387
- m_reactContext);
386
+ m_batchingUIThread, m_jsMessageThread.Load(), std::move(m_appearanceListener), m_reactContext);
388
387
  #endif
389
388
 
390
389
  auto nmp = std::make_shared<winrt::Microsoft::ReactNative::NativeModulesProvider>();
@@ -11,7 +11,6 @@
11
11
  #include "activeObject/activeObject.h"
12
12
 
13
13
  #ifndef CORE_ABI
14
- #include <Modules/AppThemeModuleUwp.h>
15
14
  #include <Modules/AppearanceModule.h>
16
15
  #include <Modules/I18nManagerModule.h>
17
16
  #include <Views/ExpressionAnimationStore.h>
@@ -178,7 +177,6 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
178
177
 
179
178
  std::shared_ptr<IRedBoxHandler> m_redboxHandler;
180
179
  #ifndef CORE_ABI
181
- std::shared_ptr<Microsoft::ReactNative::AppTheme> m_appTheme;
182
180
  Mso::CntPtr<Microsoft::ReactNative::AppearanceChangeListener> m_appearanceListener;
183
181
  #endif
184
182
  Mso::CntPtr<Mso::React::IDispatchQueue2> m_uiQueue;
@@ -15,8 +15,9 @@
15
15
 
16
16
  <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.targets -->
17
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" />
18
+ <Target Name="BeforeResolveReferences" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
19
+ <MSBuild Projects="$(SolutionPath)" Targets="Restore" Properties="RestoreProjectStyle=PackageReference" />
20
+ <MSBuild Projects="$(SolutionPath)" Targets="Restore" Properties="RestoreProjectStyle=PackagesConfig;RestorePackagesConfig=true" />
20
21
  </Target>
21
22
 
22
23
  </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.440</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.0.0-canary.441</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
@@ -0,0 +1,57 @@
1
+
2
+ /*
3
+ * This file is auto-generated from a NativeModule spec file in js.
4
+ *
5
+ * This is a C++ Spec class that should be used with MakeTurboModuleProvider to register native modules
6
+ * in a way that also verifies at compile time that the native module matches the interface required
7
+ * by the TurboModule JS spec.
8
+ */
9
+ #pragma once
10
+
11
+ #include "NativeModules.h"
12
+ #include <tuple>
13
+
14
+ namespace Microsoft::ReactNativeSpecs {
15
+
16
+ REACT_STRUCT(AppThemeSpec_HighContrastColors)
17
+ struct AppThemeSpec_HighContrastColors {
18
+ REACT_FIELD(ButtonFaceColor)
19
+ std::string ButtonFaceColor;
20
+ REACT_FIELD(ButtonTextColor)
21
+ std::string ButtonTextColor;
22
+ REACT_FIELD(GrayTextColor)
23
+ std::string GrayTextColor;
24
+ REACT_FIELD(HighlightColor)
25
+ std::string HighlightColor;
26
+ REACT_FIELD(HighlightTextColor)
27
+ std::string HighlightTextColor;
28
+ REACT_FIELD(HotlightColor)
29
+ std::string HotlightColor;
30
+ REACT_FIELD(WindowColor)
31
+ std::string WindowColor;
32
+ REACT_FIELD(WindowTextColor)
33
+ std::string WindowTextColor;
34
+ };
35
+
36
+ REACT_STRUCT(AppThemeSpec_AppThemeData)
37
+ struct AppThemeSpec_AppThemeData {
38
+ REACT_FIELD(isHighContrast)
39
+ bool isHighContrast;
40
+ REACT_FIELD(highContrastColors)
41
+ AppThemeSpec_HighContrastColors highContrastColors;
42
+ };
43
+
44
+ struct AppThemeSpec : winrt::Microsoft::ReactNative::TurboModuleSpec {
45
+ static constexpr auto methods = std::tuple{
46
+
47
+ };
48
+
49
+ template <class TModule>
50
+ static constexpr void ValidateModule() noexcept {
51
+ constexpr auto methodCheckResults = CheckMethods<TModule, AppThemeSpec>();
52
+
53
+
54
+ }
55
+ };
56
+
57
+ } // namespace Microsoft::ReactNativeSpecs
package/index.windows.js CHANGED
@@ -52,6 +52,9 @@ import typeof Animated from './Libraries/Animated/Animated';
52
52
  import typeof Appearance from './Libraries/Utilities/Appearance';
53
53
  import typeof AppRegistry from './Libraries/ReactNative/AppRegistry';
54
54
  import typeof AppState from './Libraries/AppState/AppState';
55
+ // [Windows
56
+ import typeof AppTheme from './Libraries/AppTheme/AppTheme';
57
+ // Windows]
55
58
  import typeof AsyncStorage from './Libraries/Storage/AsyncStorage';
56
59
  import typeof BackHandler from './Libraries/Utilities/BackHandler';
57
60
  import typeof Clipboard from './Libraries/Components/Clipboard/Clipboard';
@@ -525,8 +528,8 @@ module.exports = {
525
528
  get ViewWindows(): any {
526
529
  return require('./Libraries/Components/View/ViewWindows').ViewWindows;
527
530
  },
528
- get AppTheme(): any {
529
- return require('./Libraries/AppTheme/AppTheme').AppTheme;
531
+ get AppTheme(): AppTheme {
532
+ return require('./Libraries/AppTheme/AppTheme');
530
533
  },
531
534
  };
532
535
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.0.0-canary.440",
3
+ "version": "0.0.0-canary.441",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,6 @@
19
19
  // Ceyhun Ozugur <https://github.com/ceyhun>
20
20
  // Mike Martin <https://github.com/mcmar>
21
21
  // Theo Henry de Villeneuve <https://github.com/theohdv>
22
- // Eli White <https://github.com/TheSavior>
23
22
  // Romain Faust <https://github.com/romain-faust>
24
23
  // Be Birchall <https://github.com/bebebebebe>
25
24
  // Jesse Katsumata <https://github.com/Naturalclar>
@@ -6344,6 +6343,12 @@ export interface ScrollViewPropsIOS {
6344
6343
  */
6345
6344
  automaticallyAdjustContentInsets?: boolean | undefined; // true
6346
6345
 
6346
+ /**
6347
+ * Controls whether iOS should automatically adjust the scroll indicator
6348
+ * insets. The default value is true. Available on iOS 13 and later.
6349
+ */
6350
+ automaticallyAdjustsScrollIndicatorInsets?: boolean | undefined;
6351
+
6347
6352
  /**
6348
6353
  * When true the scroll view bounces when it reaches the end of the
6349
6354
  * content if the content is larger then the scroll view along the axis of
@@ -16,5 +16,4 @@ export * from './Libraries/Components/Keyboard/KeyboardExt';
16
16
  export * from './Libraries/Components/Keyboard/KeyboardExtProps';
17
17
  export * from './Libraries/Components/View/ViewWindowsProps';
18
18
  export * from './Libraries/Components/View/ViewWindows';
19
- export * from './Libraries/AppTheme/AppTheme';
20
19
  export * from './Libraries/AppTheme/AppThemeTypes';
package/typings-index.js CHANGED
@@ -36,6 +36,5 @@ __exportStar(require("./Libraries/Components/Keyboard/KeyboardExt"), exports);
36
36
  __exportStar(require("./Libraries/Components/Keyboard/KeyboardExtProps"), exports);
37
37
  __exportStar(require("./Libraries/Components/View/ViewWindowsProps"), exports);
38
38
  __exportStar(require("./Libraries/Components/View/ViewWindows"), exports);
39
- __exportStar(require("./Libraries/AppTheme/AppTheme"), exports);
40
39
  __exportStar(require("./Libraries/AppTheme/AppThemeTypes"), exports);
41
40
  //# sourceMappingURL=typings-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typings-index.js","sourceRoot":"","sources":["src/typings-index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;AAEH;;;;EAIE;AAEF,2EAA2E;AAC3E,wFAAwF;AACxF,iDAAiD;AACjD,kDAAgC;AAChC,4EAA0D;AAC1D,uEAAqD;AACrD,qEAAmD;AACnD,0EAAwD;AACxD,qEAAmD;AACnD,8EAA4D;AAC5D,mFAAiE;AACjE,+EAA6D;AAC7D,0EAAwD;AACxD,gEAA8C;AAC9C,qEAAmD","sourcesContent":["/**\n * @packagedocumentation\n *\n * This package provides Windows specific components in addition to providing the core react-native primities.\n * Cross platform React-native primitives should be imported from 'react-native'\n * Windows specific components need to be imported from 'react-native-windows'\n *\n */\n\n/*\n This file is used to provide the typings for this package.\n NOTE: Concrete classes, objects etc that actually need to be exported from the package,\n need to also be added to index.windows.js\n*/\n\n// Importing from a copy of react-native types instead of from react-native\n// to allow custom typescript resolvers to redirect react-native to react-native-windows\n// when building bundles for the windows platform\nexport * from './rntypes/index';\nexport * from './Libraries/Components/Flyout/FlyoutProps';\nexport * from './Libraries/Components/Flyout/Flyout';\nexport * from './Libraries/Components/Glyph/Glyph';\nexport * from './Libraries/Components/Popup/PopupProps';\nexport * from './Libraries/Components/Popup/Popup';\nexport * from './Libraries/Components/Keyboard/KeyboardExt';\nexport * from './Libraries/Components/Keyboard/KeyboardExtProps';\nexport * from './Libraries/Components/View/ViewWindowsProps';\nexport * from './Libraries/Components/View/ViewWindows';\nexport * from './Libraries/AppTheme/AppTheme';\nexport * from './Libraries/AppTheme/AppThemeTypes';\n"]}
1
+ {"version":3,"file":"typings-index.js","sourceRoot":"","sources":["src/typings-index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;AAEH;;;;EAIE;AAEF,2EAA2E;AAC3E,wFAAwF;AACxF,iDAAiD;AACjD,kDAAgC;AAChC,4EAA0D;AAC1D,uEAAqD;AACrD,qEAAmD;AACnD,0EAAwD;AACxD,qEAAmD;AACnD,8EAA4D;AAC5D,mFAAiE;AACjE,+EAA6D;AAC7D,0EAAwD;AACxD,qEAAmD","sourcesContent":["/**\n * @packagedocumentation\n *\n * This package provides Windows specific components in addition to providing the core react-native primities.\n * Cross platform React-native primitives should be imported from 'react-native'\n * Windows specific components need to be imported from 'react-native-windows'\n *\n */\n\n/*\n This file is used to provide the typings for this package.\n NOTE: Concrete classes, objects etc that actually need to be exported from the package,\n need to also be added to index.windows.js\n*/\n\n// Importing from a copy of react-native types instead of from react-native\n// to allow custom typescript resolvers to redirect react-native to react-native-windows\n// when building bundles for the windows platform\nexport * from './rntypes/index';\nexport * from './Libraries/Components/Flyout/FlyoutProps';\nexport * from './Libraries/Components/Flyout/Flyout';\nexport * from './Libraries/Components/Glyph/Glyph';\nexport * from './Libraries/Components/Popup/PopupProps';\nexport * from './Libraries/Components/Popup/Popup';\nexport * from './Libraries/Components/Keyboard/KeyboardExt';\nexport * from './Libraries/Components/Keyboard/KeyboardExtProps';\nexport * from './Libraries/Components/View/ViewWindowsProps';\nexport * from './Libraries/Components/View/ViewWindows';\nexport * from './Libraries/AppTheme/AppThemeTypes';\n"]}
@@ -1,13 +0,0 @@
1
- import { EmitterSubscription, NativeEventEmitter } from 'react-native';
2
- import { IHighContrastColors, IHighContrastChangedEvent } from './AppThemeTypes';
3
- declare class AppThemeModule extends NativeEventEmitter {
4
- private _isHighContrast;
5
- private _highContrastColors;
6
- constructor();
7
- addListener(eventName: 'highContrastChanged', listener: (nativeEvent: IHighContrastChangedEvent) => void): EmitterSubscription;
8
- get isHighContrast(): boolean;
9
- get currentHighContrastColors(): IHighContrastColors;
10
- }
11
- export declare type AppTheme = AppThemeModule;
12
- export declare const AppTheme: AppThemeModule;
13
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppTheme.js","sourceRoot":"","sources":["../../src/Libraries/AppTheme/AppTheme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,CAAC;;;AAEb,+CAIsB;AAGtB,+EAA+E;AAC/E,+EAA+E;AAC/E,sBAAsB;AACtB,MAAM,cAAc,GAAG,4BAAa,CAAC,WAAW,IAAI;IAClD,mBAAmB,EAAE,KAAK;IAC1B,yBAAyB,EAAE;QACzB,eAAe,EAAE,EAAE;QACnB,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,EAAE;QAClB,kBAAkB,EAAE,EAAE;QACtB,aAAa,EAAE,EAAE;QACjB,WAAW,EAAE,EAAE;QACf,eAAe,EAAE,EAAE;KACpB;CACF,CAAC;AAEF,MAAM,cAAe,SAAQ,iCAAkB;IAI7C;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,mBAAmB,GAAG,cAAc,CAAC,yBAAyB,CAAC;QACpE,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC,mBAAmB,CAAC;QAC1D,IAAI,CAAC,WAAW,CACd,qBAAqB,EACrB,CAAC,WAAsC,EAAE,EAAE;YACzC,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,cAAc,CAAC;YAClD,IAAI,CAAC,mBAAmB,GAAG,WAAW,CAAC,kBAAkB,CAAC;QAC5D,CAAC,CACF,CAAC;IACJ,CAAC;IAED,WAAW,CACT,SAAgC,EAChC,QAA0D;QAE1D,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAI,yBAAyB;QAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;CACF;AAGY,QAAA,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n'use strict';\n\nimport {\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n} from 'react-native';\nimport {IHighContrastColors, IHighContrastChangedEvent} from './AppThemeTypes';\n\n// We previously gracefully handled importing AppTheme in the Jest environment.\n// Mock the NM until we have a coherent story for exporting our own Jest mocks,\n// or remove this API.\nconst NativeAppTheme = NativeModules.RTCAppTheme || {\n initialHighContrast: false,\n initialHighContrastColors: {\n ButtonFaceColor: '',\n ButtonTextColor: '',\n GrayTextColor: '',\n HighlightColor: '',\n HighlightTextColor: '',\n HotlightColor: '',\n WindowColor: '',\n WindowTextColor: '',\n },\n};\n\nclass AppThemeModule extends NativeEventEmitter {\n private _isHighContrast: boolean;\n private _highContrastColors: IHighContrastColors;\n\n constructor() {\n super();\n\n this._highContrastColors = NativeAppTheme.initialHighContrastColors;\n this._isHighContrast = NativeAppTheme.initialHighContrast;\n this.addListener(\n 'highContrastChanged',\n (nativeEvent: IHighContrastChangedEvent) => {\n this._isHighContrast = nativeEvent.isHighContrast;\n this._highContrastColors = nativeEvent.highContrastColors;\n },\n );\n }\n\n addListener(\n eventName: 'highContrastChanged',\n listener: (nativeEvent: IHighContrastChangedEvent) => void,\n ): EmitterSubscription {\n return super.addListener(eventName, listener);\n }\n\n get isHighContrast(): boolean {\n return this._isHighContrast;\n }\n\n get currentHighContrastColors(): IHighContrastColors {\n return this._highContrastColors;\n }\n}\n\nexport type AppTheme = AppThemeModule;\nexport const AppTheme = new AppThemeModule();\n"]}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- * Licensed under the MIT License.
5
- * @format
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=AppThemeTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppThemeTypes.js","sourceRoot":"","sources":["../../src/Libraries/AppTheme/AppThemeTypes.ts"],"names":[],"mappings":";AAAA;;;;GAIG","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n/**\n * Color information for high contrast\n */\nexport interface IHighContrastColors {\n ButtonFaceColor: string;\n ButtonTextColor: string;\n GrayTextColor: string;\n HighlightColor: string;\n HighlightTextColor: string;\n HotlightColor: string;\n WindowColor: string;\n WindowTextColor: string;\n}\n\nexport interface IHighContrastChangedEvent {\n isHighContrast: boolean;\n highContrastColors: IHighContrastColors;\n}\n"]}