@react-native-oh/react-native-harmony 0.72.22 → 0.72.23-1

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.
@@ -164,7 +164,9 @@ class RefreshControl extends React.Component<RefreshControlProps> {
164
164
  render(): React.Node {
165
165
  // RNOH: patch - replaced occurrences Platform.OS with OS
166
166
  if (OS === "ios") {
167
- const { enabled, colors, progressBackgroundColor, size, ...props } =
167
+ // RNOH: patch - change descructuring to pass progressBackgroundColor to PullToRefreshViewNativeComponent
168
+ // BEFORE: const { enabled, colors, progressBackgroundColor, size, ...props } =
169
+ const { enabled, colors, size, ...props } =
168
170
  this.props;
169
171
  return (
170
172
  <PullToRefreshViewNativeComponent
@@ -681,6 +681,9 @@ export type Props = $ReadOnly<{|
681
681
 
682
682
  type State = {|
683
683
  layoutHeight: ?number,
684
+ // RNOH patch - resolving flashScrollIndicators command on the JS side
685
+ // as it is currently not feasible on the native side
686
+ showScrollIndicator: boolean,
684
687
  |};
685
688
 
686
689
  const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
@@ -766,6 +769,9 @@ class ScrollView extends React.Component<Props, State> {
766
769
 
767
770
  state: State = {
768
771
  layoutHeight: null,
772
+ // RNOH patch - resolving flashScrollIndicators command on the JS side
773
+ // as it is currently not feasible on the native side
774
+ showScrollIndicator: false,
769
775
  };
770
776
 
771
777
  componentDidMount() {
@@ -947,10 +953,20 @@ class ScrollView extends React.Component<Props, State> {
947
953
  * @platform ios
948
954
  */
949
955
  flashScrollIndicators: () => void = () => {
950
- if (this._scrollView.nativeInstance == null) {
951
- return;
952
- }
953
- Commands.flashScrollIndicators(this._scrollView.nativeInstance);
956
+ // RNOH patch - resolving flashScrollIndicators command on the JS side
957
+ // as it is currently not feasible on the native side
958
+
959
+ // if (this._scrollView.nativeInstance == null) {
960
+ // return;
961
+ // }
962
+ // Commands.flashScrollIndicators(this._scrollView.nativeInstance);
963
+
964
+ this.state.showScrollIndicator = true;
965
+ setTimeout(() => {
966
+ this.state.showScrollIndicator = false;
967
+ this.forceUpdate();
968
+ }, 500);
969
+ this.forceUpdate();
954
970
  };
955
971
 
956
972
  /**
@@ -1814,6 +1830,11 @@ class ScrollView extends React.Component<Props, State> {
1814
1830
  this.props.pagingEnabled === true &&
1815
1831
  this.props.snapToInterval == null &&
1816
1832
  this.props.snapToOffsets == null,
1833
+ // RNOH patch - resolving flashScrollIndicators command on the JS side
1834
+ // as it is currently not feasible on the native side
1835
+ showsVerticalScrollIndicator: (this.props.showsVerticalScrollIndicator ?? true) || this.state.showScrollIndicator,
1836
+ showsHorizontalScrollIndicator: (this.props.showsHorizontalScrollIndicator ?? true) || this.state.showScrollIndicator,
1837
+ persistentScrollbar: this.props.persistentScrollbar || this.state.showScrollIndicator,
1817
1838
  };
1818
1839
 
1819
1840
  const { decelerationRate } = this.props;
@@ -1609,6 +1609,16 @@ const ExportedForwardRef: React.AbstractComponent<
1609
1609
  delete style.verticalAlign;
1610
1610
  }
1611
1611
 
1612
+ // RNOH patch: invalid `keyboardType` prop values crash the app
1613
+ {
1614
+ // supported keyboard types from `textinput/conversions.h`
1615
+ const SUPPORTED_KEYBOARD_TYPES = ["default", "email-address", "numeric", "phone-pad", "number-pad", "url", "decimal-pad", "ascii-capable", "numbers-and-punctuation", "name-phone-pad", "twitter", "web-search", "ascii-capable-number-pad", "visible-password"];
1616
+ if (keyboardType && !SUPPORTED_KEYBOARD_TYPES.includes(keyboardType)) {
1617
+ keyboardType = "default";
1618
+ }
1619
+ }
1620
+ // END RNOH patch
1621
+
1612
1622
  return (
1613
1623
  <InternalTextInput
1614
1624
  allowFontScaling={allowFontScaling}
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and 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
+ * @format
8
+ * @flow strict-local
9
+ */
10
+
11
+ import NativeActionSheetManager from 'react-native/Libraries/ActionSheetIOS/NativeActionSheetManager';
12
+ import NativeShareModule from 'react-native/Libraries/Share/NativeShareModule';
13
+
14
+ const processColor = require('react-native/Libraries/StyleSheet/processColor').default;
15
+ const PlatformOS = 'android'; // rnoh: patch
16
+ const invariant = require('invariant');
17
+
18
+ type Content =
19
+ | {
20
+ title?: string,
21
+ message: string,
22
+ ...
23
+ }
24
+ | {
25
+ title?: string,
26
+ url: string,
27
+ ...
28
+ };
29
+ type Options = {
30
+ dialogTitle?: string,
31
+ excludedActivityTypes?: Array<string>,
32
+ tintColor?: string,
33
+ subject?: string,
34
+ anchor?: number,
35
+ ...
36
+ };
37
+
38
+ class Share {
39
+ /**
40
+ * Open a dialog to share text content.
41
+ *
42
+ * In iOS, Returns a Promise which will be invoked an object containing `action`, `activityType`.
43
+ * If the user dismissed the dialog, the Promise will still be resolved with action being `Share.dismissedAction`
44
+ * and all the other keys being undefined.
45
+ *
46
+ * In Android, Returns a Promise which always be resolved with action being `Share.sharedAction`.
47
+ *
48
+ * ### Content
49
+ *
50
+ * - `message` - a message to share
51
+ *
52
+ * #### iOS
53
+ *
54
+ * - `url` - a URL to share
55
+ *
56
+ * At least one of URL and message is required.
57
+ *
58
+ * #### Android
59
+ *
60
+ * - `title` - title of the message
61
+ *
62
+ * ### Options
63
+ *
64
+ * #### iOS
65
+ *
66
+ * - `subject` - a subject to share via email
67
+ * - `excludedActivityTypes`
68
+ * - `tintColor`
69
+ *
70
+ * #### Android
71
+ *
72
+ * - `dialogTitle`
73
+ *
74
+ */
75
+ static share(
76
+ content: Content,
77
+ options: Options = {},
78
+ ): Promise<{action: string, activityType: ?string}> {
79
+ invariant(
80
+ typeof content === 'object' && content !== null,
81
+ 'Content to share must be a valid object',
82
+ );
83
+ invariant(
84
+ typeof content.url === 'string' || typeof content.message === 'string' || typeof content.title === 'string', // rnoh: patch
85
+ 'At least one of URL, title and message is required', // rnoh: patch
86
+ );
87
+ invariant(
88
+ typeof options === 'object' && options !== null,
89
+ 'Options must be a valid object',
90
+ );
91
+
92
+ if (PlatformOS === 'android') {
93
+ invariant(
94
+ NativeShareModule,
95
+ 'ShareModule should be registered on Android.',
96
+ );
97
+ invariant(
98
+ content.title == null || typeof content.title === 'string',
99
+ 'Invalid title: title should be a string.',
100
+ );
101
+
102
+ const newContent = {
103
+ title: content.title,
104
+ message:
105
+ typeof content.message === 'string' ? content.message : undefined,
106
+ url: typeof content.url === 'string' ? content.url : undefined, // rnoh: patch
107
+ };
108
+
109
+ return NativeShareModule.share(newContent, options.dialogTitle)
110
+ .then(
111
+ result => ({
112
+ activityType: null,
113
+ ...result,
114
+ }),
115
+ );
116
+ } else if (PlatformOS=== 'ios') { // rnoh: patch
117
+ return new Promise((resolve, reject) => {
118
+ const tintColor = processColor(options.tintColor);
119
+
120
+ invariant(
121
+ tintColor == null || typeof tintColor === 'number',
122
+ 'Unexpected color given for options.tintColor',
123
+ );
124
+
125
+ invariant(
126
+ NativeActionSheetManager,
127
+ 'NativeActionSheetManager is not registered on iOS, but it should be.',
128
+ );
129
+
130
+ NativeActionSheetManager.showShareActionSheetWithOptions(
131
+ {
132
+ message:
133
+ typeof content.message === 'string' ? content.message : undefined,
134
+ url: typeof content.url === 'string' ? content.url : undefined,
135
+ subject: options.subject,
136
+ tintColor: typeof tintColor === 'number' ? tintColor : undefined,
137
+ anchor:
138
+ typeof options.anchor === 'number' ? options.anchor : undefined,
139
+ excludedActivityTypes: options.excludedActivityTypes,
140
+ },
141
+ error => reject(error),
142
+ (success, activityType) => {
143
+ if (success) {
144
+ resolve({
145
+ action: 'sharedAction',
146
+ activityType: activityType,
147
+ });
148
+ } else {
149
+ resolve({
150
+ action: 'dismissedAction',
151
+ activityType: null,
152
+ });
153
+ }
154
+ },
155
+ );
156
+ });
157
+ } else {
158
+ return Promise.reject(new Error('Unsupported platform'));
159
+ }
160
+ }
161
+
162
+ /**
163
+ * The content was successfully shared.
164
+ */
165
+ static sharedAction: 'sharedAction' = 'sharedAction';
166
+
167
+ /**
168
+ * The dialog has been dismissed.
169
+ * @platform ios
170
+ */
171
+ static dismissedAction: 'dismissedAction' = 'dismissedAction';
172
+ }
173
+
174
+ module.exports = Share;
package/index.js CHANGED
@@ -66,6 +66,9 @@ module.exports = {
66
66
  get Linking() {
67
67
  return require('react-native/Libraries/Linking/Linking');
68
68
  },
69
+ get LogBox() {
70
+ return require('react-native/Libraries/LogBox/LogBox').default;
71
+ },
69
72
  get Modal() {
70
73
  return require('react-native/Libraries/Modal/Modal');
71
74
  },
@@ -111,7 +114,7 @@ module.exports = {
111
114
  return require('./Libraries/Components/SafeAreaView/SafeAreaView').default;
112
115
  },
113
116
  get Share() {
114
- return require('react-native/Libraries/Share/Share');
117
+ return require('./Libraries/Share/Share');
115
118
  },
116
119
  get ScrollView() {
117
120
  return require('./Libraries/Components/ScrollView/ScrollView');
@@ -125,6 +128,9 @@ module.exports = {
125
128
  get Switch() {
126
129
  return require('react-native/Libraries/Components/Switch/Switch').default;
127
130
  },
131
+ get Systrace() {
132
+ return require('react-native/Libraries/Performance/Systrace');
133
+ },
128
134
  get Text() {
129
135
  return require('react-native/Libraries/Text/Text');
130
136
  },
@@ -155,6 +161,10 @@ module.exports = {
155
161
  get UIManager() {
156
162
  return require('./Libraries/ReactNative/UIManager');
157
163
  },
164
+ get unstable_batchedUpdates() {
165
+ return require('react-native/Libraries/ReactNative/RendererProxy')
166
+ .unstable_batchedUpdates;
167
+ },
158
168
  get useAnimatedValue() {
159
169
  return require('react-native/Libraries/Animated/useAnimatedValue').default;
160
170
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-oh/react-native-harmony",
3
- "version": "0.72.22",
3
+ "version": "0.72.23-1",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -46,7 +46,7 @@
46
46
  "./*.har"
47
47
  ],
48
48
  "dependencies": {
49
- "@react-native-oh/react-native-harmony-cli": "^0.0.24",
49
+ "@react-native-oh/react-native-harmony-cli": "^0.0.23",
50
50
  "colors": "^1.4.0",
51
51
  "fs-extra": "^11.1.1",
52
52
  "metro": "^0.76.3",
package/types/index.d.ts CHANGED
@@ -48,9 +48,9 @@ export * from 'react-native/Libraries/Linking/Linking';
48
48
  export * from 'react-native/Libraries/Lists/FlatList';
49
49
  export * from 'react-native/Libraries/Lists/SectionList';
50
50
  export * from '@react-native/virtualized-lists';
51
- // export * from 'react-native/Libraries/LogBox/LogBox';
51
+ export * from 'react-native/Libraries/LogBox/LogBox';
52
52
  export * from 'react-native/Libraries/Modal/Modal';
53
- // export * as Systrace from 'react-native/Libraries/Performance/Systrace';
53
+ export * as Systrace from 'react-native/Libraries/Performance/Systrace';
54
54
  // export * from 'react-native/Libraries/PermissionsAndroid/PermissionsAndroid';
55
55
  // export * from 'react-native/Libraries/PushNotificationIOS/PushNotificationIOS';
56
56
  export * from 'react-native/Libraries/ReactNative/AppRegistry';