react-native-macos 0.0.0-5c51f7dd6 → 0.0.0-63022c8a7

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 (125) hide show
  1. package/Libraries/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +25 -0
  2. package/Libraries/Animated/NativeAnimatedHelper.js +1 -1
  3. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +22 -12
  4. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +3 -6
  5. package/Libraries/Components/Touchable/TouchableBounce.js +11 -22
  6. package/Libraries/Components/Touchable/TouchableHighlight.js +19 -30
  7. package/Libraries/Components/Touchable/TouchableOpacity.js +14 -29
  8. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +8 -18
  9. package/Libraries/Components/View/ReactNativeViewAttributes.js +8 -7
  10. package/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +1 -2
  11. package/Libraries/Components/View/View.js +8 -10
  12. package/Libraries/Components/View/ViewPropTypes.js +1 -7
  13. package/Libraries/Core/ExceptionsManager.js +3 -1
  14. package/Libraries/Core/ReactNativeVersion.js +5 -1
  15. package/Libraries/Core/setUpBatchedBridge.js +1 -1
  16. package/Libraries/Core/setUpGlobals.js +2 -0
  17. package/Libraries/Core/setUpTimers.js +2 -2
  18. package/Libraries/Image/Image.ios.js +6 -0
  19. package/Libraries/Pressability/Pressability.js +1 -0
  20. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -0
  21. package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +16 -1
  22. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js +2 -0
  23. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js +8 -1
  24. package/Libraries/Text/RawText/RCTRawTextShadowView.m +2 -0
  25. package/Libraries/Text/Text/RCTTextView.m +7 -9
  26. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +10 -8
  27. package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +2 -0
  28. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +15 -3
  29. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +10 -1
  30. package/Libraries/Text/TextProps.js +1 -7
  31. package/Libraries/TurboModule/TurboModuleRegistry.js +1 -1
  32. package/Libraries/Utilities/HMRClient.js +1 -1
  33. package/Libraries/WebSocket/RCTSRWebSocket.m +23 -0
  34. package/README.md +18 -42
  35. package/React/Base/RCTBridgeModule.h +1 -1
  36. package/React/Base/RCTConvert.m +23 -6
  37. package/React/Base/RCTImageSource.m +2 -0
  38. package/React/Base/RCTJSStackFrame.m +2 -0
  39. package/React/Base/RCTJavaScriptLoader.mm +2 -0
  40. package/React/Base/RCTKeyCommands.m +2 -0
  41. package/React/Base/RCTModuleData.mm +2 -0
  42. package/React/Base/RCTModuleMethod.mm +2 -0
  43. package/React/Base/RCTTouchEvent.m +2 -0
  44. package/React/Base/RCTVersion.m +5 -1
  45. package/React/Base/macOS/RCTPlatformDisplayLink.m +4 -1
  46. package/React/CoreModules/RCTActionSheetManager.mm +4 -0
  47. package/React/CoreModules/RCTAddressSanitizerCrashManager.h +12 -0
  48. package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +18 -0
  49. package/React/CoreModules/RCTAppearance.mm +5 -1
  50. package/React/CoreModules/RCTDevLoadingView.mm +14 -9
  51. package/React/CxxModule/RCTCxxMethod.mm +2 -0
  52. package/React/DevSupport/RCTInspectorDevServerHelper.mm +12 -0
  53. package/React/FBReactNativeSpec/FBReactNativeSpec.podspec +12 -2
  54. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +9 -0
  55. package/React/Modules/RCTLayoutAnimation.m +2 -0
  56. package/React/Modules/RCTLayoutAnimationGroup.m +2 -0
  57. package/React/Views/RCTFont.mm +58 -47
  58. package/React/Views/RCTShadowView.m +3 -1
  59. package/React/Views/RCTView.h +5 -2
  60. package/React/Views/RCTView.m +22 -10
  61. package/React/Views/RCTViewManager.m +12 -16
  62. package/React/Views/SafeAreaView/RCTSafeAreaView.m +2 -0
  63. package/React/Views/ScrollView/MacOS/RCTScrollContentLocalData.h +2 -2
  64. package/React/Views/ScrollView/MacOS/RCTScrollContentLocalData.m +4 -4
  65. package/React/Views/ScrollView/RCTScrollContentView.m +10 -24
  66. package/React/Views/ScrollView/RCTScrollView.m +1 -5
  67. package/ReactAndroid/build.gradle +9 -3
  68. package/ReactAndroid/gradle.properties +1 -1
  69. package/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK +0 -1
  70. package/ReactAndroid/src/androidTest/js/TestBundle.js +0 -7
  71. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +47 -15
  72. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +12 -0
  73. package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +6 -0
  74. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCxxErrorHandler.java +39 -0
  75. package/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +6 -0
  76. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +5 -1
  77. package/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK +0 -1
  78. package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +0 -5
  79. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java +0 -4
  80. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +16 -0
  81. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +20 -1
  82. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +25 -6
  83. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +25 -5
  84. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.java +3 -0
  85. package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +2 -0
  86. package/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.cpp +18 -0
  87. package/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h +25 -0
  88. package/ReactAndroid/src/main/third-party/android/androidx/BUCK +6 -6
  89. package/ReactCommon/cxxreact/ReactNativeVersion.h +5 -1
  90. package/ReactCommon/hermes/inspector/tools/msggen/package.json +1 -1
  91. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +1225 -1481
  92. package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +20 -28
  93. package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp +7 -3
  94. package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +12 -2
  95. package/ReactCommon/react/renderer/attributedstring/conversions.h +58 -3
  96. package/ReactCommon/react/renderer/attributedstring/primitives.h +18 -1
  97. package/ReactCommon/react/renderer/components/view/ViewShadowNode.h +1 -1
  98. package/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
  99. package/ReactCommon/react/renderer/core/RawPropsKey.cpp +10 -2
  100. package/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +4 -4
  101. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +2 -0
  102. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +19 -0
  103. package/ReactCommon/react/test_utils/BUCK +3 -0
  104. package/ReactCommon/react/test_utils/MockSurfaceHandler.h +25 -0
  105. package/ReactCommon/react/utils/ContextContainer.h +0 -27
  106. package/flow/global.js +45 -0
  107. package/index.js +15 -10
  108. package/package.json +21 -13
  109. package/scripts/generate-specs.sh +62 -29
  110. package/scripts/react_native_pods.rb +29 -29
  111. package/template/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  112. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +2 -0
  113. package/template/package.json +4 -2
  114. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -87
  115. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
  116. package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
  117. package/React/Base/macOS/RCTDynamicColor.h +0 -28
  118. package/React/Base/macOS/RCTDynamicColor.m +0 -217
  119. package/ReactAndroid/src/androidTest/java/com/facebook/react/tests/DatePickerDialogTestCase.java +0 -172
  120. package/ReactAndroid/src/androidTest/js/DatePickerDialogTestModule.js +0 -45
  121. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/BUCK +0 -27
  122. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DatePickerDialogFragment.java +0 -137
  123. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DatePickerDialogModule.java +0 -153
  124. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DatePickerMode.java +0 -15
  125. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DismissableDatePickerDialog.java +0 -117
@@ -1093,13 +1093,11 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1093
1093
  getComponentDescriptorForShadowView(baselineShadowView)
1094
1094
  .cloneProps(propsParserContext, viewStart.props, {});
1095
1095
 
1096
- // Dynamic cast, because - we don't know the type of this
1097
- // ShadowNode, it could be Image or Text or something else with
1098
- // different base props.
1099
- const auto viewProps =
1100
- dynamic_cast<const ViewProps *>(props.get());
1101
- if (viewProps != nullptr) {
1102
- const_cast<ViewProps *>(viewProps)->opacity = 0;
1096
+ if (baselineShadowView.traits.check(
1097
+ ShadowNodeTraits::Trait::ViewKind)) {
1098
+ auto const &viewProps =
1099
+ *std::static_pointer_cast<ViewProps const>(props);
1100
+ const_cast<ViewProps &>(viewProps).opacity = 0;
1103
1101
  }
1104
1102
 
1105
1103
  react_native_assert(props != nullptr);
@@ -1118,13 +1116,11 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1118
1116
  getComponentDescriptorForShadowView(baselineShadowView)
1119
1117
  .cloneProps(propsParserContext, viewStart.props, {});
1120
1118
 
1121
- // Dynamic cast, because - we don't know the type of this
1122
- // ShadowNode, it could be Image or Text or something else with
1123
- // different base props.
1124
- const auto viewProps =
1125
- dynamic_cast<const ViewProps *>(props.get());
1126
- if (viewProps != nullptr) {
1127
- const_cast<ViewProps *>(viewProps)->transform =
1119
+ if (baselineShadowView.traits.check(
1120
+ ShadowNodeTraits::Trait::ViewKind)) {
1121
+ auto const &viewProps =
1122
+ *std::static_pointer_cast<ViewProps const>(props);
1123
+ const_cast<ViewProps &>(viewProps).transform =
1128
1124
  Transform::Scale(isScaleX ? 0 : 1, isScaleY ? 0 : 1, 1);
1129
1125
  }
1130
1126
 
@@ -1221,13 +1217,11 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1221
1217
  getComponentDescriptorForShadowView(baselineShadowView)
1222
1218
  .cloneProps(propsParserContext, viewFinal.props, {});
1223
1219
 
1224
- // Dynamic cast, because - we don't know the type of this
1225
- // ShadowNode, it could be Image or Text or something else with
1226
- // different base props.
1227
- const auto viewProps =
1228
- dynamic_cast<const ViewProps *>(props.get());
1229
- if (viewProps != nullptr) {
1230
- const_cast<ViewProps *>(viewProps)->opacity = 0;
1220
+ if (baselineShadowView.traits.check(
1221
+ ShadowNodeTraits::Trait::ViewKind)) {
1222
+ auto const &viewProps =
1223
+ *std::static_pointer_cast<ViewProps const>(props);
1224
+ const_cast<ViewProps &>(viewProps).opacity = 0;
1231
1225
  }
1232
1226
 
1233
1227
  react_native_assert(props != nullptr);
@@ -1248,13 +1242,11 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1248
1242
  getComponentDescriptorForShadowView(baselineShadowView)
1249
1243
  .cloneProps(propsParserContext, viewFinal.props, {});
1250
1244
 
1251
- // Dynamic cast, because - we don't know the type of this
1252
- // ShadowNode, it could be Image or Text or something else with
1253
- // different base props.
1254
- const auto viewProps =
1255
- dynamic_cast<const ViewProps *>(props.get());
1256
- if (viewProps != nullptr) {
1257
- const_cast<ViewProps *>(viewProps)->transform =
1245
+ if (baselineShadowView.traits.check(
1246
+ ShadowNodeTraits::Trait::ViewKind)) {
1247
+ auto const &viewProps =
1248
+ *std::static_pointer_cast<ViewProps const>(props);
1249
+ const_cast<ViewProps &>(viewProps).transform =
1258
1250
  Transform::Scale(isScaleX ? 0 : 1, isScaleY ? 0 : 1, 1);
1259
1251
  }
1260
1252
 
@@ -21,13 +21,15 @@ bool ParagraphAttributes::operator==(const ParagraphAttributes &rhs) const {
21
21
  ellipsizeMode,
22
22
  textBreakStrategy,
23
23
  adjustsFontSizeToFit,
24
- includeFontPadding) ==
24
+ includeFontPadding,
25
+ android_hyphenationFrequency) ==
25
26
  std::tie(
26
27
  rhs.maximumNumberOfLines,
27
28
  rhs.ellipsizeMode,
28
29
  rhs.textBreakStrategy,
29
30
  rhs.adjustsFontSizeToFit,
30
- rhs.includeFontPadding) &&
31
+ rhs.includeFontPadding,
32
+ rhs.android_hyphenationFrequency) &&
31
33
  floatEquality(minimumFontSize, rhs.minimumFontSize) &&
32
34
  floatEquality(maximumFontSize, rhs.maximumFontSize);
33
35
  }
@@ -47,7 +49,9 @@ SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
47
49
  debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit),
48
50
  debugStringConvertibleItem("minimumFontSize", minimumFontSize),
49
51
  debugStringConvertibleItem("maximumFontSize", maximumFontSize),
50
- debugStringConvertibleItem("includeFontPadding", includeFontPadding)};
52
+ debugStringConvertibleItem("includeFontPadding", includeFontPadding),
53
+ debugStringConvertibleItem(
54
+ "android_hyphenationFrequency", android_hyphenationFrequency)};
51
55
  }
52
56
  #endif
53
57
 
@@ -42,7 +42,10 @@ class ParagraphAttributes : public DebugStringConvertible {
42
42
  */
43
43
  EllipsizeMode ellipsizeMode{};
44
44
 
45
- TextBreakStrategy textBreakStrategy{};
45
+ /*
46
+ * (Android only) Break strategy for breaking paragraphs into lines.
47
+ */
48
+ TextBreakStrategy textBreakStrategy{TextBreakStrategy::HighQuality};
46
49
 
47
50
  /*
48
51
  * Enables font size adjustment to fit constrained boundaries.
@@ -55,6 +58,12 @@ class ParagraphAttributes : public DebugStringConvertible {
55
58
  */
56
59
  bool includeFontPadding{true};
57
60
 
61
+ /*
62
+ * (Android only) Frequency of automatic hyphenation to use when determining
63
+ * word breaks.
64
+ */
65
+ HyphenationFrequency android_hyphenationFrequency{};
66
+
58
67
  /*
59
68
  * In case of font size adjustment enabled, defines minimum and maximum
60
69
  * font sizes.
@@ -89,7 +98,8 @@ struct hash<facebook::react::ParagraphAttributes> {
89
98
  attributes.adjustsFontSizeToFit,
90
99
  attributes.minimumFontSize,
91
100
  attributes.maximumFontSize,
92
- attributes.includeFontPadding);
101
+ attributes.includeFontPadding,
102
+ attributes.android_hyphenationFrequency);
93
103
  }
94
104
  };
95
105
  } // namespace std
@@ -96,7 +96,7 @@ inline std::string toString(const TextBreakStrategy &textBreakStrategy) {
96
96
 
97
97
  LOG(ERROR) << "Unsupported TextBreakStrategy value";
98
98
  react_native_assert(false);
99
- return "simple";
99
+ return "highQuality";
100
100
  }
101
101
 
102
102
  inline void fromRawValue(
@@ -116,14 +116,14 @@ inline void fromRawValue(
116
116
  // sane default
117
117
  LOG(ERROR) << "Unsupported TextBreakStrategy value: " << string;
118
118
  react_native_assert(false);
119
- result = TextBreakStrategy::Simple;
119
+ result = TextBreakStrategy::HighQuality;
120
120
  }
121
121
  return;
122
122
  }
123
123
 
124
124
  LOG(ERROR) << "Unsupported TextBreakStrategy type";
125
125
  react_native_assert(false);
126
- result = TextBreakStrategy::Simple;
126
+ result = TextBreakStrategy::HighQuality;
127
127
  }
128
128
 
129
129
  inline void fromRawValue(
@@ -712,6 +712,48 @@ inline void fromRawValue(
712
712
  result = AccessibilityRole::None;
713
713
  }
714
714
 
715
+ inline std::string toString(const HyphenationFrequency &hyphenationFrequency) {
716
+ switch (hyphenationFrequency) {
717
+ case HyphenationFrequency::None:
718
+ return "none";
719
+ case HyphenationFrequency::Normal:
720
+ return "normal";
721
+ case HyphenationFrequency::Full:
722
+ return "full";
723
+ }
724
+
725
+ LOG(ERROR) << "Unsupported HyphenationFrequency value";
726
+ react_native_assert(false);
727
+ return "none";
728
+ }
729
+
730
+ inline void fromRawValue(
731
+ const PropsParserContext &context,
732
+ const RawValue &value,
733
+ HyphenationFrequency &result) {
734
+ react_native_assert(value.hasType<std::string>());
735
+ if (value.hasType<std::string>()) {
736
+ auto string = (std::string)value;
737
+ if (string == "none") {
738
+ result = HyphenationFrequency::None;
739
+ } else if (string == "normal") {
740
+ result = HyphenationFrequency::Normal;
741
+ } else if (string == "full") {
742
+ result = HyphenationFrequency::Full;
743
+ } else {
744
+ // sane default
745
+ LOG(ERROR) << "Unsupported HyphenationFrequency value: " << string;
746
+ react_native_assert(false);
747
+ result = HyphenationFrequency::None;
748
+ }
749
+ return;
750
+ }
751
+
752
+ LOG(ERROR) << "Unsupported HyphenationFrequency type";
753
+ react_native_assert(false);
754
+ result = HyphenationFrequency::None;
755
+ }
756
+
715
757
  inline ParagraphAttributes convertRawProp(
716
758
  const PropsParserContext &context,
717
759
  RawProps const &rawProps,
@@ -761,6 +803,12 @@ inline ParagraphAttributes convertRawProp(
761
803
  "includeFontPadding",
762
804
  sourceParagraphAttributes.includeFontPadding,
763
805
  defaultParagraphAttributes.includeFontPadding);
806
+ paragraphAttributes.android_hyphenationFrequency = convertRawProp(
807
+ context,
808
+ rawProps,
809
+ "android_hyphenationFrequency",
810
+ sourceParagraphAttributes.android_hyphenationFrequency,
811
+ defaultParagraphAttributes.android_hyphenationFrequency);
764
812
 
765
813
  return paragraphAttributes;
766
814
  }
@@ -796,6 +844,9 @@ inline folly::dynamic toDynamic(
796
844
  values("textBreakStrategy", toString(paragraphAttributes.textBreakStrategy));
797
845
  values("adjustsFontSizeToFit", paragraphAttributes.adjustsFontSizeToFit);
798
846
  values("includeFontPadding", paragraphAttributes.includeFontPadding);
847
+ values(
848
+ "android_hyphenationFrequency",
849
+ toString(paragraphAttributes.android_hyphenationFrequency));
799
850
 
800
851
  return values;
801
852
  }
@@ -993,6 +1044,7 @@ constexpr static Key PA_KEY_ELLIPSIZE_MODE = 1;
993
1044
  constexpr static Key PA_KEY_TEXT_BREAK_STRATEGY = 2;
994
1045
  constexpr static Key PA_KEY_ADJUST_FONT_SIZE_TO_FIT = 3;
995
1046
  constexpr static Key PA_KEY_INCLUDE_FONT_PADDING = 4;
1047
+ constexpr static Key PA_KEY_HYPHENATION_FREQUENCY = 5;
996
1048
 
997
1049
  inline MapBuffer toMapBuffer(const ParagraphAttributes &paragraphAttributes) {
998
1050
  auto builder = MapBufferBuilder();
@@ -1007,6 +1059,9 @@ inline MapBuffer toMapBuffer(const ParagraphAttributes &paragraphAttributes) {
1007
1059
  PA_KEY_ADJUST_FONT_SIZE_TO_FIT, paragraphAttributes.adjustsFontSizeToFit);
1008
1060
  builder.putBool(
1009
1061
  PA_KEY_INCLUDE_FONT_PADDING, paragraphAttributes.includeFontPadding);
1062
+ builder.putString(
1063
+ PA_KEY_HYPHENATION_FREQUENCY,
1064
+ toString(paragraphAttributes.android_hyphenationFrequency));
1010
1065
 
1011
1066
  return builder.build();
1012
1067
  }
@@ -53,7 +53,11 @@ enum class EllipsizeMode {
53
53
  Middle // Truncate middle of line: "ab...yz".
54
54
  };
55
55
 
56
- enum class TextBreakStrategy { Simple, Balanced, HighQuality };
56
+ enum class TextBreakStrategy {
57
+ Simple, // Simple strategy.
58
+ HighQuality, // High-quality strategy, including hyphenation.
59
+ Balanced // Balances line lengths.
60
+ };
57
61
 
58
62
  enum class TextAlignment {
59
63
  Natural, // Indicates the default alignment for script.
@@ -126,6 +130,12 @@ enum class TextTransform {
126
130
  Unset,
127
131
  };
128
132
 
133
+ enum class HyphenationFrequency {
134
+ None, // No hyphenation.
135
+ Normal, // Less frequent hyphenation.
136
+ Full // Standard amount of hyphenation.
137
+ };
138
+
129
139
  } // namespace react
130
140
  } // namespace facebook
131
141
 
@@ -213,4 +223,11 @@ struct hash<facebook::react::TextTransform> {
213
223
  return hash<int>()(static_cast<int>(v));
214
224
  }
215
225
  };
226
+
227
+ template <>
228
+ struct hash<facebook::react::HyphenationFrequency> {
229
+ size_t operator()(const facebook::react::HyphenationFrequency &v) const {
230
+ return hash<int>()(static_cast<int>(v));
231
+ }
232
+ };
216
233
  } // namespace std
@@ -24,7 +24,7 @@ class ViewShadowNode final : public ConcreteViewShadowNode<
24
24
  ViewEventEmitter> {
25
25
  public:
26
26
  static ShadowNodeTraits BaseTraits() {
27
- auto traits = BaseShadowNode::BaseTraits();
27
+ auto traits = ConcreteViewShadowNode::BaseTraits();
28
28
  traits.set(ShadowNodeTraits::Trait::View);
29
29
  return traits;
30
30
  }
@@ -98,6 +98,10 @@ inline void fromString(const std::string &string, AccessibilityTraits &result) {
98
98
  result = AccessibilityTraits::TabBar;
99
99
  return;
100
100
  }
101
+ if (string == "progressbar") {
102
+ result = AccessibilityTraits::UpdatesFrequently;
103
+ return;
104
+ }
101
105
  result = AccessibilityTraits::None;
102
106
  }
103
107
 
@@ -51,10 +51,18 @@ RawPropsKey::operator std::string() const noexcept {
51
51
  return std::string{buffer, length};
52
52
  }
53
53
 
54
+ static bool areFieldsEqual(char const *lhs, char const *rhs) {
55
+ if (lhs == nullptr || rhs == nullptr) {
56
+ return lhs == rhs;
57
+ }
58
+ return std::string(lhs) == std::string(rhs);
59
+ }
60
+
54
61
  bool operator==(RawPropsKey const &lhs, RawPropsKey const &rhs) noexcept {
55
62
  // Note: We check the name first.
56
- return lhs.name == rhs.name && lhs.prefix == rhs.prefix &&
57
- lhs.suffix == rhs.suffix;
63
+ return areFieldsEqual(lhs.name, rhs.name) &&
64
+ areFieldsEqual(lhs.prefix, rhs.prefix) &&
65
+ areFieldsEqual(lhs.suffix, rhs.suffix);
58
66
  }
59
67
 
60
68
  bool operator!=(RawPropsKey const &lhs, RawPropsKey const &rhs) noexcept {
@@ -34,7 +34,7 @@ class UIManager;
34
34
  * ensure the logical consistency of some methods (e.g. calling `stop` for
35
35
  * non-running surface will crash).
36
36
  */
37
- class SurfaceHandler final {
37
+ class SurfaceHandler {
38
38
  public:
39
39
  /*
40
40
  * Represents a status of the `SurfaceHandler` instance.
@@ -62,7 +62,7 @@ class SurfaceHandler final {
62
62
  * Can be constructed anytime with a `moduleName` and a `surfaceId`.
63
63
  */
64
64
  SurfaceHandler(std::string const &moduleName, SurfaceId surfaceId) noexcept;
65
- ~SurfaceHandler() noexcept;
65
+ virtual ~SurfaceHandler() noexcept;
66
66
 
67
67
  /*
68
68
  * Movable-only.
@@ -95,10 +95,10 @@ class SurfaceHandler final {
95
95
  void stop() const noexcept;
96
96
 
97
97
  /*
98
- * Sets (and gets) the runnnig mode.
98
+ * Sets (and gets) the running mode.
99
99
  * The running mode can be changed anytime (even for `Unregistered` surface).
100
100
  */
101
- void setDisplayMode(DisplayMode displayMode) const noexcept;
101
+ virtual void setDisplayMode(DisplayMode displayMode) const noexcept;
102
102
  DisplayMode getDisplayMode() const noexcept;
103
103
 
104
104
  #pragma mark - Accessors
@@ -35,6 +35,8 @@ NSAttributedString *RCTNSAttributedStringFromAttributedStringBox(
35
35
  facebook::react::AttributedStringBox RCTAttributedStringBoxFromNSAttributedString(
36
36
  NSAttributedString *nsAttributedString);
37
37
 
38
+ NSString *RCTNSStringFromStringApplyingTextTransform(NSString *string, facebook::react::TextTransform textTransform);
39
+
38
40
  @interface RCTWeakEventEmitterWrapper : NSObject
39
41
  @property (nonatomic, assign) facebook::react::SharedEventEmitter eventEmitter;
40
42
  @end
@@ -335,6 +335,11 @@ NSAttributedString *RCTNSAttributedStringFromAttributedString(const AttributedSt
335
335
  } else {
336
336
  NSString *string = [NSString stringWithCString:fragment.string.c_str() encoding:NSUTF8StringEncoding];
337
337
 
338
+ if (fragment.textAttributes.textTransform.hasValue()) {
339
+ auto textTransform = fragment.textAttributes.textTransform.value();
340
+ string = RCTNSStringFromStringApplyingTextTransform(string, textTransform);
341
+ }
342
+
338
343
  nsAttributedStringFragment = [[NSMutableAttributedString alloc]
339
344
  initWithString:string
340
345
  attributes:RCTNSTextAttributesFromTextAttributes(fragment.textAttributes)];
@@ -373,3 +378,17 @@ AttributedStringBox RCTAttributedStringBoxFromNSAttributedString(NSAttributedStr
373
378
  {
374
379
  return nsAttributedString.length ? AttributedStringBox{wrapManagedObject(nsAttributedString)} : AttributedStringBox{};
375
380
  }
381
+
382
+ NSString *RCTNSStringFromStringApplyingTextTransform(NSString *string, TextTransform textTransform)
383
+ {
384
+ switch (textTransform) {
385
+ case TextTransform::Uppercase:
386
+ return [string uppercaseString];
387
+ case TextTransform::Lowercase:
388
+ return [string lowercaseString];
389
+ case TextTransform::Capitalize:
390
+ return [string capitalizedString];
391
+ default:
392
+ return string;
393
+ }
394
+ }
@@ -51,4 +51,7 @@ rn_xplat_cxx_library(
51
51
  react_native_xplat_target("better:better"),
52
52
  react_native_xplat_target("react/debug:debug"),
53
53
  ],
54
+ exported_deps = [
55
+ "//xplat/third-party/gmock:gmock",
56
+ ],
54
57
  )
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <gmock/gmock.h>
11
+
12
+ #include <react/renderer/scheduler/SurfaceHandler.h>
13
+
14
+ namespace facebook {
15
+ namespace react {
16
+
17
+ class MockSurfaceHandler : public SurfaceHandler {
18
+ public:
19
+ MockSurfaceHandler() : SurfaceHandler("moduleName", 0){};
20
+
21
+ MOCK_QUALIFIED_METHOD1(setDisplayMode, const noexcept, void(DisplayMode));
22
+ };
23
+
24
+ } // namespace react
25
+ } // namespace facebook
@@ -45,10 +45,6 @@ class ContextContainer final {
45
45
  std::unique_lock<better::shared_mutex> lock(mutex_);
46
46
 
47
47
  instances_.insert({key, std::make_shared<T>(instance)});
48
-
49
- #ifdef REACT_NATIVE_DEBUG
50
- typeNames_.insert({key, typeid(T).name()});
51
- #endif
52
48
  }
53
49
 
54
50
  /*
@@ -59,10 +55,6 @@ class ContextContainer final {
59
55
  std::unique_lock<better::shared_mutex> lock(mutex_);
60
56
 
61
57
  instances_.erase(key);
62
-
63
- #ifdef REACT_NATIVE_DEBUG
64
- typeNames_.erase(key);
65
- #endif
66
58
  }
67
59
 
68
60
  /*
@@ -76,11 +68,6 @@ class ContextContainer final {
76
68
  for (auto const &pair : contextContainer.instances_) {
77
69
  instances_.erase(pair.first);
78
70
  instances_.insert(pair);
79
- #ifdef REACT_NATIVE_DEBUG
80
- typeNames_.erase(pair.first);
81
- typeNames_.insert(
82
- {pair.first, contextContainer.typeNames_.at(pair.first)});
83
- #endif
84
71
  }
85
72
  }
86
73
 
@@ -96,11 +83,6 @@ class ContextContainer final {
96
83
  react_native_assert(
97
84
  instances_.find(key) != instances_.end() &&
98
85
  "ContextContainer doesn't have an instance for given key.");
99
- #ifdef REACT_NATIVE_DEBUG
100
- react_native_assert(
101
- typeNames_.at(key) == typeid(T).name() &&
102
- "ContextContainer stores an instance of different type for given key.");
103
- #endif
104
86
  return *std::static_pointer_cast<T>(instances_.at(key));
105
87
  }
106
88
 
@@ -118,12 +100,6 @@ class ContextContainer final {
118
100
  return {};
119
101
  }
120
102
 
121
- #ifdef REACT_NATIVE_DEBUG
122
- react_native_assert(
123
- typeNames_.at(key) == typeid(T).name() &&
124
- "ContextContainer stores an instance of different type for given key.");
125
- #endif
126
-
127
103
  return *std::static_pointer_cast<T>(iterator->second);
128
104
  }
129
105
 
@@ -131,9 +107,6 @@ class ContextContainer final {
131
107
  mutable better::shared_mutex mutex_;
132
108
  // Protected by mutex_`.
133
109
  mutable better::map<std::string, std::shared_ptr<void>> instances_;
134
- #ifdef REACT_NATIVE_DEBUG
135
- mutable better::map<std::string, std::string> typeNames_;
136
- #endif
137
110
  };
138
111
 
139
112
  } // namespace react
package/flow/global.js CHANGED
@@ -16,8 +16,53 @@
16
16
  * writeability (`+`) when defining types.
17
17
  */
18
18
  declare var global: {
19
+ // setUpGlobals
20
+ +window: typeof global,
21
+ +self: typeof global,
22
+
23
+ // setXHR
24
+ +XMLHttpRequest: typeof XMLHttpRequest,
25
+ +FormData: typeof FormData,
26
+ +fetch: typeof fetch,
27
+ +Headers: typeof Headers,
28
+ +Request: typeof Request,
29
+ +Response: typeof Response,
30
+ +WebSocket: typeof WebSocket,
31
+ +Blob: typeof Blob,
32
+ +File: typeof File,
33
+ +FileReader: typeof FileReader,
34
+ +URL: typeof URL,
35
+ +URLSearchParams: typeof URLSearchParams,
36
+ +AbortController: typeof AbortController,
37
+ +AbortSignal: typeof AbortSignal,
38
+
39
+ // setUpAlert
40
+ +alert: typeof alert,
41
+
42
+ // setUpTimers
43
+ +clearInterval: typeof clearInterval,
44
+ +clearTimeout: typeof clearTimeout,
45
+ +setInterval: typeof setInterval,
46
+ +setTimeout: typeof setTimeout,
47
+ +requestAnimationFrame: typeof requestAnimationFrame,
48
+ +cancelAnimationFrame: typeof cancelAnimationFrame,
49
+ +requestIdleCallback: typeof requestIdleCallback,
50
+ +cancelIdleCallback: typeof cancelIdleCallback,
51
+ +setTimeout: typeof setTimeout,
52
+ // TODO(T97509743): use `typeof` when the next Flow release is available.
53
+ +queueMicrotask: <TArguments: Array<mixed>>(
54
+ jobCallback: (...args: TArguments) => mixed,
55
+ ) => void,
56
+
57
+ +console: typeof console,
58
+
59
+ // JavaScript environments specific
19
60
  +HermesInternal: ?$HermesInternalType,
20
61
 
62
+ // Internal-specific
63
+ +__DEV__?: boolean,
64
+ +RN$Bridgeless?: boolean,
65
+
21
66
  // Undeclared properties are implicitly `any`.
22
67
  [string | symbol]: any,
23
68
  };
package/index.js CHANGED
@@ -57,7 +57,6 @@ import typeof AppState from './Libraries/AppState/AppState';
57
57
  import typeof AsyncStorage from './Libraries/Storage/AsyncStorage';
58
58
  import typeof BackHandler from './Libraries/Utilities/BackHandler';
59
59
  import typeof Clipboard from './Libraries/Components/Clipboard/Clipboard';
60
- import typeof DatePickerAndroid from './Libraries/Components/DatePickerAndroid/DatePickerAndroid';
61
60
  import typeof DeviceInfo from './Libraries/Utilities/DeviceInfo';
62
61
  import typeof DevSettings from './Libraries/Utilities/DevSettings';
63
62
  import typeof Dimensions from './Libraries/Utilities/Dimensions';
@@ -322,15 +321,6 @@ module.exports = {
322
321
  );
323
322
  return require('./Libraries/Components/Clipboard/Clipboard');
324
323
  },
325
- get DatePickerAndroid(): DatePickerAndroid {
326
- warnOnce(
327
- 'DatePickerAndroid-merged',
328
- 'DatePickerAndroid has been merged with DatePickerIOS and will be removed in a future release. ' +
329
- "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
330
- 'See https://github.com/react-native-datetimepicker/datetimepicker',
331
- );
332
- return require('./Libraries/Components/DatePickerAndroid/DatePickerAndroid');
333
- },
334
324
  get DeviceInfo(): DeviceInfo {
335
325
  return require('./Libraries/Utilities/DeviceInfo');
336
326
  },
@@ -752,4 +742,19 @@ if (__DEV__) {
752
742
  );
753
743
  },
754
744
  });
745
+ /* $FlowFixMe[prop-missing] This is intentional: Flow will error when
746
+ * attempting to access DatePickerAndroid. */
747
+ /* $FlowFixMe[invalid-export] This is intentional: Flow will error when
748
+ * attempting to access DatePickerAndroid. */
749
+ Object.defineProperty(module.exports, 'DatePickerAndroid', {
750
+ configurable: true,
751
+ get() {
752
+ invariant(
753
+ false,
754
+ 'DatePickerAndroid has been removed from React Native. ' +
755
+ "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
756
+ 'See https://github.com/react-native-datetimepicker/datetimepicker',
757
+ );
758
+ },
759
+ });
755
760
  }