react-native-macos 0.0.0-a22ed3cc5 → 0.0.0-a4ade0a52
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/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +2 -3
- package/Libraries/Alert/Alert.js +2 -2
- package/Libraries/Alert/RCTAlertManager.android.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +53 -53
- package/Libraries/Animated/AnimatedMock.js +8 -8
- package/Libraries/Animated/NativeAnimatedHelper.js +23 -20
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedNode.js +10 -9
- package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
- package/Libraries/AppState/AppState.js +8 -7
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +22 -20
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -2
- package/Libraries/Components/Button.js +1 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +6 -7
- package/Libraries/Components/Keyboard/Keyboard.js +8 -7
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +5 -10
- package/Libraries/Components/Pressable/Pressable.js +1 -2
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +2 -1
- package/Libraries/Components/RefreshControl/RefreshControl.js +2 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +2 -2
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -5
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +3 -5
- package/Libraries/Components/ScrollView/ScrollView.js +27 -59
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +5 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -2
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +2 -8
- package/Libraries/Components/Sound/SoundManager.js +1 -1
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -2
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +3 -5
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +3 -5
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.js +59 -11
- package/Libraries/Components/ToastAndroid/ToastAndroid.android.js +3 -3
- package/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +3 -3
- package/Libraries/Components/Touchable/BoundingDimensions.js +2 -2
- package/Libraries/Components/Touchable/PooledClass.js +6 -6
- package/Libraries/Components/Touchable/Position.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +26 -25
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -2
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -2
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +4 -11
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewViewConfig.js +1 -0
- package/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +3 -3
- package/Libraries/Components/View/View.js +0 -7
- package/Libraries/Components/View/ViewNativeComponent.js +3 -4
- package/Libraries/Core/Devtools/parseHermesStack.js +2 -1
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/NativeExceptionsManager.js +2 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/Timers/JSTimers.js +17 -13
- package/Libraries/Core/setUpAlert.js +1 -1
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpPerformance.js +1 -1
- package/Libraries/Core/setUpRegeneratorRuntime.js +1 -1
- package/Libraries/Core/setUpSegmentFetcher.js +4 -4
- package/Libraries/EventEmitter/NativeEventEmitter.js +2 -1
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +2 -1
- package/Libraries/HeapCapture/HeapCapture.js +1 -1
- package/Libraries/Image/AssetSourceResolver.js +2 -4
- package/Libraries/Image/Image.android.js +4 -4
- package/Libraries/Image/Image.ios.js +3 -3
- package/Libraries/Image/ImageAnalyticsTagContext.js +2 -3
- package/Libraries/Image/ImageBackground.js +1 -2
- package/Libraries/Image/ImagePickerIOS.js +6 -6
- package/Libraries/Image/ImageViewNativeComponent.js +2 -4
- package/Libraries/Image/NativeImageLoaderAndroid.js +1 -3
- package/Libraries/Image/RCTImageCache.m +1 -1
- package/Libraries/Image/TextInlineImageNativeComponent.js +3 -5
- package/Libraries/Inspector/ElementProperties.js +2 -4
- package/Libraries/Inspector/InspectorOverlay.js +1 -2
- package/Libraries/Inspector/InspectorPanel.js +1 -2
- package/Libraries/Inspector/NetworkOverlay.js +5 -11
- package/Libraries/Interaction/BridgeSpyStallHandler.js +1 -1
- package/Libraries/Interaction/FrameRateLogger.js +2 -2
- package/Libraries/Interaction/InteractionManager.js +2 -4
- package/Libraries/Interaction/JSEventLoopWatchdog.js +4 -4
- package/Libraries/Interaction/PanResponder.js +3 -4
- package/Libraries/Interaction/TouchHistoryMath.js +7 -7
- package/Libraries/JSInspector/NetworkAgent.js +1 -6
- package/Libraries/LayoutAnimation/LayoutAnimation.js +3 -3
- package/Libraries/LinkingIOS/RCTLinkingManager.h +1 -0
- package/Libraries/LinkingIOS/macos/RCTLinkingManager.mm +12 -5
- package/Libraries/Lists/FillRateHelper.js +1 -3
- package/Libraries/Lists/FlatList.js +17 -4
- package/Libraries/Lists/ViewabilityHelper.js +4 -10
- package/Libraries/Lists/VirtualizeUtils.js +2 -6
- package/Libraries/Lists/VirtualizedList.js +102 -78
- package/Libraries/Lists/VirtualizedListContext.js +3 -5
- package/Libraries/Lists/VirtualizedSectionList.js +54 -63
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +12 -23
- package/Libraries/LogBox/UI/LogBoxButton.js +2 -4
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +2 -4
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -2
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +3 -6
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -2
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -4
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +2 -4
- package/Libraries/LogBox/UI/LogBoxNotification.js +2 -4
- package/Libraries/Modal/Modal.js +2 -4
- package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -4
- package/Libraries/Network/XHRInterceptor.js +5 -6
- package/Libraries/NewAppScreen/components/Header.js +2 -4
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -2
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +2 -4
- package/Libraries/Performance/SamplingProfiler.js +3 -3
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -3
- package/Libraries/Pressability/Pressability.js +2 -2
- package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +4 -2
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +8 -7
- package/Libraries/ReactNative/AppContainer.js +4 -6
- package/Libraries/ReactNative/AppRegistry.js +2 -3
- package/Libraries/ReactNative/I18nManager.js +2 -5
- package/Libraries/ReactNative/PaperUIManager.js +2 -3
- package/Libraries/ReactNative/RootTag.js +2 -3
- package/Libraries/ReactNative/renderApplication.js +1 -2
- package/Libraries/Storage/AsyncStorage.js +21 -21
- package/Libraries/StyleSheet/StyleSheet.js +2 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +26 -1
- package/Libraries/StyleSheet/processColor.js +2 -2
- package/Libraries/StyleSheet/splitLayoutProps.js +1 -3
- package/Libraries/Text/RCTTextAttributes.m +20 -13
- package/Libraries/Text/Text.js +2 -1
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +13 -1
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +36 -5
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +6 -0
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +8 -0
- package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +12 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.h +5 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +37 -2
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +9 -2
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +4 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.h +2 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +35 -2
- package/Libraries/Text/TextNativeComponent.js +3 -5
- package/Libraries/Utilities/Appearance.js +8 -5
- package/Libraries/Utilities/BackHandler.android.js +4 -4
- package/Libraries/Utilities/HMRClient.js +2 -2
- package/Libraries/Utilities/JSDevSupportModule.js +3 -4
- package/Libraries/Utilities/MatrixMath.js +19 -19
- package/Libraries/Utilities/PerformanceLoggerContext.js +2 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +2 -4
- package/Libraries/Utilities/SceneTracker.js +1 -3
- package/Libraries/Utilities/__mocks__/BackHandler.js +3 -3
- package/Libraries/Utilities/buildStyleInterpolator.js +9 -9
- package/Libraries/Utilities/codegenNativeComponent.js +4 -2
- package/Libraries/Utilities/differ/deepDiffer.js +1 -1
- package/Libraries/Utilities/differ/insetsDiffer.js +1 -1
- package/Libraries/Utilities/differ/matricesDiffer.js +1 -1
- package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
- package/Libraries/Utilities/differ/sizesDiffer.js +1 -1
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/mergeIntoFast.js +1 -1
- package/Libraries/Utilities/truncate.js +1 -1
- package/Libraries/Vibration/Vibration.js +2 -2
- package/Libraries/WebSocket/WebSocketInterceptor.js +4 -4
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/Libraries/vendor/emitter/_EmitterSubscription.js +2 -1
- package/Libraries/vendor/emitter/_EventEmitter.js +2 -1
- package/Libraries/vendor/emitter/_EventSubscription.js +2 -1
- package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +1 -1
- package/React/Base/RCTConvert.m +1 -0
- package/React/Base/RCTRootView.m +0 -51
- package/React/Base/RCTTouchHandler.m +11 -1
- package/React/Base/RCTUIKit.h +2 -0
- package/React/Base/RCTUtils.m +27 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTPlatformDisplayLink.m +3 -1
- package/React/Base/macOS/RCTUIKit.m +20 -0
- package/React/CoreModules/RCTAppearance.mm +21 -5
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/Fabric/RCTImageResponseObserverProxy.h +1 -0
- package/React/Modules/RCTUIManager.m +33 -13
- package/React/Views/RCTCursor.h +39 -0
- package/React/Views/RCTCursor.m +105 -0
- package/React/Views/RCTView.h +15 -0
- package/React/Views/RCTView.m +91 -172
- package/React/Views/RCTViewKeyboardEvent.h +6 -28
- package/React/Views/RCTViewKeyboardEvent.m +58 -61
- package/React/Views/RCTViewManager.m +15 -0
- package/React/Views/ScrollView/RCTScrollContentView.m +12 -0
- package/React/Views/ScrollView/RCTScrollView.m +41 -21
- package/React/Views/UIView+React.m +18 -10
- package/ReactAndroid/build.gradle +2 -1
- package/ReactAndroid/gradle.properties +2 -1
- package/ReactAndroid/src/androidTest/js/AnimatedTransformTestModule.js +1 -2
- package/ReactAndroid/src/androidTest/js/Asserts.js +2 -2
- package/ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js +1 -1
- package/ReactAndroid/src/androidTest/js/JSResponderTestApp.js +1 -2
- package/ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js +1 -2
- package/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js +54 -54
- package/ReactAndroid/src/androidTest/js/ProgressBarTestModule.js +1 -1
- package/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js +6 -7
- package/ReactAndroid/src/androidTest/js/ShareTestModule.js +1 -1
- package/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js +12 -19
- package/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js +2 -3
- package/ReactAndroid/src/androidTest/js/TestJSLocaleModule.js +2 -2
- package/ReactAndroid/src/androidTest/js/TestJSToJavaParametersModule.js +17 -17
- package/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js +10 -10
- package/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js +2 -2
- package/ReactAndroid/src/androidTest/js/TextInputTestModule.js +2 -3
- package/ReactAndroid/src/androidTest/js/TouchBubblingTestAppModule.js +3 -6
- package/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +3 -6
- package/ReactAndroid/src/androidTest/js/ViewRenderingTestModule.js +5 -5
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/third-party/android/androidx/BUCK +16 -4
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/hermes/inspector/tools/msggen/package.json +1 -1
- package/ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js +1 -1
- package/ReactCommon/hermes/inspector/tools/msggen/src/index.js +1 -1
- package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +346 -1294
- package/jest/assetFileTransformer.js +2 -2
- package/jest/preprocessor.js +2 -2
- package/jest/setup.js +3 -3
- package/package.json +26 -27
- package/template/App.js +4 -8
- package/template/Gemfile.lock +8 -8
- package/template/android/gradlew.bat +89 -89
- package/template/ios/HelloWorldTests/HelloWorldTests.m +1 -0
- package/template/package.json +1 -1
- package/Libraries/Types/RootTagTypes.js~merged +0 -23
|
@@ -47,13 +47,13 @@ const AsyncStorage = {
|
|
|
47
47
|
*
|
|
48
48
|
* See https://reactnative.dev/docs/asyncstorage#getitem
|
|
49
49
|
*/
|
|
50
|
-
getItem: function(
|
|
50
|
+
getItem: function (
|
|
51
51
|
key: string,
|
|
52
52
|
callback?: ?(error: ?Error, result: ?string) => void,
|
|
53
53
|
): Promise<?string> {
|
|
54
54
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
55
55
|
return new Promise((resolve, reject) => {
|
|
56
|
-
RCTAsyncStorage.multiGet([key], function(errors, result) {
|
|
56
|
+
RCTAsyncStorage.multiGet([key], function (errors, result) {
|
|
57
57
|
// Unpack result to get value from [[key,value]]
|
|
58
58
|
const value = result && result[0] && result[0][1] ? result[0][1] : null;
|
|
59
59
|
const errs = convertErrors(errors);
|
|
@@ -72,14 +72,14 @@ const AsyncStorage = {
|
|
|
72
72
|
*
|
|
73
73
|
* See https://reactnative.dev/docs/asyncstorage#setitem
|
|
74
74
|
*/
|
|
75
|
-
setItem: function(
|
|
75
|
+
setItem: function (
|
|
76
76
|
key: string,
|
|
77
77
|
value: string,
|
|
78
78
|
callback?: ?(error: ?Error) => void,
|
|
79
79
|
): Promise<void> {
|
|
80
80
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
81
81
|
return new Promise((resolve, reject) => {
|
|
82
|
-
RCTAsyncStorage.multiSet([[key, value]], function(errors) {
|
|
82
|
+
RCTAsyncStorage.multiSet([[key, value]], function (errors) {
|
|
83
83
|
const errs = convertErrors(errors);
|
|
84
84
|
callback && callback(errs && errs[0]);
|
|
85
85
|
if (errs) {
|
|
@@ -96,13 +96,13 @@ const AsyncStorage = {
|
|
|
96
96
|
*
|
|
97
97
|
* See https://reactnative.dev/docs/asyncstorage#removeitem
|
|
98
98
|
*/
|
|
99
|
-
removeItem: function(
|
|
99
|
+
removeItem: function (
|
|
100
100
|
key: string,
|
|
101
101
|
callback?: ?(error: ?Error) => void,
|
|
102
102
|
): Promise<void> {
|
|
103
103
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
104
104
|
return new Promise((resolve, reject) => {
|
|
105
|
-
RCTAsyncStorage.multiRemove([key], function(errors) {
|
|
105
|
+
RCTAsyncStorage.multiRemove([key], function (errors) {
|
|
106
106
|
const errs = convertErrors(errors);
|
|
107
107
|
callback && callback(errs && errs[0]);
|
|
108
108
|
if (errs) {
|
|
@@ -122,14 +122,14 @@ const AsyncStorage = {
|
|
|
122
122
|
*
|
|
123
123
|
* See https://reactnative.dev/docs/asyncstorage#mergeitem
|
|
124
124
|
*/
|
|
125
|
-
mergeItem: function(
|
|
125
|
+
mergeItem: function (
|
|
126
126
|
key: string,
|
|
127
127
|
value: string,
|
|
128
128
|
callback?: ?(error: ?Error) => void,
|
|
129
129
|
): Promise<void> {
|
|
130
130
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
131
131
|
return new Promise((resolve, reject) => {
|
|
132
|
-
RCTAsyncStorage.multiMerge([[key, value]], function(errors) {
|
|
132
|
+
RCTAsyncStorage.multiMerge([[key, value]], function (errors) {
|
|
133
133
|
const errs = convertErrors(errors);
|
|
134
134
|
callback && callback(errs && errs[0]);
|
|
135
135
|
if (errs) {
|
|
@@ -148,10 +148,10 @@ const AsyncStorage = {
|
|
|
148
148
|
*
|
|
149
149
|
* See https://reactnative.dev/docs/asyncstorage#clear
|
|
150
150
|
*/
|
|
151
|
-
clear: function(callback?: ?(error: ?Error) => void): Promise<void> {
|
|
151
|
+
clear: function (callback?: ?(error: ?Error) => void): Promise<void> {
|
|
152
152
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
153
153
|
return new Promise((resolve, reject) => {
|
|
154
|
-
RCTAsyncStorage.clear(function(error) {
|
|
154
|
+
RCTAsyncStorage.clear(function (error) {
|
|
155
155
|
callback && callback(convertError(error));
|
|
156
156
|
if (error && convertError(error)) {
|
|
157
157
|
reject(convertError(error));
|
|
@@ -167,12 +167,12 @@ const AsyncStorage = {
|
|
|
167
167
|
*
|
|
168
168
|
* See https://reactnative.dev/docs/asyncstorage#getallkeys
|
|
169
169
|
*/
|
|
170
|
-
getAllKeys: function(
|
|
170
|
+
getAllKeys: function (
|
|
171
171
|
callback?: ?(error: ?Error, keys: ?Array<string>) => void,
|
|
172
172
|
): Promise<?Array<string>> {
|
|
173
173
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
174
174
|
return new Promise((resolve, reject) => {
|
|
175
|
-
RCTAsyncStorage.getAllKeys(function(error, keys) {
|
|
175
|
+
RCTAsyncStorage.getAllKeys(function (error, keys) {
|
|
176
176
|
callback && callback(convertError(error), keys);
|
|
177
177
|
if (error) {
|
|
178
178
|
reject(convertError(error));
|
|
@@ -198,7 +198,7 @@ const AsyncStorage = {
|
|
|
198
198
|
*
|
|
199
199
|
* See https://reactnative.dev/docs/asyncstorage#flushgetrequests
|
|
200
200
|
* */
|
|
201
|
-
flushGetRequests: function(): void {
|
|
201
|
+
flushGetRequests: function (): void {
|
|
202
202
|
const getRequests = this._getRequests;
|
|
203
203
|
const getKeys = this._getKeys;
|
|
204
204
|
|
|
@@ -206,7 +206,7 @@ const AsyncStorage = {
|
|
|
206
206
|
this._getKeys = [];
|
|
207
207
|
|
|
208
208
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
209
|
-
RCTAsyncStorage.multiGet(getKeys, function(errors, result) {
|
|
209
|
+
RCTAsyncStorage.multiGet(getKeys, function (errors, result) {
|
|
210
210
|
// Even though the runtime complexity of this is theoretically worse vs if we used a map,
|
|
211
211
|
// it's much, much faster in practice for the data sets we deal with (we avoid
|
|
212
212
|
// allocating result pair arrays). This was heavily benchmarked.
|
|
@@ -237,7 +237,7 @@ const AsyncStorage = {
|
|
|
237
237
|
*
|
|
238
238
|
* See https://reactnative.dev/docs/asyncstorage#multiget
|
|
239
239
|
*/
|
|
240
|
-
multiGet: function(
|
|
240
|
+
multiGet: function (
|
|
241
241
|
keys: Array<string>,
|
|
242
242
|
callback?: ?(errors: ?Array<Error>, result: ?Array<Array<string>>) => void,
|
|
243
243
|
): Promise<?Array<Array<string>>> {
|
|
@@ -272,13 +272,13 @@ const AsyncStorage = {
|
|
|
272
272
|
*
|
|
273
273
|
* See https://reactnative.dev/docs/asyncstorage#multiset
|
|
274
274
|
*/
|
|
275
|
-
multiSet: function(
|
|
275
|
+
multiSet: function (
|
|
276
276
|
keyValuePairs: Array<Array<string>>,
|
|
277
277
|
callback?: ?(errors: ?Array<Error>) => void,
|
|
278
278
|
): Promise<void> {
|
|
279
279
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
280
280
|
return new Promise((resolve, reject) => {
|
|
281
|
-
RCTAsyncStorage.multiSet(keyValuePairs, function(errors) {
|
|
281
|
+
RCTAsyncStorage.multiSet(keyValuePairs, function (errors) {
|
|
282
282
|
const error = convertErrors(errors);
|
|
283
283
|
callback && callback(error);
|
|
284
284
|
if (error) {
|
|
@@ -295,13 +295,13 @@ const AsyncStorage = {
|
|
|
295
295
|
*
|
|
296
296
|
* See https://reactnative.dev/docs/asyncstorage#multiremove
|
|
297
297
|
*/
|
|
298
|
-
multiRemove: function(
|
|
298
|
+
multiRemove: function (
|
|
299
299
|
keys: Array<string>,
|
|
300
300
|
callback?: ?(errors: ?Array<Error>) => void,
|
|
301
301
|
): Promise<void> {
|
|
302
302
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
303
303
|
return new Promise((resolve, reject) => {
|
|
304
|
-
RCTAsyncStorage.multiRemove(keys, function(errors) {
|
|
304
|
+
RCTAsyncStorage.multiRemove(keys, function (errors) {
|
|
305
305
|
const error = convertErrors(errors);
|
|
306
306
|
callback && callback(error);
|
|
307
307
|
if (error) {
|
|
@@ -321,13 +321,13 @@ const AsyncStorage = {
|
|
|
321
321
|
*
|
|
322
322
|
* See https://reactnative.dev/docs/asyncstorage#multimerge
|
|
323
323
|
*/
|
|
324
|
-
multiMerge: function(
|
|
324
|
+
multiMerge: function (
|
|
325
325
|
keyValuePairs: Array<Array<string>>,
|
|
326
326
|
callback?: ?(errors: ?Array<Error>) => void,
|
|
327
327
|
): Promise<void> {
|
|
328
328
|
invariant(RCTAsyncStorage, 'RCTAsyncStorage not available');
|
|
329
329
|
return new Promise((resolve, reject) => {
|
|
330
|
-
RCTAsyncStorage.multiMerge(keyValuePairs, function(errors) {
|
|
330
|
+
RCTAsyncStorage.multiMerge(keyValuePairs, function (errors) {
|
|
331
331
|
const error = convertErrors(errors);
|
|
332
332
|
callback && callback(error);
|
|
333
333
|
if (error) {
|
|
@@ -74,7 +74,8 @@ export type ImageStyleProp = ____ImageStyleProp_Internal;
|
|
|
74
74
|
* through to an underlying component. Using this is almost always a mistake
|
|
75
75
|
* and using one of the other more restrictive types is likely the right choice.
|
|
76
76
|
*/
|
|
77
|
-
export type DangerouslyImpreciseStyleProp =
|
|
77
|
+
export type DangerouslyImpreciseStyleProp =
|
|
78
|
+
____DangerouslyImpreciseStyleProp_Internal;
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
81
|
* Utility type for getting the values for specific style keys.
|
|
@@ -16,6 +16,29 @@ import type {NativeColorValue} from './PlatformColorValueTypes';
|
|
|
16
16
|
|
|
17
17
|
export type ____ColorValue_Internal = null | string | NativeColorValue;
|
|
18
18
|
|
|
19
|
+
export type CursorValue = ?(
|
|
20
|
+
| 'alias'
|
|
21
|
+
| 'auto'
|
|
22
|
+
| 'col-resize'
|
|
23
|
+
| 'context-menu'
|
|
24
|
+
| 'copy'
|
|
25
|
+
| 'crosshair'
|
|
26
|
+
| 'default'
|
|
27
|
+
| 'disappearing-item'
|
|
28
|
+
| 'e-resize'
|
|
29
|
+
| 'grab'
|
|
30
|
+
| 'grabbing'
|
|
31
|
+
| 'n-resize'
|
|
32
|
+
| 'no-drop'
|
|
33
|
+
| 'not-allowed'
|
|
34
|
+
| 'pointer'
|
|
35
|
+
| 'row-resize'
|
|
36
|
+
| 's-resize'
|
|
37
|
+
| 'text'
|
|
38
|
+
| 'vertical-text'
|
|
39
|
+
| 'w-resize'
|
|
40
|
+
);
|
|
41
|
+
|
|
19
42
|
export type ColorArrayValue = null | $ReadOnlyArray<____ColorValue_Internal>;
|
|
20
43
|
export type PointValue = {|
|
|
21
44
|
x: number,
|
|
@@ -584,6 +607,7 @@ export type ____ViewStyle_Internal = $ReadOnly<{|
|
|
|
584
607
|
borderTopWidth?: number | AnimatedNode,
|
|
585
608
|
opacity?: number | AnimatedNode,
|
|
586
609
|
elevation?: number,
|
|
610
|
+
cursor?: CursorValue,
|
|
587
611
|
|}>;
|
|
588
612
|
|
|
589
613
|
export type ____FontWeight_Internal =
|
|
@@ -638,6 +662,7 @@ export type ____TextStyle_Internal = $ReadOnly<{|
|
|
|
638
662
|
textDecorationColor?: ____ColorValue_Internal,
|
|
639
663
|
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase',
|
|
640
664
|
writingDirection?: 'auto' | 'ltr' | 'rtl',
|
|
665
|
+
cursor?: CursorValue,
|
|
641
666
|
|}>;
|
|
642
667
|
|
|
643
668
|
export type ____ImageStyle_Internal = $ReadOnly<{|
|
|
@@ -678,7 +703,7 @@ export type ____ImageStyleProp_Internal = GenericStyleProp<
|
|
|
678
703
|
|
|
679
704
|
export type ____Styles_Internal = {
|
|
680
705
|
+[key: string]: $Shape<____DangerouslyImpreciseStyle_Internal>,
|
|
681
|
-
|
|
706
|
+
...
|
|
682
707
|
};
|
|
683
708
|
|
|
684
709
|
export type ____FlattenStyleProp_Internal<+TStyleProp> = $Call<
|
|
@@ -31,8 +31,8 @@ function processColor(color?: ?(number | ColorValue)): ?ProcessedColorValue {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (typeof normalizedColor === 'object') {
|
|
34
|
-
const processColorObject =
|
|
35
|
-
.processColorObject;
|
|
34
|
+
const processColorObject =
|
|
35
|
+
require('./PlatformColorValueTypes').processColorObject;
|
|
36
36
|
|
|
37
37
|
const processedColorObj = processColorObject(normalizedColor);
|
|
38
38
|
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import type {____ViewStyle_Internal} from './StyleSheetTypes';
|
|
12
12
|
|
|
13
|
-
export default function splitLayoutProps(
|
|
14
|
-
props: ?____ViewStyle_Internal,
|
|
15
|
-
): {
|
|
13
|
+
export default function splitLayoutProps(props: ?____ViewStyle_Internal): {
|
|
16
14
|
outer: ?____ViewStyle_Internal,
|
|
17
15
|
inner: ?____ViewStyle_Internal,
|
|
18
16
|
} {
|
|
@@ -17,6 +17,17 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
17
17
|
|
|
18
18
|
@implementation RCTTextAttributes
|
|
19
19
|
|
|
20
|
+
// [TODO(macOS GH#774)
|
|
21
|
+
+ (RCTUIColor *)defaultForegroundColor
|
|
22
|
+
{
|
|
23
|
+
if (@available(iOS 13.0, *)) {
|
|
24
|
+
return [RCTUIColor labelColor];
|
|
25
|
+
} else {
|
|
26
|
+
return [RCTUIColor blackColor];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// ]TODO(macOS GH#774)
|
|
30
|
+
|
|
20
31
|
- (instancetype)init
|
|
21
32
|
{
|
|
22
33
|
if (self = [super init]) {
|
|
@@ -31,13 +42,9 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
31
42
|
_textShadowRadius = NAN;
|
|
32
43
|
_opacity = NAN;
|
|
33
44
|
_textTransform = RCTTextTransformUndefined;
|
|
34
|
-
// [TODO(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} else {
|
|
38
|
-
_foregroundColor = [RCTUIColor blackColor];
|
|
39
|
-
}
|
|
40
|
-
// ]TODO(OSS Candidate ISS#2710739)
|
|
45
|
+
// [TODO(macOS GH#774)
|
|
46
|
+
_foregroundColor = [RCTTextAttributes defaultForegroundColor];
|
|
47
|
+
// ]TODO(macOS GH#774)
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
return self;
|
|
@@ -50,7 +57,7 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
50
57
|
// We will address this in the future.
|
|
51
58
|
|
|
52
59
|
// Color
|
|
53
|
-
_foregroundColor = textAttributes->_foregroundColor
|
|
60
|
+
_foregroundColor = textAttributes->_foregroundColor == [RCTTextAttributes defaultForegroundColor] ? _foregroundColor : textAttributes->_foregroundColor;
|
|
54
61
|
_backgroundColor = textAttributes->_backgroundColor ?: _backgroundColor;
|
|
55
62
|
_opacity = !isnan(textAttributes->_opacity) ? (isnan(_opacity) ? 1.0 : _opacity) * textAttributes->_opacity : _opacity;
|
|
56
63
|
|
|
@@ -102,27 +109,27 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
102
109
|
alignment = NSTextAlignmentRight;
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
|
-
|
|
112
|
+
|
|
106
113
|
paragraphStyle.alignment = alignment;
|
|
107
114
|
isParagraphStyleUsed = YES;
|
|
108
115
|
}
|
|
109
|
-
|
|
116
|
+
|
|
110
117
|
if (_baseWritingDirection != NSWritingDirectionNatural) {
|
|
111
118
|
paragraphStyle.baseWritingDirection = _baseWritingDirection;
|
|
112
119
|
isParagraphStyleUsed = YES;
|
|
113
120
|
}
|
|
114
|
-
|
|
121
|
+
|
|
115
122
|
if (!isnan(_lineHeight)) {
|
|
116
123
|
CGFloat lineHeight = _lineHeight * self.effectiveFontSizeMultiplier;
|
|
117
124
|
paragraphStyle.minimumLineHeight = lineHeight;
|
|
118
125
|
paragraphStyle.maximumLineHeight = lineHeight;
|
|
119
126
|
isParagraphStyleUsed = YES;
|
|
120
127
|
}
|
|
121
|
-
|
|
128
|
+
|
|
122
129
|
if (isParagraphStyleUsed) {
|
|
123
130
|
return [paragraphStyle copy];
|
|
124
131
|
}
|
|
125
|
-
|
|
132
|
+
|
|
126
133
|
return nil;
|
|
127
134
|
}
|
|
128
135
|
|
package/Libraries/Text/Text.js
CHANGED
|
@@ -71,7 +71,8 @@ const Text: React.AbstractComponent<
|
|
|
71
71
|
setHighlighted(false);
|
|
72
72
|
onPressOut?.(event);
|
|
73
73
|
},
|
|
74
|
-
onResponderTerminationRequest_DEPRECATED:
|
|
74
|
+
onResponderTerminationRequest_DEPRECATED:
|
|
75
|
+
onResponderTerminationRequest,
|
|
75
76
|
onStartShouldSetResponder_DEPRECATED: onStartShouldSetResponder,
|
|
76
77
|
}
|
|
77
78
|
: null,
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
#else // [TODO(macOS GH#774)
|
|
49
49
|
_scrollView.documentView = _backedTextInputView;
|
|
50
50
|
_scrollView.contentView.postsBoundsChangedNotifications = YES;
|
|
51
|
+
// Enable focus ring by default
|
|
52
|
+
_scrollView.enableFocusRing = YES;
|
|
51
53
|
[self addSubview:_scrollView];
|
|
52
54
|
|
|
53
55
|
// a register for those notifications on the content view.
|
|
@@ -89,6 +91,14 @@
|
|
|
89
91
|
_scrollView.frame = UIEdgeInsetsInsetRect(self.bounds, reactBorderInsets);
|
|
90
92
|
[self setNeedsLayout];
|
|
91
93
|
}
|
|
94
|
+
|
|
95
|
+
- (void)setEnableFocusRing:(BOOL)enableFocusRing {
|
|
96
|
+
[super setEnableFocusRing:enableFocusRing];
|
|
97
|
+
if ([_scrollView respondsToSelector:@selector(setEnableFocusRing:)]) {
|
|
98
|
+
[_scrollView setEnableFocusRing:enableFocusRing];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
92
102
|
#endif // ]TODO(macOS GH#774)
|
|
93
103
|
|
|
94
104
|
#pragma mark - UIScrollViewDelegate
|
|
@@ -96,7 +106,9 @@
|
|
|
96
106
|
- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // TODO(macOS ISS#3536887)
|
|
97
107
|
{
|
|
98
108
|
RCTDirectEventBlock onScroll = self.onScroll;
|
|
99
|
-
|
|
109
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
110
|
+
[_scrollView setHasVerticalScroller:YES];
|
|
111
|
+
#endif // ]TODO(macOS GH#774)
|
|
100
112
|
if (onScroll) {
|
|
101
113
|
CGPoint contentOffset = scrollView.contentOffset;
|
|
102
114
|
CGSize contentSize = scrollView.contentSize;
|
|
@@ -46,11 +46,9 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
46
46
|
_placeholderView.numberOfLines = 0;
|
|
47
47
|
[self addSubview:_placeholderView];
|
|
48
48
|
#else // [TODO(macOS GH#774)
|
|
49
|
-
NSTextCheckingTypes checkingTypes = 0;
|
|
50
|
-
self.enabledTextCheckingTypes = checkingTypes;
|
|
51
|
-
self.insertionPointColor = [NSColor selectedControlColor];
|
|
52
49
|
// Fix blurry text on non-retina displays.
|
|
53
50
|
self.canDrawSubviewsIntoLayer = YES;
|
|
51
|
+
self.allowsUndo = YES;
|
|
54
52
|
#endif // ]TODO(macOS GH#774)
|
|
55
53
|
|
|
56
54
|
_textInputDelegateAdapter = [[RCTBackedTextViewDelegateAdapter alloc] initWithTextView:self];
|
|
@@ -127,12 +125,30 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
128
|
+
- (void)toggleAutomaticSpellingCorrection:(id)sender
|
|
129
|
+
{
|
|
130
|
+
self.automaticSpellingCorrectionEnabled = !self.isAutomaticSpellingCorrectionEnabled;
|
|
131
|
+
[_textInputDelegate automaticSpellingCorrectionDidChange:self.isAutomaticSpellingCorrectionEnabled];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
- (void)toggleContinuousSpellChecking:(id)sender
|
|
135
|
+
{
|
|
136
|
+
self.continuousSpellCheckingEnabled = !self.isContinuousSpellCheckingEnabled;
|
|
137
|
+
[_textInputDelegate continuousSpellCheckingDidChange:self.isContinuousSpellCheckingEnabled];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
- (void)toggleGrammarChecking:(id)sender
|
|
141
|
+
{
|
|
142
|
+
self.grammarCheckingEnabled = !self.isGrammarCheckingEnabled;
|
|
143
|
+
[_textInputDelegate grammarCheckingDidChange:self.isGrammarCheckingEnabled];
|
|
144
|
+
}
|
|
145
|
+
|
|
130
146
|
- (void)setSelectionColor:(RCTUIColor *)selectionColor
|
|
131
147
|
{
|
|
132
148
|
NSMutableDictionary *selectTextAttributes = self.selectedTextAttributes.mutableCopy;
|
|
133
149
|
selectTextAttributes[NSBackgroundColorAttributeName] = selectionColor ?: [NSColor selectedControlColor];
|
|
134
150
|
self.selectedTextAttributes = selectTextAttributes.copy;
|
|
135
|
-
self.insertionPointColor = self.selectionColor ?: [NSColor
|
|
151
|
+
self.insertionPointColor = self.selectionColor ?: [NSColor textColor];
|
|
136
152
|
}
|
|
137
153
|
|
|
138
154
|
- (RCTUIColor*)selectionColor
|
|
@@ -174,7 +190,7 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
174
190
|
|
|
175
191
|
- (BOOL)becomeFirstResponder
|
|
176
192
|
{
|
|
177
|
-
BOOL success =
|
|
193
|
+
BOOL success = [super becomeFirstResponder];
|
|
178
194
|
|
|
179
195
|
if (success) {
|
|
180
196
|
id<RCTBackedTextInputDelegate> textInputDelegate = [self textInputDelegate];
|
|
@@ -185,6 +201,18 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
185
201
|
|
|
186
202
|
return success;
|
|
187
203
|
}
|
|
204
|
+
|
|
205
|
+
- (BOOL)resignFirstResponder
|
|
206
|
+
{
|
|
207
|
+
BOOL success = [super resignFirstResponder];
|
|
208
|
+
|
|
209
|
+
if (success) {
|
|
210
|
+
// Break undo coalescing when losing focus.
|
|
211
|
+
[self breakUndoCoalescing];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return success;
|
|
215
|
+
}
|
|
188
216
|
#endif // ]TODO(macOS GH#774)
|
|
189
217
|
|
|
190
218
|
- (void)setDefaultTextAttributes:(NSDictionary<NSAttributedStringKey, id> *)defaultTextAttributes
|
|
@@ -247,6 +275,9 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
247
275
|
}
|
|
248
276
|
#else // [TODO(macOS GH#774)
|
|
249
277
|
if (![self.textStorage isEqualTo:attributedText.string]) {
|
|
278
|
+
// Break undo coalescing when the text is changed by JS (e.g. autocomplete).
|
|
279
|
+
[self breakUndoCoalescing];
|
|
280
|
+
|
|
250
281
|
if (attributedText != nil) {
|
|
251
282
|
[self.textStorage setAttributedString:attributedText];
|
|
252
283
|
} else {
|
|
@@ -22,6 +22,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
22
22
|
- (BOOL)textInputShouldReturn; // May be called right before `textInputShouldEndEditing` if "Return" button was pressed.
|
|
23
23
|
- (void)textInputDidReturn;
|
|
24
24
|
|
|
25
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
26
|
+
- (void)automaticSpellingCorrectionDidChange:(BOOL)enabled;
|
|
27
|
+
- (void)continuousSpellCheckingDidChange:(BOOL)enabled;
|
|
28
|
+
- (void)grammarCheckingDidChange:(BOOL)enabled;
|
|
29
|
+
#endif // ]TODO(macOS GH#774)
|
|
30
|
+
|
|
25
31
|
/*
|
|
26
32
|
* Called before any change in the TextInput. The delegate has the opportunity to change the replacement string or reject the change completely.
|
|
27
33
|
* To change the replacement, return the changed version of the `text`.
|
|
@@ -263,6 +263,7 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
263
263
|
UITextRange *_previousSelectedTextRange;
|
|
264
264
|
#else // [TODO(macOS GH#774)
|
|
265
265
|
NSRange _previousSelectedTextRange;
|
|
266
|
+
NSUndoManager *_undoManager;
|
|
266
267
|
#endif // ]TODO(macOS GH#774)
|
|
267
268
|
}
|
|
268
269
|
|
|
@@ -428,6 +429,13 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
428
429
|
return commandHandled;
|
|
429
430
|
}
|
|
430
431
|
|
|
432
|
+
- (NSUndoManager *)undoManagerForTextView:(NSTextView *)textView {
|
|
433
|
+
if (!_undoManager) {
|
|
434
|
+
_undoManager = [NSUndoManager new];
|
|
435
|
+
}
|
|
436
|
+
return _undoManager;
|
|
437
|
+
}
|
|
438
|
+
|
|
431
439
|
#endif // ]TODO(macOS GH#774)
|
|
432
440
|
|
|
433
441
|
#pragma mark - Public Interface
|
|
@@ -225,7 +225,19 @@
|
|
|
225
225
|
|
|
226
226
|
if (!_textStorage) {
|
|
227
227
|
_textContainer = [NSTextContainer new];
|
|
228
|
+
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
228
229
|
_textContainer.lineFragmentPadding = 0.0; // Note, the default value is 5.
|
|
230
|
+
#else
|
|
231
|
+
// macOS has a bug in multiline where setting the real text view's lineFragmentPadding to 0 will
|
|
232
|
+
// cause the scroll view to scroll to top when inserting a newline at the bottom of
|
|
233
|
+
// a NSTextView when it has more rows than can be displayed on screen. The shadow needs to match
|
|
234
|
+
// the NSTextView that it is tracking.
|
|
235
|
+
if (_maximumNumberOfLines != 1) {
|
|
236
|
+
_textContainer.lineFragmentPadding = 1;
|
|
237
|
+
} else {
|
|
238
|
+
_textContainer.lineFragmentPadding = 0.0; // Note, the default value is 5.
|
|
239
|
+
}
|
|
240
|
+
#endif // ]TODO(macOS GH#774)
|
|
229
241
|
_layoutManager = [NSLayoutManager new];
|
|
230
242
|
[_layoutManager addTextContainer:_textContainer];
|
|
231
243
|
_textStorage = [NSTextStorage new];
|
|
@@ -42,6 +42,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
42
42
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onChangeSync;
|
|
43
43
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput;
|
|
44
44
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll;
|
|
45
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
46
|
+
@property (nonatomic, copy, nullable) RCTBubblingEventBlock onAutoCorrectChange;
|
|
47
|
+
@property (nonatomic, copy, nullable) RCTBubblingEventBlock onSpellCheckChange;
|
|
48
|
+
@property (nonatomic, copy, nullable) RCTBubblingEventBlock onGrammarCheckChange;
|
|
49
|
+
#endif // TODO(macOS GH#774)
|
|
45
50
|
|
|
46
51
|
@property (nonatomic, assign) NSInteger mostRecentEventCount;
|
|
47
52
|
@property (nonatomic, assign, readonly) NSInteger nativeEventCount;
|
|
@@ -144,7 +144,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
144
144
|
BOOL textNeedsUpdate = NO;
|
|
145
145
|
// Remove tag attribute to ensure correct attributed string comparison.
|
|
146
146
|
NSMutableAttributedString *const backedTextInputViewTextCopy = [self.backedTextInputView.attributedText mutableCopy];
|
|
147
|
-
NSMutableAttributedString *const attributedTextCopy = [attributedText mutableCopy];
|
|
147
|
+
NSMutableAttributedString *const attributedTextCopy = [attributedText mutableCopy] ?: [NSMutableAttributedString new];
|
|
148
148
|
|
|
149
149
|
[backedTextInputViewTextCopy removeAttribute:RCTTextAttributesTagAttributeName
|
|
150
150
|
range:NSMakeRange(0, backedTextInputViewTextCopy.length)];
|
|
@@ -153,6 +153,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
153
153
|
range:NSMakeRange(0, attributedTextCopy.length)];
|
|
154
154
|
|
|
155
155
|
textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO);
|
|
156
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
157
|
+
// If we are in a language that uses conversion (e.g. Japanese), ignore updates if we have unconverted text.
|
|
158
|
+
if ([self.backedTextInputView hasMarkedText]) {
|
|
159
|
+
textNeedsUpdate = NO;
|
|
160
|
+
}
|
|
161
|
+
#endif // ]TODO(macOS GH#774)
|
|
156
162
|
|
|
157
163
|
if (eventLag == 0 && textNeedsUpdate) {
|
|
158
164
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
@@ -160,7 +166,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
160
166
|
#else // [TODO(macOS GH#774)
|
|
161
167
|
NSRange selection = [self.backedTextInputView selectedTextRange];
|
|
162
168
|
#endif // ]TODO(macOS GH#774)
|
|
163
|
-
|
|
169
|
+
NSAttributedString *oldAttributedText = [self.backedTextInputView.attributedText copy];
|
|
170
|
+
NSInteger oldTextLength = oldAttributedText.string.length;
|
|
171
|
+
|
|
172
|
+
[self.backedTextInputView.undoManager registerUndoWithTarget:self handler:^(RCTBaseTextInputView *strongSelf) {
|
|
173
|
+
strongSelf.attributedText = oldAttributedText;
|
|
174
|
+
[strongSelf textInputDidChange];
|
|
175
|
+
}];
|
|
164
176
|
|
|
165
177
|
self.backedTextInputView.attributedText = attributedText;
|
|
166
178
|
|
|
@@ -396,6 +408,29 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
396
408
|
eventCount:_nativeEventCount];
|
|
397
409
|
}
|
|
398
410
|
|
|
411
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
412
|
+
- (void)automaticSpellingCorrectionDidChange:(BOOL)enabled
|
|
413
|
+
{
|
|
414
|
+
if (_onAutoCorrectChange) {
|
|
415
|
+
_onAutoCorrectChange(@{@"enabled": [NSNumber numberWithBool:enabled]});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
- (void)continuousSpellCheckingDidChange:(BOOL)enabled
|
|
420
|
+
{
|
|
421
|
+
if (_onSpellCheckChange) {
|
|
422
|
+
_onSpellCheckChange(@{@"enabled": [NSNumber numberWithBool:enabled]});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
- (void)grammarCheckingDidChange:(BOOL)enabled
|
|
427
|
+
{
|
|
428
|
+
if (_onGrammarCheckChange) {
|
|
429
|
+
_onGrammarCheckChange(@{@"enabled": [NSNumber numberWithBool:enabled]});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
#endif // ]TODO(macOS GH#774)
|
|
433
|
+
|
|
399
434
|
- (BOOL)textInputShouldReturn
|
|
400
435
|
{
|
|
401
436
|
// We send `submit` event here, in `textInputShouldReturn`
|
|
@@ -38,7 +38,7 @@ RCT_EXPORT_MODULE()
|
|
|
38
38
|
|
|
39
39
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType) // TODO(macOS GH#774)
|
|
40
40
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType) // TODO(macOS GH#774)
|
|
41
|
-
RCT_REMAP_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.
|
|
41
|
+
RCT_REMAP_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.automaticSpellingCorrectionEnabled, BOOL) // TODO(macOS GH#774)
|
|
42
42
|
RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL)
|
|
43
43
|
RCT_REMAP_VIEW_PROPERTY(editable, backedTextInputView.editable, BOOL)
|
|
44
44
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL) // TODO(macOS GH#774)
|
|
@@ -48,8 +48,9 @@ RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderCol
|
|
|
48
48
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType) // TODO(macOS GH#774)
|
|
49
49
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor) // TODO(macOS GH#774)
|
|
50
50
|
RCT_REMAP_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.selectionColor, UIColor) // TODO(macOS GH#774)
|
|
51
|
+
RCT_REMAP_OSX_VIEW_PROPERTY(grammarCheck, backedTextInputView.grammarCheckingEnabled, BOOL) // TODO(macOS GH#774)
|
|
51
52
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType) // TODO(macOS GH#774)
|
|
52
|
-
RCT_REMAP_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.
|
|
53
|
+
RCT_REMAP_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.continuousSpellCheckingEnabled, BOOL) // TODO(macOS GH#774)
|
|
53
54
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL) // TODO(macOS GH#774)
|
|
54
55
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode) // TODO(macOS GH#774)
|
|
55
56
|
RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL)
|
|
@@ -66,6 +67,12 @@ RCT_EXPORT_VIEW_PROPERTY(inputAccessoryViewID, NSString)
|
|
|
66
67
|
RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString)
|
|
67
68
|
RCT_EXPORT_VIEW_PROPERTY(passwordRules, NSString)
|
|
68
69
|
|
|
70
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
71
|
+
RCT_EXPORT_VIEW_PROPERTY(onAutoCorrectChange, RCTBubblingEventBlock);
|
|
72
|
+
RCT_EXPORT_VIEW_PROPERTY(onSpellCheckChange, RCTBubblingEventBlock);
|
|
73
|
+
RCT_EXPORT_VIEW_PROPERTY(onGrammarCheckChange, RCTBubblingEventBlock);
|
|
74
|
+
#endif // TODO(macOS GH#774)
|
|
75
|
+
|
|
69
76
|
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
70
77
|
RCT_EXPORT_VIEW_PROPERTY(onKeyPressSync, RCTDirectEventBlock)
|
|
71
78
|
RCT_EXPORT_VIEW_PROPERTY(onChangeSync, RCTDirectEventBlock)
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
|
|
29
29
|
_backedTextInputView = [[RCTUITextField alloc] initWithFrame:self.bounds];
|
|
30
30
|
_backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
31
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
32
|
+
_backedTextInputView.cell.scrollable = YES;
|
|
33
|
+
_backedTextInputView.cell.usesSingleLineMode = YES;
|
|
34
|
+
#endif // ]TODO(macOS GH#774)
|
|
31
35
|
_backedTextInputView.textInputDelegate = self;
|
|
32
36
|
|
|
33
37
|
[self addSubview:_backedTextInputView];
|
|
@@ -54,6 +54,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
54
54
|
@property (nonatomic, assign) NSTextAlignment textAlignment;
|
|
55
55
|
@property (nonatomic, getter=isAutomaticTextReplacementEnabled) BOOL automaticTextReplacementEnabled;
|
|
56
56
|
@property (nonatomic, getter=isAutomaticSpellingCorrectionEnabled) BOOL automaticSpellingCorrectionEnabled;
|
|
57
|
+
@property (nonatomic, getter=isContinuousSpellCheckingEnabled) BOOL continuousSpellCheckingEnabled;
|
|
58
|
+
@property (nonatomic, getter=isGrammarCheckingEnabled) BOOL grammarCheckingEnabled;
|
|
57
59
|
@property (nonatomic, assign) BOOL enableFocusRing;
|
|
58
60
|
@property (nonatomic, strong, nullable) RCTUIColor *selectionColor;
|
|
59
61
|
@property (weak, nullable) id<RCTUITextFieldDelegate> delegate;
|