react-native-macos 0.0.0-aace54cae → 0.0.0-ab720113d
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.
- package/Libraries/Components/ScrollView/ScrollView.js +11 -0
- package/Libraries/Components/TextInput/TextInput.js +72 -1
- package/Libraries/Components/View/ViewPropTypes.js +10 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/RCTImageView.mm +14 -10
- package/Libraries/Lists/FlatList.js +1 -2
- package/Libraries/Lists/VirtualizedList.js +13 -8
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +3 -0
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +3 -0
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +11 -0
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.h +1 -0
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +69 -2
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +7 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +12 -3
- package/Libraries/Text/TextInput/RCTBaseTextInputView.h +4 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +91 -2
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +6 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +33 -0
- package/React/Base/RCTConvert.m +8 -5
- package/React/Base/RCTTouchHandler.m +4 -0
- package/React/Base/RCTUtils.m +6 -3
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTPerfMonitor.mm +1 -1
- package/React/Views/RCTActivityIndicatorView.m +2 -1
- package/React/Views/RCTView.h +1 -0
- package/React/Views/RCTView.m +44 -15
- package/React/Views/RCTViewManager.m +1 -1
- package/React/Views/ScrollView/RCTScrollContentView.h +4 -0
- package/React/Views/ScrollView/RCTScrollContentView.m +6 -0
- package/React/Views/ScrollView/RCTScrollContentViewManager.m +2 -0
- package/React/Views/ScrollView/RCTScrollView.h +2 -0
- package/React/Views/ScrollView/RCTScrollView.m +15 -0
- package/React/Views/ScrollView/RCTScrollViewManager.m +1 -0
- package/React/Views/UIView+React.h +2 -0
- package/React/Views/UIView+React.m +22 -13
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
- package/scripts/react_native_pods.rb +0 -3
- package/template/Gemfile.lock +2 -2
- package/template/package.json +1 -1
- package/third-party-podspecs/boost-for-react-native.podspec +0 -20
|
@@ -499,6 +499,10 @@ export type Props = $ReadOnly<{|
|
|
|
499
499
|
* ScrollView. This is usually used with inverted ScrollViews.
|
|
500
500
|
*/
|
|
501
501
|
invertStickyHeaders?: ?boolean,
|
|
502
|
+
/**
|
|
503
|
+
* Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere
|
|
504
|
+
*/
|
|
505
|
+
inverted?: ?boolean, // TODO(macOS GH#774)
|
|
502
506
|
/**
|
|
503
507
|
* Determines whether the keyboard gets dismissed in response to a drag.
|
|
504
508
|
*
|
|
@@ -1192,6 +1196,11 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1192
1196
|
this.setState({contentKey: this.state.contentKey + 1});
|
|
1193
1197
|
}; // ]TODO(macOS GH#774)
|
|
1194
1198
|
|
|
1199
|
+
// [TODO(macOS GH#774)
|
|
1200
|
+
_handleInvertedDidChange = () => {
|
|
1201
|
+
this.setState({contentKey: this.state.contentKey + 1});
|
|
1202
|
+
}; // ]TODO(macOS GH#774)
|
|
1203
|
+
|
|
1195
1204
|
_handleScroll = (e: ScrollEvent) => {
|
|
1196
1205
|
if (__DEV__) {
|
|
1197
1206
|
if (
|
|
@@ -1716,6 +1725,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1716
1725
|
: this.props.removeClippedSubviews
|
|
1717
1726
|
}
|
|
1718
1727
|
key={this.state.contentKey} // TODO(macOS GH#774)
|
|
1728
|
+
inverted={this.props.inverted} // TODO(macOS GH#774)
|
|
1719
1729
|
collapsable={false}>
|
|
1720
1730
|
{children}
|
|
1721
1731
|
</NativeDirectionalScrollContentView>
|
|
@@ -1743,6 +1753,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1743
1753
|
// Override the onContentSizeChange from props, since this event can
|
|
1744
1754
|
// bubble up from TextInputs
|
|
1745
1755
|
onContentSizeChange: null,
|
|
1756
|
+
onInvertedDidChange: this._handleInvertedDidChange, // TODO macOS GH#774
|
|
1746
1757
|
onPreferredScrollerStyleDidChange:
|
|
1747
1758
|
this._handlePreferredScrollerStyleDidChange, // TODO(macOS GH#774)
|
|
1748
1759
|
onLayout: this._handleLayout,
|
|
@@ -135,7 +135,27 @@ export type SettingChangeEvent = SyntheticEvent<
|
|
|
135
135
|
$ReadOnly<{|
|
|
136
136
|
enabled: boolean,
|
|
137
137
|
|}>,
|
|
138
|
-
>;
|
|
138
|
+
>;
|
|
139
|
+
|
|
140
|
+
export type PasteEvent = SyntheticEvent<
|
|
141
|
+
$ReadOnly<{|
|
|
142
|
+
dataTransfer: {|
|
|
143
|
+
files: $ReadOnlyArray<{|
|
|
144
|
+
height: number,
|
|
145
|
+
size: number,
|
|
146
|
+
type: string,
|
|
147
|
+
uri: string,
|
|
148
|
+
width: number,
|
|
149
|
+
|}>,
|
|
150
|
+
items: $ReadOnlyArray<{|
|
|
151
|
+
kind: string,
|
|
152
|
+
type: string,
|
|
153
|
+
|}>,
|
|
154
|
+
types: $ReadOnlyArray<string>,
|
|
155
|
+
|},
|
|
156
|
+
|}>,
|
|
157
|
+
>;
|
|
158
|
+
// ]TODO(macOS GH#774)
|
|
139
159
|
|
|
140
160
|
type DataDetectorTypesType =
|
|
141
161
|
// iOS+macOS
|
|
@@ -333,6 +353,51 @@ type IOSProps = $ReadOnly<{|
|
|
|
333
353
|
textContentType?: ?TextContentType,
|
|
334
354
|
|}>;
|
|
335
355
|
|
|
356
|
+
// [TODO(macOS GH#774)
|
|
357
|
+
export type SubmitKeyEvent = $ReadOnly<{|
|
|
358
|
+
key: string,
|
|
359
|
+
altKey?: ?boolean,
|
|
360
|
+
ctrlKey?: ?boolean,
|
|
361
|
+
metaKey?: ?boolean,
|
|
362
|
+
shiftKey?: ?boolean,
|
|
363
|
+
functionKey?: ?boolean,
|
|
364
|
+
|}>;
|
|
365
|
+
|
|
366
|
+
type MacOSProps = $ReadOnly<{|
|
|
367
|
+
/**
|
|
368
|
+
* If `true`, clears the text field synchronously before `onSubmitEditing` is emitted.
|
|
369
|
+
* @platform macos
|
|
370
|
+
*/
|
|
371
|
+
clearTextOnSubmit?: ?boolean,
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Fired when a supported element is pasted
|
|
375
|
+
*
|
|
376
|
+
* @platform macos
|
|
377
|
+
*/
|
|
378
|
+
onPaste?: (event: PasteEvent) => void,
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Enables Paste support for certain types of pasted types
|
|
382
|
+
*
|
|
383
|
+
* Possible values for `pastedTypes` are:
|
|
384
|
+
*
|
|
385
|
+
* - `'fileUrl'`
|
|
386
|
+
* - `'image'`
|
|
387
|
+
* - `'string'`
|
|
388
|
+
*
|
|
389
|
+
* @platform macos
|
|
390
|
+
*/
|
|
391
|
+
pastedTypes?: PastedTypesType,
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Configures keys that can be used to submit editing for the TextInput. Defaults to 'Enter' key.
|
|
395
|
+
* @platform macos
|
|
396
|
+
*/
|
|
397
|
+
submitKeyEvents?: ?$ReadOnlyArray<SubmitKeyEvent>,
|
|
398
|
+
|}>;
|
|
399
|
+
// ]TODO(macOS GH#774)
|
|
400
|
+
|
|
336
401
|
type AndroidProps = $ReadOnly<{|
|
|
337
402
|
/**
|
|
338
403
|
* Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
|
|
@@ -492,9 +557,13 @@ type AndroidProps = $ReadOnly<{|
|
|
|
492
557
|
underlineColorAndroid?: ?ColorValue,
|
|
493
558
|
|}>;
|
|
494
559
|
|
|
560
|
+
export type PasteType = 'fileUrl' | 'image' | 'string'; // TODO(macOS GH#774)
|
|
561
|
+
export type PastedTypesType = PasteType | $ReadOnlyArray<PasteType>; // TODO(macOS GH#774)
|
|
562
|
+
|
|
495
563
|
export type Props = $ReadOnly<{|
|
|
496
564
|
...$Diff<ViewProps, $ReadOnly<{|style: ?ViewStyleProp|}>>,
|
|
497
565
|
...IOSProps,
|
|
566
|
+
...MacOSProps, // TODO(macOS GH#774)
|
|
498
567
|
...AndroidProps,
|
|
499
568
|
|
|
500
569
|
/**
|
|
@@ -1333,6 +1402,8 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1333
1402
|
onChangeSync={useOnChangeSync === true ? _onChangeSync : null}
|
|
1334
1403
|
onContentSizeChange={props.onContentSizeChange}
|
|
1335
1404
|
onFocus={_onFocus}
|
|
1405
|
+
onKeyDown={props.onKeyDown} // TODO(macOS GH#774)
|
|
1406
|
+
onKeyUp={props.onKeyUp} // TODO(macOS GH#774)
|
|
1336
1407
|
onScroll={_onScroll}
|
|
1337
1408
|
onSelectionChange={_onSelectionChange}
|
|
1338
1409
|
onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
|
|
@@ -70,6 +70,12 @@ type DirectEventProps = $ReadOnly<{|
|
|
|
70
70
|
*/
|
|
71
71
|
onDoubleClick?: ?(event: SyntheticEvent<{}>) => mixed, // TODO(macOS GH#774)
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* This event is fired when the scrollView's inverted property changes.
|
|
75
|
+
* @platform macos
|
|
76
|
+
*/
|
|
77
|
+
onInvertedDidChange?: ?() => mixed, // TODO(macOS GH#774)
|
|
78
|
+
|
|
73
79
|
/**
|
|
74
80
|
* This event is fired when the system's preferred scroller style changes.
|
|
75
81
|
* The `preferredScrollerStyle` key will be `legacy` or `overlay`.
|
|
@@ -414,6 +420,10 @@ type IOSViewProps = $ReadOnly<{|
|
|
|
414
420
|
* See https://reactnative.dev/docs/view#accessibilityElementsHidden
|
|
415
421
|
*/
|
|
416
422
|
accessibilityElementsHidden?: ?boolean,
|
|
423
|
+
/**
|
|
424
|
+
* Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere
|
|
425
|
+
*/
|
|
426
|
+
inverted?: ?boolean, // TODO(macOS GH#774)
|
|
417
427
|
|
|
418
428
|
onDoubleClick?: ?(event: SyntheticEvent<{}>) => mixed, // TODO(macOS GH#774)
|
|
419
429
|
|
|
@@ -128,6 +128,8 @@ static NSDictionary *onLoadParamsForSource(RCTImageSource *source)
|
|
|
128
128
|
// Whether the latest change of props requires the image to be reloaded
|
|
129
129
|
BOOL _needsReload;
|
|
130
130
|
|
|
131
|
+
UIImage *_image; // TODO(macOS GH#774)
|
|
132
|
+
|
|
131
133
|
RCTUIImageViewAnimated *_imageView;
|
|
132
134
|
|
|
133
135
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
@@ -199,10 +201,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
199
201
|
if (_renderingMode != image.renderingMode) {
|
|
200
202
|
image = [image imageWithRenderingMode:_renderingMode];
|
|
201
203
|
}
|
|
202
|
-
#else // [TODO(macOS GH#774)
|
|
203
|
-
if ((_renderingMode == UIImageRenderingModeAlwaysTemplate) != [image isTemplate]) {
|
|
204
|
-
[image setTemplate:(_renderingMode == UIImageRenderingModeAlwaysTemplate)];
|
|
205
|
-
}
|
|
206
204
|
#endif // ]TODO(macOS GH#774)
|
|
207
205
|
|
|
208
206
|
if (_resizeMode == RCTResizeModeRepeat) {
|
|
@@ -211,6 +209,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
211
209
|
#else // [TODO(macOS GH#774)
|
|
212
210
|
image.capInsets = _capInsets;
|
|
213
211
|
image.resizingMode = NSImageResizingModeTile;
|
|
212
|
+
} else if (_resizeMode == RCTResizeModeCover) {
|
|
213
|
+
if (!NSEqualSizes(self.bounds.size, NSZeroSize)) {
|
|
214
|
+
image = RCTFillImagePreservingAspectRatio(image, self.bounds.size, self.window.backingScaleFactor ?: 1.0);
|
|
215
|
+
}
|
|
214
216
|
#endif // ]TODO(macOS GH#774)
|
|
215
217
|
} else if (!UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, _capInsets)) {
|
|
216
218
|
// Applying capInsets of 0 will switch the "resizingMode" of the image to "tile" which is undesired
|
|
@@ -222,6 +224,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
222
224
|
#endif // ]TODO(macOS GH#774)
|
|
223
225
|
}
|
|
224
226
|
|
|
227
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
228
|
+
if ((_renderingMode == UIImageRenderingModeAlwaysTemplate) != [image isTemplate]) {
|
|
229
|
+
[image setTemplate:(_renderingMode == UIImageRenderingModeAlwaysTemplate)];
|
|
230
|
+
}
|
|
231
|
+
#endif // ]TODO(macOS GH#774)
|
|
232
|
+
|
|
225
233
|
// Apply trilinear filtering to smooth out mis-sized images
|
|
226
234
|
_imageView.layer.minificationFilter = kCAFilterTrilinear;
|
|
227
235
|
_imageView.layer.magnificationFilter = kCAFilterTrilinear;
|
|
@@ -233,17 +241,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
233
241
|
{
|
|
234
242
|
image = image ?: _defaultImage;
|
|
235
243
|
if (image != self.image) {
|
|
236
|
-
|
|
237
|
-
if (image && _resizeMode == RCTResizeModeCover && !NSEqualSizes(self.bounds.size, NSZeroSize)) {
|
|
238
|
-
image = RCTFillImagePreservingAspectRatio(image, self.bounds.size, self.window.backingScaleFactor ?: 1.0);
|
|
239
|
-
}
|
|
240
|
-
#endif // ]TODO(macOS GH#774)
|
|
244
|
+
_image = image; // TODO(macOS GH#774)
|
|
241
245
|
[self updateWithImage:image];
|
|
242
246
|
}
|
|
243
247
|
}
|
|
244
248
|
|
|
245
249
|
- (UIImage *)image {
|
|
246
|
-
return _imageView.image;
|
|
250
|
+
return _image ?: _imageView.image; // TODO(macOS GH#774)
|
|
247
251
|
}
|
|
248
252
|
|
|
249
253
|
- (void)setBlurRadius:(CGFloat)blurRadius
|
|
@@ -136,7 +136,7 @@ type OptionalProps<ItemT> = {|
|
|
|
136
136
|
initialSelectedIndex?: ?number,
|
|
137
137
|
// ]TODO(macOS GH#774)
|
|
138
138
|
/**
|
|
139
|
-
* Reverses the direction of scroll. Uses scale transforms of -1
|
|
139
|
+
* Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere
|
|
140
140
|
*/
|
|
141
141
|
inverted?: ?boolean,
|
|
142
142
|
/**
|
|
@@ -688,7 +688,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
688
688
|
removeClippedSubviews={removeClippedSubviewsOrDefault(
|
|
689
689
|
_removeClippedSubviews,
|
|
690
690
|
)}
|
|
691
|
-
accessibilityRole="table" // TODO(macOS GH#774): Inherit NSAccessibilityTable protocols
|
|
692
691
|
{...this._renderer()}
|
|
693
692
|
/>
|
|
694
693
|
);
|
|
@@ -800,7 +800,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|
|
800
800
|
(this.props.initialScrollIndex || 0) +
|
|
801
801
|
initialNumToRenderOrDefault(this.props.initialNumToRender),
|
|
802
802
|
) - 1,
|
|
803
|
-
selectedRowIndex: this.props.initialSelectedIndex
|
|
803
|
+
selectedRowIndex: this.props.initialSelectedIndex ?? -1, // TODO(macOS GH#774)
|
|
804
804
|
};
|
|
805
805
|
|
|
806
806
|
if (this._isNestedWithSameOrientation()) {
|
|
@@ -979,11 +979,13 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|
|
979
979
|
this.props;
|
|
980
980
|
const {data, horizontal} = this.props;
|
|
981
981
|
const isVirtualizationDisabled = this._isVirtualizationDisabled();
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
982
|
+
// macOS natively supports inverted lists, thus not needing an inversion style
|
|
983
|
+
const inversionStyle =
|
|
984
|
+
this.props.inverted && Platform.OS !== 'macos' // TODO(macOS GH#774)
|
|
985
|
+
? horizontalOrDefault(this.props.horizontal)
|
|
986
|
+
? styles.horizontallyInverted
|
|
987
|
+
: styles.verticallyInverted
|
|
988
|
+
: null;
|
|
987
989
|
const cells = [];
|
|
988
990
|
const stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices);
|
|
989
991
|
const stickyHeaderIndices = [];
|
|
@@ -1330,6 +1332,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|
|
1330
1332
|
// [TODO(macOS GH#774)
|
|
1331
1333
|
const preferredScrollerStyleDidChangeHandler =
|
|
1332
1334
|
this.props.onPreferredScrollerStyleDidChange;
|
|
1335
|
+
const invertedDidChange = this.props.onInvertedDidChange;
|
|
1333
1336
|
|
|
1334
1337
|
const keyboardNavigationProps = {
|
|
1335
1338
|
focusable: true,
|
|
@@ -1351,12 +1354,13 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|
|
1351
1354
|
return (
|
|
1352
1355
|
// $FlowFixMe[prop-missing] Invalid prop usage
|
|
1353
1356
|
<ScrollView
|
|
1354
|
-
{...props}
|
|
1355
1357
|
// [TODO(macOS GH#774)
|
|
1356
1358
|
{...(props.enableSelectionOnKeyPress && keyboardNavigationProps)}
|
|
1359
|
+
onInvertedDidChange={invertedDidChange}
|
|
1357
1360
|
onPreferredScrollerStyleDidChange={
|
|
1358
1361
|
preferredScrollerStyleDidChangeHandler
|
|
1359
1362
|
} // TODO(macOS GH#774)]
|
|
1363
|
+
{...props}
|
|
1360
1364
|
refreshControl={
|
|
1361
1365
|
props.refreshControl == null ? (
|
|
1362
1366
|
<RefreshControl
|
|
@@ -1374,12 +1378,13 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|
|
1374
1378
|
return (
|
|
1375
1379
|
// $FlowFixMe Invalid prop usage
|
|
1376
1380
|
<ScrollView
|
|
1377
|
-
{...props}
|
|
1378
1381
|
// [TODO(macOS GH#774)
|
|
1379
1382
|
{...(props.enableSelectionOnKeyPress && keyboardNavigationProps)}
|
|
1383
|
+
onInvertedDidChange={invertedDidChange}
|
|
1380
1384
|
onPreferredScrollerStyleDidChange={
|
|
1381
1385
|
preferredScrollerStyleDidChangeHandler
|
|
1382
1386
|
} // TODO(macOS GH#774)]
|
|
1387
|
+
{...props}
|
|
1383
1388
|
/>
|
|
1384
1389
|
);
|
|
1385
1390
|
}
|
|
@@ -11,6 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
11
11
|
|
|
12
12
|
@interface RCTMultilineTextInputView : RCTBaseTextInputView
|
|
13
13
|
|
|
14
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
15
|
+
- (void)setReadablePasteBoardTypes:(NSArray<NSPasteboardType> *)readablePasteboardTypes;
|
|
16
|
+
#endif // ]TODO(macOS GH#774)
|
|
14
17
|
@end
|
|
15
18
|
|
|
16
19
|
NS_ASSUME_NONNULL_END
|
|
@@ -99,6 +99,9 @@
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
- (void)setReadablePasteBoardTypes:(NSArray<NSPasteboardType> *)readablePasteboardTypes {
|
|
103
|
+
[_backedTextInputView setReadablePasteBoardTypes:readablePasteboardTypes];
|
|
104
|
+
}
|
|
102
105
|
#endif // ]TODO(macOS GH#774)
|
|
103
106
|
|
|
104
107
|
#pragma mark - UIScrollViewDelegate
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#import <React/RCTMultilineTextInputViewManager.h>
|
|
9
9
|
#import <React/RCTMultilineTextInputView.h>
|
|
10
|
+
#import <React/RCTUITextView.h> // TODO(macOS GH#774)
|
|
10
11
|
|
|
11
12
|
@implementation RCTMultilineTextInputViewManager
|
|
12
13
|
|
|
@@ -22,4 +23,14 @@ RCT_EXPORT_MODULE()
|
|
|
22
23
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.dataDetectorTypes, UIDataDetectorTypes) // TODO(macOS GH#774)
|
|
23
24
|
RCT_REMAP_OSX_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.enabledTextCheckingTypes, NSTextCheckingTypes) // TODO(macOS GH#774)
|
|
24
25
|
|
|
26
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
27
|
+
RCT_CUSTOM_VIEW_PROPERTY(pastedTypes, NSArray<NSPasteboardType>*, RCTUITextView)
|
|
28
|
+
{
|
|
29
|
+
NSArray<NSPasteboardType> *types = json ? [RCTConvert NSPasteboardTypeArray:json] : nil;
|
|
30
|
+
if ([view respondsToSelector:@selector(setReadablePasteBoardTypes:)]) {
|
|
31
|
+
[view setReadablePasteBoardTypes: types];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
#endif // ]TODO(macOS GH#774)
|
|
35
|
+
|
|
25
36
|
@end
|
|
@@ -53,6 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
53
53
|
@property (nonatomic, assign) NSTextAlignment textAlignment;
|
|
54
54
|
@property (nonatomic, copy, nullable) NSAttributedString *attributedText;
|
|
55
55
|
- (NSSize)sizeThatFits:(NSSize)size;
|
|
56
|
+
- (void)setReadablePasteBoardTypes:(NSArray<NSPasteboardType> *)readablePasteboardTypes;
|
|
56
57
|
#endif // ]TODO(macOS GH#774)
|
|
57
58
|
|
|
58
59
|
@end
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
#endif // TODO(macOS GH#774)
|
|
22
22
|
RCTBackedTextViewDelegateAdapter *_textInputDelegateAdapter;
|
|
23
23
|
NSDictionary<NSAttributedStringKey, id> *_defaultTextAttributes;
|
|
24
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
25
|
+
NSArray<NSPasteboardType> *_readablePasteboardTypes;
|
|
26
|
+
#endif // TODO(macOS GH#774)
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
static UIFont *defaultPlaceholderFont()
|
|
@@ -177,6 +180,11 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
177
180
|
self.string = text;
|
|
178
181
|
}
|
|
179
182
|
|
|
183
|
+
- (void)setReadablePasteBoardTypes:(NSArray<NSPasteboardType> *)readablePasteboardTypes
|
|
184
|
+
{
|
|
185
|
+
_readablePasteboardTypes = readablePasteboardTypes;
|
|
186
|
+
}
|
|
187
|
+
|
|
180
188
|
- (void)setTypingAttributes:(__unused NSDictionary *)typingAttributes
|
|
181
189
|
{
|
|
182
190
|
// Prevent NSTextView from changing its own typing attributes out from under us.
|
|
@@ -320,12 +328,45 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
320
328
|
{
|
|
321
329
|
return [super selectedRange];
|
|
322
330
|
}
|
|
331
|
+
|
|
332
|
+
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)draggingInfo
|
|
333
|
+
{
|
|
334
|
+
NSDragOperation dragOperation = [self.textInputDelegate textInputDraggingEntered:draggingInfo];
|
|
335
|
+
NSDragOperation superOperation = [super draggingEntered:draggingInfo];
|
|
336
|
+
// The delegate's operation should take precedence.
|
|
337
|
+
return dragOperation != NSDragOperationNone ? dragOperation : superOperation;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
- (void)draggingExited:(id<NSDraggingInfo>)draggingInfo
|
|
341
|
+
{
|
|
342
|
+
[self.textInputDelegate textInputDraggingExited:draggingInfo];
|
|
343
|
+
[super draggingExited:draggingInfo];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
- (BOOL)performDragOperation:(id<NSDraggingInfo>)draggingInfo
|
|
347
|
+
{
|
|
348
|
+
if ([self.textInputDelegate textInputShouldHandleDragOperation:draggingInfo]) {
|
|
349
|
+
return [super performDragOperation:draggingInfo];
|
|
350
|
+
}
|
|
351
|
+
return YES;
|
|
352
|
+
}
|
|
353
|
+
- (NSArray *)readablePasteboardTypes
|
|
354
|
+
{
|
|
355
|
+
return _readablePasteboardTypes ? _readablePasteboardTypes : [super readablePasteboardTypes];
|
|
356
|
+
}
|
|
357
|
+
|
|
323
358
|
#endif // ]TODO(macOS GH#774)
|
|
324
359
|
|
|
325
360
|
- (void)paste:(id)sender
|
|
326
361
|
{
|
|
327
|
-
|
|
328
|
-
|
|
362
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
363
|
+
if ([self.textInputDelegate textInputShouldHandlePaste:self]) {
|
|
364
|
+
#endif
|
|
365
|
+
[super paste:sender];
|
|
366
|
+
_textWasPasted = YES;
|
|
367
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
368
|
+
}
|
|
369
|
+
#endif
|
|
329
370
|
}
|
|
330
371
|
|
|
331
372
|
// Turn off scroll animation to fix flaky scrolling.
|
|
@@ -383,6 +424,10 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
383
424
|
// UI/NSTextField do NOT have textContainerInset properties
|
|
384
425
|
_textContainerInsets = textContainerInsets;
|
|
385
426
|
super.textContainerInset = NSMakeSize(MIN(textContainerInsets.left, textContainerInsets.right), MIN(textContainerInsets.top, textContainerInsets.bottom));
|
|
427
|
+
|
|
428
|
+
if (self.shouldDrawInsertionPoint) {
|
|
429
|
+
[self updateInsertionPointStateAndRestartTimer:NO];
|
|
430
|
+
}
|
|
386
431
|
}
|
|
387
432
|
|
|
388
433
|
#endif // ]TODO(macOS GH#774)
|
|
@@ -514,6 +559,28 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
514
559
|
[super deleteBackward];
|
|
515
560
|
}
|
|
516
561
|
}
|
|
562
|
+
#else
|
|
563
|
+
- (void)keyDown:(NSEvent *)event {
|
|
564
|
+
// If has marked text, handle by native and return
|
|
565
|
+
// Do this check before textInputShouldHandleKeyEvent as that one attempts to send the event to JS
|
|
566
|
+
if (self.hasMarkedText) {
|
|
567
|
+
[super keyDown:event];
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// textInputShouldHandleKeyEvent represents if native should handle the event instead of JS.
|
|
572
|
+
// textInputShouldHandleKeyEvent also sends keyDown event to JS internally, so we only call this once
|
|
573
|
+
if ([self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
574
|
+
[super keyDown:event];
|
|
575
|
+
[self.textInputDelegate submitOnKeyDownIfNeeded:event];
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
- (void)keyUp:(NSEvent *)event {
|
|
580
|
+
if ([self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
581
|
+
[super keyUp:event];
|
|
582
|
+
}
|
|
583
|
+
}
|
|
517
584
|
#endif // ]TODO(OSS Candidate ISS#2710739)
|
|
518
585
|
|
|
519
586
|
- (void)_updatePlaceholder
|
|
@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
26
26
|
- (void)automaticSpellingCorrectionDidChange:(BOOL)enabled;
|
|
27
27
|
- (void)continuousSpellCheckingDidChange:(BOOL)enabled;
|
|
28
28
|
- (void)grammarCheckingDidChange:(BOOL)enabled;
|
|
29
|
+
- (void)submitOnKeyDownIfNeeded:(NSEvent *)event;
|
|
29
30
|
#endif // ]TODO(macOS GH#774)
|
|
30
31
|
|
|
31
32
|
/*
|
|
@@ -42,8 +43,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
42
43
|
- (BOOL)textInputShouldHandleDeleteBackward:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the deleteBackward event handled normally. Return `NO` to disallow it and handle it yourself. TODO(OSS Candidate ISS#2710739)
|
|
43
44
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
44
45
|
- (BOOL)textInputShouldHandleDeleteForward:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the deleteForward event handled normally. Return `NO` to disallow it and handle it yourself.
|
|
45
|
-
|
|
46
|
+
- (BOOL)textInputShouldHandleKeyEvent:(NSEvent *)event; // Return `YES` to have the key event handled normally. Return `NO` to disallow it and handle it yourself.
|
|
47
|
+
- (BOOL)hasValidKeyDownOrValidKeyUp:(NSString *)key;
|
|
48
|
+
- (NSDragOperation)textInputDraggingEntered:(id<NSDraggingInfo>)draggingInfo;
|
|
49
|
+
- (void)textInputDraggingExited:(id<NSDraggingInfo>)draggingInfo;
|
|
50
|
+
- (BOOL)textInputShouldHandleDragOperation:(id<NSDraggingInfo>)draggingInfo;
|
|
46
51
|
- (void)textInputDidCancel; // Handle `Escape` key press.
|
|
52
|
+
- (BOOL)textInputShouldHandlePaste:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the paste event handled normally. Return `NO` to disallow it and handle it yourself.
|
|
47
53
|
#endif // ]TODO(macOS GH#774)
|
|
48
54
|
|
|
49
55
|
@optional
|
|
@@ -213,11 +213,18 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
213
213
|
}
|
|
214
214
|
//paste
|
|
215
215
|
} else if (commandSelector == @selector(paste:)) {
|
|
216
|
-
|
|
216
|
+
id<RCTBackedTextInputDelegate> textInputDelegate = [_backedTextInputView textInputDelegate];
|
|
217
|
+
if (textInputDelegate != nil && ![textInputDelegate textInputShouldHandlePaste:_backedTextInputView]) {
|
|
218
|
+
commandHandled = YES;
|
|
219
|
+
} else {
|
|
220
|
+
_backedTextInputView.textWasPasted = YES;
|
|
221
|
+
}
|
|
217
222
|
//escape
|
|
218
223
|
} else if (commandSelector == @selector(cancelOperation:)) {
|
|
219
224
|
[textInputDelegate textInputDidCancel];
|
|
220
|
-
[
|
|
225
|
+
if (![textInputDelegate hasValidKeyDownOrValidKeyUp:@"Escape"]) {
|
|
226
|
+
[[_backedTextInputView window] makeFirstResponder:nil];
|
|
227
|
+
}
|
|
221
228
|
commandHandled = YES;
|
|
222
229
|
}
|
|
223
230
|
|
|
@@ -421,7 +428,9 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
421
428
|
//escape
|
|
422
429
|
} else if (commandSelector == @selector(cancelOperation:)) {
|
|
423
430
|
[textInputDelegate textInputDidCancel];
|
|
424
|
-
[
|
|
431
|
+
if (![textInputDelegate hasValidKeyDownOrValidKeyUp:@"Escape"]) {
|
|
432
|
+
[[_backedTextInputView window] makeFirstResponder:nil];
|
|
433
|
+
}
|
|
425
434
|
commandHandled = YES;
|
|
426
435
|
|
|
427
436
|
}
|
|
@@ -39,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
39
39
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange;
|
|
40
40
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onSelectionChange;
|
|
41
41
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onChange;
|
|
42
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onPaste; // TODO(OSS Candidate GH#774)
|
|
42
43
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onChangeSync;
|
|
43
44
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput;
|
|
44
45
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll;
|
|
@@ -46,8 +47,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
46
47
|
@property (nonatomic, copy, nullable) RCTBubblingEventBlock onAutoCorrectChange;
|
|
47
48
|
@property (nonatomic, copy, nullable) RCTBubblingEventBlock onSpellCheckChange;
|
|
48
49
|
@property (nonatomic, copy, nullable) RCTBubblingEventBlock onGrammarCheckChange;
|
|
50
|
+
@property (nonatomic, assign) BOOL clearTextOnSubmit;
|
|
51
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onSubmitEditing;
|
|
52
|
+
@property (nonatomic, copy) NSArray<NSDictionary *> *submitKeyEvents;
|
|
49
53
|
#endif // TODO(macOS GH#774)
|
|
50
|
-
|
|
51
54
|
@property (nonatomic, assign) NSInteger mostRecentEventCount;
|
|
52
55
|
@property (nonatomic, assign, readonly) NSInteger nativeEventCount;
|
|
53
56
|
@property (nonatomic, assign) BOOL autoFocus;
|
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
#import <React/RCTUtils.h>
|
|
15
15
|
#import <React/UIView+React.h>
|
|
16
16
|
|
|
17
|
+
#import <React/RCTViewKeyboardEvent.h> // TODO(macOS GH#774)
|
|
17
18
|
#import <React/RCTInputAccessoryView.h>
|
|
18
19
|
#import <React/RCTInputAccessoryViewContent.h>
|
|
19
20
|
#import <React/RCTTextAttributes.h>
|
|
20
21
|
#import <React/RCTTextSelection.h>
|
|
22
|
+
#import <React/RCTUITextView.h> // TODO(macOS GH#774)
|
|
21
23
|
#import "../RCTTextUIKit.h" // TODO(macOS GH#774)
|
|
22
24
|
|
|
23
25
|
@implementation RCTBaseTextInputView {
|
|
@@ -32,7 +34,7 @@
|
|
|
32
34
|
{
|
|
33
35
|
RCTAssertParam(bridge);
|
|
34
36
|
|
|
35
|
-
if (self = [super
|
|
37
|
+
if (self = [super initWithEventDispatcher:bridge.eventDispatcher]) { // TODO(OSS Candidate GH#774)
|
|
36
38
|
_bridge = bridge;
|
|
37
39
|
_eventDispatcher = bridge.eventDispatcher;
|
|
38
40
|
}
|
|
@@ -42,7 +44,6 @@
|
|
|
42
44
|
|
|
43
45
|
RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|
44
46
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder)
|
|
45
|
-
RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
46
47
|
|
|
47
48
|
- (RCTUIView<RCTBackedTextInputViewProtocol> *)backedTextInputView // TODO(macOS ISS#3536887)
|
|
48
49
|
{
|
|
@@ -429,6 +430,46 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
429
430
|
_onGrammarCheckChange(@{@"enabled": [NSNumber numberWithBool:enabled]});
|
|
430
431
|
}
|
|
431
432
|
}
|
|
433
|
+
|
|
434
|
+
- (void)submitOnKeyDownIfNeeded:(NSEvent *)event
|
|
435
|
+
{
|
|
436
|
+
NSDictionary *currentKeyboardEvent = [RCTViewKeyboardEvent bodyFromEvent:event];
|
|
437
|
+
// Enter is the default clearTextOnSubmit key
|
|
438
|
+
BOOL shouldSubmit = NO;
|
|
439
|
+
if (!_submitKeyEvents) {
|
|
440
|
+
shouldSubmit = [currentKeyboardEvent[@"key"] isEqualToString:@"Enter"]
|
|
441
|
+
&& ![currentKeyboardEvent[@"altKey"] boolValue]
|
|
442
|
+
&& ![currentKeyboardEvent[@"shiftKey"] boolValue]
|
|
443
|
+
&& ![currentKeyboardEvent[@"ctrlKey"] boolValue]
|
|
444
|
+
&& ![currentKeyboardEvent[@"metaKey"] boolValue]
|
|
445
|
+
&& ![currentKeyboardEvent[@"functionKey"] boolValue]; // Default clearTextOnSubmit key
|
|
446
|
+
} else {
|
|
447
|
+
for (NSDictionary *submitKeyEvent in _submitKeyEvents) {
|
|
448
|
+
if (
|
|
449
|
+
[submitKeyEvent[@"key"] isEqualToString:currentKeyboardEvent[@"key"]] &&
|
|
450
|
+
[submitKeyEvent[@"altKey"] boolValue] == [currentKeyboardEvent[@"altKey"] boolValue] &&
|
|
451
|
+
[submitKeyEvent[@"shiftKey"] boolValue] == [currentKeyboardEvent[@"shiftKey"] boolValue] &&
|
|
452
|
+
[submitKeyEvent[@"ctrlKey"] boolValue]== [currentKeyboardEvent[@"ctrlKey"] boolValue] &&
|
|
453
|
+
[submitKeyEvent[@"metaKey"] boolValue]== [currentKeyboardEvent[@"metaKey"] boolValue] &&
|
|
454
|
+
[submitKeyEvent[@"functionKey"] boolValue]== [currentKeyboardEvent[@"functionKey"] boolValue]
|
|
455
|
+
) {
|
|
456
|
+
shouldSubmit = YES;
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (shouldSubmit) {
|
|
463
|
+
if (_onSubmitEditing) {
|
|
464
|
+
_onSubmitEditing(@{});
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
if (_clearTextOnSubmit) {
|
|
468
|
+
self.backedTextInputView.attributedText = [NSAttributedString new];
|
|
469
|
+
[self.backedTextInputView.textInputDelegate textInputDidChange];
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
432
473
|
#endif // ]TODO(macOS GH#774)
|
|
433
474
|
|
|
434
475
|
- (BOOL)textInputShouldReturn
|
|
@@ -595,6 +636,35 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
595
636
|
return YES;
|
|
596
637
|
}
|
|
597
638
|
|
|
639
|
+
- (BOOL)hasValidKeyDownOrValidKeyUp:(NSString *)key {
|
|
640
|
+
return [self.validKeysDown containsObject:key] || [self.validKeysUp containsObject:key];
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
- (NSDragOperation)textInputDraggingEntered:(id<NSDraggingInfo>)draggingInfo
|
|
644
|
+
{
|
|
645
|
+
if ([draggingInfo.draggingPasteboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
646
|
+
return [self draggingEntered:draggingInfo];
|
|
647
|
+
}
|
|
648
|
+
return NSDragOperationNone;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
- (void)textInputDraggingExited:(id<NSDraggingInfo>)draggingInfo
|
|
652
|
+
{
|
|
653
|
+
if ([draggingInfo.draggingPasteboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
654
|
+
[self draggingExited:draggingInfo];
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
- (BOOL)textInputShouldHandleDragOperation:(id<NSDraggingInfo>)draggingInfo
|
|
659
|
+
{
|
|
660
|
+
if ([draggingInfo.draggingPasteboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
661
|
+
[self performDragOperation:draggingInfo];
|
|
662
|
+
return NO;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return YES;
|
|
666
|
+
}
|
|
667
|
+
|
|
598
668
|
- (void)textInputDidCancel {
|
|
599
669
|
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeKeyPress
|
|
600
670
|
reactTag:self.reactTag
|
|
@@ -603,6 +673,25 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
603
673
|
eventCount:_nativeEventCount];
|
|
604
674
|
[self textInputDidEndEditing];
|
|
605
675
|
}
|
|
676
|
+
|
|
677
|
+
- (BOOL)textInputShouldHandleKeyEvent:(NSEvent *)event {
|
|
678
|
+
return ![self handleKeyboardEvent:event];
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
- (BOOL)textInputShouldHandlePaste:(__unused id)sender
|
|
682
|
+
{
|
|
683
|
+
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
|
684
|
+
NSPasteboardType fileType = [pasteboard availableTypeFromArray:@[NSPasteboardTypeFileURL, NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
|
|
685
|
+
NSArray<NSPasteboardType>* pastedTypes = ((RCTUITextView*) self.backedTextInputView).readablePasteboardTypes;
|
|
686
|
+
|
|
687
|
+
// If there's a fileType that is of interest, notify JS. Also blocks notifying JS if it's a text paste
|
|
688
|
+
if (_onPaste && fileType != nil && [pastedTypes containsObject:fileType]) {
|
|
689
|
+
_onPaste([self dataTransferInfoFromPasteboard:pasteboard]);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// Only allow pasting text.
|
|
693
|
+
return fileType == nil;
|
|
694
|
+
}
|
|
606
695
|
#endif // ]TODO(macOS GH#774)
|
|
607
696
|
|
|
608
697
|
- (void)updateLocalData
|
|
@@ -71,12 +71,18 @@ RCT_EXPORT_VIEW_PROPERTY(passwordRules, NSString)
|
|
|
71
71
|
RCT_EXPORT_VIEW_PROPERTY(onAutoCorrectChange, RCTBubblingEventBlock);
|
|
72
72
|
RCT_EXPORT_VIEW_PROPERTY(onSpellCheckChange, RCTBubblingEventBlock);
|
|
73
73
|
RCT_EXPORT_VIEW_PROPERTY(onGrammarCheckChange, RCTBubblingEventBlock);
|
|
74
|
+
|
|
75
|
+
// Specifically for clearing text on enter key press
|
|
76
|
+
RCT_EXPORT_VIEW_PROPERTY(clearTextOnSubmit, BOOL);
|
|
77
|
+
RCT_EXPORT_VIEW_PROPERTY(onSubmitEditing, RCTBubblingEventBlock);
|
|
78
|
+
RCT_EXPORT_VIEW_PROPERTY(submitKeyEvents, NSArray<NSDictionary *>);
|
|
74
79
|
#endif // TODO(macOS GH#774)
|
|
75
80
|
|
|
76
81
|
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
77
82
|
RCT_EXPORT_VIEW_PROPERTY(onKeyPressSync, RCTDirectEventBlock)
|
|
78
83
|
RCT_EXPORT_VIEW_PROPERTY(onChangeSync, RCTDirectEventBlock)
|
|
79
84
|
RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock)
|
|
85
|
+
RCT_EXPORT_VIEW_PROPERTY(onPaste, RCTDirectEventBlock)
|
|
80
86
|
RCT_EXPORT_VIEW_PROPERTY(onTextInput, RCTDirectEventBlock)
|
|
81
87
|
RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock)
|
|
82
88
|
|
|
@@ -151,11 +151,27 @@
|
|
|
151
151
|
|
|
152
152
|
- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset
|
|
153
153
|
{
|
|
154
|
+
if (UIEdgeInsetsEqualToEdgeInsets(textContainerInset, _textContainerInset)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
154
158
|
_textContainerInset = textContainerInset;
|
|
155
159
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
156
160
|
[self setNeedsLayout];
|
|
157
161
|
#else // [TODO(macOS GH#774)
|
|
158
162
|
((RCTUITextFieldCell*)self.cell).textContainerInset = _textContainerInset;
|
|
163
|
+
|
|
164
|
+
if (self.currentEditor) {
|
|
165
|
+
NSRange selectedRange = self.currentEditor.selectedRange;
|
|
166
|
+
|
|
167
|
+
// Relocate the NSTextView without changing the selection.
|
|
168
|
+
[self.cell selectWithFrame:self.bounds
|
|
169
|
+
inView:self
|
|
170
|
+
editor:self.currentEditor
|
|
171
|
+
delegate:self
|
|
172
|
+
start:selectedRange.location
|
|
173
|
+
length:selectedRange.length];
|
|
174
|
+
}
|
|
159
175
|
#endif // ]TODO(macOS GH#774)
|
|
160
176
|
}
|
|
161
177
|
|
|
@@ -489,6 +505,17 @@
|
|
|
489
505
|
}
|
|
490
506
|
return isFirstResponder;
|
|
491
507
|
}
|
|
508
|
+
|
|
509
|
+
- (BOOL)performKeyEquivalent:(NSEvent *)event
|
|
510
|
+
{
|
|
511
|
+
// The currentEditor is NSText for historical reasons, but documented to be NSTextView.
|
|
512
|
+
NSTextView *currentEditor = (NSTextView *)self.currentEditor;
|
|
513
|
+
// The currentEditor is non-nil when focused and hasMarkedText means an IME is open.
|
|
514
|
+
if (currentEditor && !currentEditor.hasMarkedText && ![self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
515
|
+
return YES; // Don't send currentEditor the keydown event.
|
|
516
|
+
}
|
|
517
|
+
return [super performKeyEquivalent:event];
|
|
518
|
+
}
|
|
492
519
|
#endif // ]TODO(macOS GH#774)
|
|
493
520
|
|
|
494
521
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
@@ -570,6 +597,12 @@
|
|
|
570
597
|
[super deleteBackward];
|
|
571
598
|
}
|
|
572
599
|
}
|
|
600
|
+
#else
|
|
601
|
+
- (void)keyUp:(NSEvent *)event {
|
|
602
|
+
if ([self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
603
|
+
[super keyUp:event];
|
|
604
|
+
}
|
|
605
|
+
}
|
|
573
606
|
#endif // ]TODO(OSS Candidate ISS#2710739)
|
|
574
607
|
|
|
575
608
|
@end
|
package/React/Base/RCTConvert.m
CHANGED
|
@@ -1233,9 +1233,12 @@ RCT_JSON_ARRAY_CONVERTER(NSNumber)
|
|
|
1233
1233
|
}
|
|
1234
1234
|
|
|
1235
1235
|
if ([type isEqualToString:@"fileUrl"]) {
|
|
1236
|
-
return @[
|
|
1236
|
+
return @[NSPasteboardTypeFileURL];
|
|
1237
|
+
} else if ([type isEqualToString:@"image"]) {
|
|
1238
|
+
return @[NSPasteboardTypePNG, NSPasteboardTypeTIFF];
|
|
1239
|
+
} else if ([type isEqualToString:@"string"]) {
|
|
1240
|
+
return @[NSPasteboardTypeString];
|
|
1237
1241
|
}
|
|
1238
|
-
|
|
1239
1242
|
return @[];
|
|
1240
1243
|
}
|
|
1241
1244
|
|
|
@@ -1244,11 +1247,11 @@ RCT_JSON_ARRAY_CONVERTER(NSNumber)
|
|
|
1244
1247
|
if ([json isKindOfClass:[NSString class]]) {
|
|
1245
1248
|
return [RCTConvert NSPasteboardType:json];
|
|
1246
1249
|
} else if ([json isKindOfClass:[NSArray class]]) {
|
|
1247
|
-
NSMutableArray *
|
|
1250
|
+
NSMutableArray *mutablePasteboardTypes = [NSMutableArray new];
|
|
1248
1251
|
for (NSString *type in json) {
|
|
1249
|
-
[
|
|
1250
|
-
return mutablePastboardTypes.copy;
|
|
1252
|
+
[mutablePasteboardTypes addObjectsFromArray:[RCTConvert NSPasteboardType:type]];
|
|
1251
1253
|
}
|
|
1254
|
+
return mutablePasteboardTypes.copy;
|
|
1252
1255
|
}
|
|
1253
1256
|
return @[];
|
|
1254
1257
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
11
11
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
12
12
|
#endif // ]TODO(macOS GH#774)
|
|
13
|
+
#import <React/RCTUITextField.h> // TODO(macOS GH#774)
|
|
13
14
|
|
|
14
15
|
#import "RCTAssert.h"
|
|
15
16
|
#import "RCTBridge.h"
|
|
@@ -138,6 +139,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
|
|
|
138
139
|
_shouldSendMouseUpOnSystemBehalf = [(NSControl*)targetView isEnabled];
|
|
139
140
|
} else if ([targetView isKindOfClass:[NSText class]]) {
|
|
140
141
|
_shouldSendMouseUpOnSystemBehalf = [(NSText*)targetView isSelectable];
|
|
142
|
+
}
|
|
143
|
+
else if ([targetView.superview isKindOfClass:[RCTUITextField class]]) {
|
|
144
|
+
_shouldSendMouseUpOnSystemBehalf = [(RCTUITextField*)targetView.superview isSelectable];
|
|
141
145
|
} else {
|
|
142
146
|
_shouldSendMouseUpOnSystemBehalf = NO;
|
|
143
147
|
}
|
package/React/Base/RCTUtils.m
CHANGED
|
@@ -905,9 +905,12 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
|
|
|
905
905
|
}
|
|
906
906
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
907
907
|
image = [UIImage imageWithContentsOfFile:filePath];
|
|
908
|
-
#else // TODO(macOS GH#774)
|
|
909
|
-
|
|
910
|
-
|
|
908
|
+
#else // [TODO(macOS GH#774)
|
|
909
|
+
// macOS keeps file handles in open state for lifetime of image if "initWithContentsOfFile:" is used with path inside app bundle
|
|
910
|
+
// Workaround is to load file in data and then convert data to image
|
|
911
|
+
NSData *data = [NSData dataWithContentsOfFile:filePath];
|
|
912
|
+
image = [[NSImage alloc] initWithData:data];
|
|
913
|
+
#endif // ]TODO(macOS GH#774)
|
|
911
914
|
}
|
|
912
915
|
}
|
|
913
916
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -176,7 +176,7 @@ RCT_EXPORT_MODULE()
|
|
|
176
176
|
{
|
|
177
177
|
if (!_devMenuItem) {
|
|
178
178
|
__weak __typeof__(self) weakSelf = self;
|
|
179
|
-
__weak RCTDevSettings *devSettings = [self
|
|
179
|
+
__weak RCTDevSettings *devSettings = [[self bridge] devSettings]; // TODO(macOS GH#774)
|
|
180
180
|
if (devSettings.isPerfMonitorShown) {
|
|
181
181
|
[weakSelf show];
|
|
182
182
|
}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
#import "RCTActivityIndicatorView.h"
|
|
9
9
|
|
|
10
10
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
11
|
-
#import <
|
|
11
|
+
#import <CoreImage/CIFilter.h>
|
|
12
|
+
#import <CoreImage/CIVector.h>
|
|
12
13
|
|
|
13
14
|
@interface RCTActivityIndicatorView ()
|
|
14
15
|
@property (nonatomic, readwrite, getter=isAnimating) BOOL animating;
|
package/React/Views/RCTView.h
CHANGED
|
@@ -31,6 +31,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
31
31
|
- (BOOL)resignFirstResponder;
|
|
32
32
|
|
|
33
33
|
#if TARGET_OS_OSX
|
|
34
|
+
- (NSDictionary*)dataTransferInfoFromPasteboard:(NSPasteboard*)pasteboard;
|
|
34
35
|
- (BOOL)handleKeyboardEvent:(NSEvent *)event;
|
|
35
36
|
#endif
|
|
36
37
|
// ]TODO(OSS Candidate ISS#2710739)
|
package/React/Views/RCTView.m
CHANGED
|
@@ -779,6 +779,9 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
|
|
|
779
779
|
name:NSViewBoundsDidChangeNotification
|
|
780
780
|
object:[[self enclosingScrollView] contentView]];
|
|
781
781
|
}
|
|
782
|
+
|
|
783
|
+
[self reactViewDidMoveToWindow]; // TODO(macOS GH#1412)
|
|
784
|
+
|
|
782
785
|
[super viewDidMoveToWindow];
|
|
783
786
|
}
|
|
784
787
|
|
|
@@ -1524,13 +1527,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1524
1527
|
block(body);
|
|
1525
1528
|
}
|
|
1526
1529
|
|
|
1527
|
-
- (NSDictionary*)
|
|
1530
|
+
- (NSDictionary*)dataTransferInfoFromPasteboard:(NSPasteboard*)pasteboard
|
|
1528
1531
|
{
|
|
1529
|
-
|
|
1530
|
-
return @{};
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
NSArray *fileNames = [pastboard propertyListForType:NSFilenamesPboardType];
|
|
1532
|
+
NSArray *fileNames = [pasteboard propertyListForType:NSFilenamesPboardType] ?: @[];
|
|
1534
1533
|
NSMutableArray *files = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
1535
1534
|
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
1536
1535
|
NSMutableArray *types = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
@@ -1556,11 +1555,21 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1556
1555
|
BOOL success = [fileURL getResourceValue:&fileSizeValue
|
|
1557
1556
|
forKey:NSURLFileSizeKey
|
|
1558
1557
|
error:&fileSizeError];
|
|
1559
|
-
|
|
1558
|
+
|
|
1559
|
+
NSNumber *width = nil;
|
|
1560
|
+
NSNumber *height = nil;
|
|
1561
|
+
if ([MIMETypeString hasPrefix:@"image/"]) {
|
|
1562
|
+
NSImage *image = [[NSImage alloc] initWithContentsOfURL:fileURL];
|
|
1563
|
+
width = @(image.size.width);
|
|
1564
|
+
height = @(image.size.height);
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1560
1567
|
[files addObject:@{@"name": RCTNullIfNil(fileURL.lastPathComponent),
|
|
1561
1568
|
@"type": RCTNullIfNil(MIMETypeString),
|
|
1562
|
-
@"uri": RCTNullIfNil(fileURL.
|
|
1563
|
-
@"size": success ? fileSizeValue : (id)kCFNull
|
|
1569
|
+
@"uri": RCTNullIfNil(fileURL.path),
|
|
1570
|
+
@"size": success ? fileSizeValue : (id)kCFNull,
|
|
1571
|
+
@"width": RCTNullIfNil(width),
|
|
1572
|
+
@"height": RCTNullIfNil(height)
|
|
1564
1573
|
}];
|
|
1565
1574
|
|
|
1566
1575
|
[items addObject:@{@"kind": @"file",
|
|
@@ -1570,7 +1579,27 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1570
1579
|
[types addObject:RCTNullIfNil(MIMETypeString)];
|
|
1571
1580
|
}
|
|
1572
1581
|
}
|
|
1573
|
-
|
|
1582
|
+
|
|
1583
|
+
NSPasteboardType imageType = [pasteboard availableTypeFromArray:@[NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
|
|
1584
|
+
if (imageType && fileNames.count == 0) {
|
|
1585
|
+
NSString *MIMETypeString = imageType == NSPasteboardTypePNG ? @"image/png" : @"image/tiff";
|
|
1586
|
+
NSData *imageData = [pasteboard dataForType:imageType];
|
|
1587
|
+
NSImage *image = [[NSImage alloc] initWithData:imageData];
|
|
1588
|
+
|
|
1589
|
+
[files addObject:@{@"type": RCTNullIfNil(MIMETypeString),
|
|
1590
|
+
@"uri": RCTDataURL(MIMETypeString, imageData).absoluteString,
|
|
1591
|
+
@"size": @(imageData.length),
|
|
1592
|
+
@"width": @(image.size.width),
|
|
1593
|
+
@"height": @(image.size.height),
|
|
1594
|
+
}];
|
|
1595
|
+
|
|
1596
|
+
[items addObject:@{@"kind": @"image",
|
|
1597
|
+
@"type": RCTNullIfNil(MIMETypeString),
|
|
1598
|
+
}];
|
|
1599
|
+
|
|
1600
|
+
[types addObject:RCTNullIfNil(MIMETypeString)];
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1574
1603
|
return @{@"dataTransfer": @{@"files": files,
|
|
1575
1604
|
@"items": items,
|
|
1576
1605
|
@"types": types}};
|
|
@@ -1595,9 +1624,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1595
1624
|
[self sendMouseEventWithBlock:self.onDragEnter
|
|
1596
1625
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1597
1626
|
modifierFlags:0
|
|
1598
|
-
additionalData:[self
|
|
1599
|
-
|
|
1600
|
-
if ([pboard
|
|
1627
|
+
additionalData:[self dataTransferInfoFromPasteboard:pboard]];
|
|
1628
|
+
|
|
1629
|
+
if ([pboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
1601
1630
|
if (sourceDragMask & NSDragOperationLink) {
|
|
1602
1631
|
return NSDragOperationLink;
|
|
1603
1632
|
} else if (sourceDragMask & NSDragOperationCopy) {
|
|
@@ -1612,7 +1641,7 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1612
1641
|
[self sendMouseEventWithBlock:self.onDragLeave
|
|
1613
1642
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1614
1643
|
modifierFlags:0
|
|
1615
|
-
additionalData:[self
|
|
1644
|
+
additionalData:[self dataTransferInfoFromPasteboard:sender.draggingPasteboard]];
|
|
1616
1645
|
}
|
|
1617
1646
|
|
|
1618
1647
|
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
|
@@ -1620,7 +1649,7 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1620
1649
|
[self sendMouseEventWithBlock:self.onDrop
|
|
1621
1650
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1622
1651
|
modifierFlags:0
|
|
1623
|
-
additionalData:[self
|
|
1652
|
+
additionalData:[self dataTransferInfoFromPasteboard:sender.draggingPasteboard]];
|
|
1624
1653
|
return YES;
|
|
1625
1654
|
}
|
|
1626
1655
|
#endif // ]TODO(macOS GH#774)
|
|
@@ -197,7 +197,7 @@ RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat)
|
|
|
197
197
|
RCT_REMAP_VIEW_PROPERTY(opacity, alphaValue, CGFloat)
|
|
198
198
|
#endif // ]TODO(macOS GH#774)
|
|
199
199
|
|
|
200
|
-
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
200
|
+
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
201
201
|
RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor)
|
|
202
202
|
RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize)
|
|
203
203
|
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
#import "RCTScrollView.h"
|
|
19
19
|
|
|
20
20
|
@implementation RCTScrollContentView
|
|
21
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
22
|
+
- (BOOL)isFlipped
|
|
23
|
+
{
|
|
24
|
+
return !self.inverted;
|
|
25
|
+
}
|
|
26
|
+
#endif // ]TODO(macOS GH#774)
|
|
21
27
|
|
|
22
28
|
- (void)reactSetFrame:(CGRect)frame
|
|
23
29
|
{
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd;
|
|
68
68
|
@property (nonatomic, copy) RCTDirectEventBlock onPreferredScrollerStyleDidChange; // TODO(macOS GH#774)
|
|
69
69
|
|
|
70
|
+
@property (nonatomic, copy) RCTDirectEventBlock onInvertedDidChange; // TODO(macOS GH#774)
|
|
71
|
+
|
|
70
72
|
- (void)flashScrollIndicators; // TODO(macOS GH#774)
|
|
71
73
|
|
|
72
74
|
@end
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
@property (nonatomic, assign) BOOL pinchGestureEnabled;
|
|
46
46
|
#else // [TODO(macOS GH#774)
|
|
47
47
|
+ (BOOL)isCompatibleWithResponsiveScrolling;
|
|
48
|
+
@property (nonatomic, assign, getter=isInverted) BOOL inverted;
|
|
48
49
|
@property (nonatomic, assign, getter=isScrollEnabled) BOOL scrollEnabled;
|
|
49
50
|
@property (nonatomic, strong) NSPanGestureRecognizer *panGestureRecognizer;
|
|
50
51
|
#endif // ]TODO(macOS GH#774)
|
|
@@ -108,6 +109,11 @@
|
|
|
108
109
|
return YES;
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
- (BOOL)isFlipped
|
|
113
|
+
{
|
|
114
|
+
return !self.inverted;
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
- (void)scrollWheel:(NSEvent *)theEvent
|
|
112
118
|
{
|
|
113
119
|
if (!self.scrollEnabled) {
|
|
@@ -556,6 +562,15 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
556
562
|
{
|
|
557
563
|
[_scrollView setAccessibilityRole:accessibilityRole];
|
|
558
564
|
}
|
|
565
|
+
|
|
566
|
+
- (void)setInverted:(BOOL)inverted
|
|
567
|
+
{
|
|
568
|
+
BOOL changed = _inverted != inverted;
|
|
569
|
+
_inverted = inverted;
|
|
570
|
+
if (changed && _onInvertedDidChange) {
|
|
571
|
+
_onInvertedDidChange(@{});
|
|
572
|
+
}
|
|
573
|
+
}
|
|
559
574
|
#endif // ]TODO(macOS GH#774)
|
|
560
575
|
|
|
561
576
|
RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
|
|
@@ -99,6 +99,7 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollToTop, RCTDirectEventBlock)
|
|
|
99
99
|
RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock)
|
|
100
100
|
RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollBegin, RCTDirectEventBlock)
|
|
101
101
|
RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollEnd, RCTDirectEventBlock)
|
|
102
|
+
RCT_EXPORT_OSX_VIEW_PROPERTY(onInvertedDidChange, RCTDirectEventBlock) // TODO(macOS GH#774)
|
|
102
103
|
RCT_EXPORT_OSX_VIEW_PROPERTY(onPreferredScrollerStyleDidChange, RCTDirectEventBlock) // TODO(macOS GH#774)
|
|
103
104
|
RCT_EXPORT_VIEW_PROPERTY(inverted, BOOL)
|
|
104
105
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
|
|
@@ -267,18 +267,17 @@
|
|
|
267
267
|
}
|
|
268
268
|
#endif // TODO(macOS GH#774)
|
|
269
269
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
*/
|
|
273
|
-
- (BOOL)reactIsFocusNeeded
|
|
270
|
+
// [TODO(macOS GH#1412)
|
|
271
|
+
- (void)reactViewDidMoveToWindow
|
|
274
272
|
{
|
|
275
|
-
|
|
273
|
+
[self reactFocusIfNeeded];
|
|
276
274
|
}
|
|
275
|
+
// TODO(macOS GH#1412)]
|
|
277
276
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Focus manipulation.
|
|
279
|
+
*/
|
|
280
|
+
static __weak RCTPlatformView *_pendingFocusView; // TODO(macOS GH#1412)
|
|
282
281
|
|
|
283
282
|
- (void)reactFocus
|
|
284
283
|
{
|
|
@@ -287,19 +286,23 @@
|
|
|
287
286
|
#else
|
|
288
287
|
if (![self becomeFirstResponder]) {
|
|
289
288
|
#endif // TODO(macOS GH#774)]
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
// [TODO(macOS GH#1412)
|
|
290
|
+
_pendingFocusView = self;
|
|
291
|
+
} else {
|
|
292
|
+
_pendingFocusView = nil;
|
|
293
|
+
}
|
|
294
|
+
// TODO(macOS GH#1412)]
|
|
292
295
|
}
|
|
293
296
|
|
|
294
297
|
- (void)reactFocusIfNeeded
|
|
295
298
|
{
|
|
296
|
-
if (self
|
|
299
|
+
if ([self isEqual:_pendingFocusView]) { // TODO(macOS GH#1412)
|
|
297
300
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
298
301
|
if ([[self window] makeFirstResponder:self]) {
|
|
299
302
|
#else
|
|
300
303
|
if ([self becomeFirstResponder]) {
|
|
301
304
|
#endif // TODO(macOS GH#774)]
|
|
302
|
-
|
|
305
|
+
_pendingFocusView = nil; // TODO(macOS GH#1412)
|
|
303
306
|
}
|
|
304
307
|
}
|
|
305
308
|
}
|
|
@@ -313,6 +316,12 @@
|
|
|
313
316
|
#else
|
|
314
317
|
[self resignFirstResponder];
|
|
315
318
|
#endif // TODO(macOS GH#774)]
|
|
319
|
+
|
|
320
|
+
// [TODO(macOS GH#1412)
|
|
321
|
+
if ([self isEqual:_pendingFocusView]) {
|
|
322
|
+
_pendingFocusView = nil;
|
|
323
|
+
}
|
|
324
|
+
// TODO(macOS GH#1412)]
|
|
316
325
|
}
|
|
317
326
|
|
|
318
327
|
#pragma mark - Layout
|
package/package.json
CHANGED
|
@@ -79,9 +79,6 @@ def use_react_native! (options={})
|
|
|
79
79
|
pod 'boost', :podspec => "#{prefix}/third-party-podspecs/boost.podspec"
|
|
80
80
|
pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec"
|
|
81
81
|
|
|
82
|
-
# TODO(macOS GH#214)
|
|
83
|
-
pod 'boost-for-react-native', :podspec => "#{prefix}/third-party-podspecs/boost-for-react-native.podspec"
|
|
84
|
-
|
|
85
82
|
if ENV['USE_CODEGEN_DISCOVERY'] == '1'
|
|
86
83
|
app_path = options[:app_path]
|
|
87
84
|
config_file_dir = options[:config_file_dir]
|
package/template/Gemfile.lock
CHANGED
|
@@ -3,7 +3,7 @@ GEM
|
|
|
3
3
|
specs:
|
|
4
4
|
CFPropertyList (3.0.5)
|
|
5
5
|
rexml
|
|
6
|
-
activesupport (6.1.
|
|
6
|
+
activesupport (6.1.7)
|
|
7
7
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
8
8
|
i18n (>= 1.6, < 2)
|
|
9
9
|
minitest (>= 5.1)
|
|
@@ -97,4 +97,4 @@ RUBY VERSION
|
|
|
97
97
|
ruby 3.0.4p208
|
|
98
98
|
|
|
99
99
|
BUNDLED WITH
|
|
100
|
-
2.3.
|
|
100
|
+
2.3.22
|
package/template/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# TODO(macOS GH#214)
|
|
2
|
-
Pod::Spec.new do |spec|
|
|
3
|
-
spec.name = 'boost-for-react-native'
|
|
4
|
-
spec.version = '1.63.0'
|
|
5
|
-
spec.license = { :type => 'Boost Software License', :file => "LICENSE_1_0.txt" }
|
|
6
|
-
spec.homepage = 'http://www.boost.org'
|
|
7
|
-
spec.summary = 'Boost provides free peer-reviewed portable C++ source libraries.'
|
|
8
|
-
spec.authors = 'Rene Rivera'
|
|
9
|
-
spec.source = { :git => 'https://github.com/react-native-community/boost-for-react-native.git',
|
|
10
|
-
:tag => 'v1.63.0-0' }
|
|
11
|
-
|
|
12
|
-
# Pinning to the same version as React.podspec.
|
|
13
|
-
# TODO: Move this osx addition back upstream to https://github.com/react-native-community/boost-for-react-native
|
|
14
|
-
spec.platforms = { :ios => '8.0', :osx => "10.15" }
|
|
15
|
-
spec.requires_arc = false
|
|
16
|
-
|
|
17
|
-
spec.module_name = 'boost'
|
|
18
|
-
spec.header_dir = 'boost'
|
|
19
|
-
spec.preserve_path = 'boost'
|
|
20
|
-
end
|