@office-iss/react-native-win32 0.72.11 → 0.72.12

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.
@@ -21,8 +21,7 @@ import type {
21
21
 
22
22
  import {Commands as AndroidTextInputCommands} from '../../Components/TextInput/AndroidTextInputNativeComponent';
23
23
  import {Commands as iOSTextInputCommands} from '../../Components/TextInput/RCTSingelineTextInputNativeComponent';
24
-
25
- import {UIManager} from 'react-native';
24
+ import {Commands as Win32TextInputCommands} from '../../Components/TextInput/Win32TextInputNativeComponent';
26
25
 
27
26
  const {findNodeHandle} = require('../../ReactNative/RendererProxy');
28
27
  const Platform = require('../../Utilities/Platform');
@@ -106,7 +105,16 @@ function focusTextInput(textField: ?ComponentRef) {
106
105
  return;
107
106
  }
108
107
 
109
- if (textField != null) {
108
+ // [Win32
109
+ if (Platform.OS === 'win32' && textField != null) {
110
+ // On Windows, we cannot test if the currentlyFocusedInputRef equals the
111
+ // target ref because the call to focus on the target ref may occur before
112
+ // an onBlur event for the target ref has been dispatched to JS but after
113
+ // the target ref has lost native focus.
114
+ focusInput(textField);
115
+ Win32TextInputCommands.focus(textField);
116
+ // Win32]
117
+ } else if (textField != null) {
110
118
  const fieldCanBeFocused =
111
119
  currentlyFocusedInputRef !== textField &&
112
120
  // $FlowFixMe - `currentProps` is missing in `NativeMethods`
@@ -126,11 +134,6 @@ function focusTextInput(textField: ?ComponentRef) {
126
134
  } else if (Platform.OS === 'android') {
127
135
  AndroidTextInputCommands.focus(textField);
128
136
  }
129
- // [Win32
130
- else if (Platform.OS === 'win32') {
131
- UIManager.focus(findNodeHandle(textField));
132
- }
133
- // Win32]
134
137
  }
135
138
  }
136
139
 
@@ -164,7 +167,7 @@ function blurTextInput(textField: ?ComponentRef) {
164
167
  }
165
168
  // [Win32
166
169
  else if (Platform.OS === 'win32') {
167
- UIManager.blur(findNodeHandle(textField));
170
+ Win32TextInputCommands.blur(textField);
168
171
  }
169
172
  // Win32]
170
173
  }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @flow
3
+ * @format
4
+ */
5
+
6
+ import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
7
+
8
+ import requireNativeComponent from '../../ReactNative/requireNativeComponent';
9
+ import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
10
+ import type {TextInputNativeCommands} from './TextInputNativeCommands';
11
+ type NativeType = HostComponent<mixed>;
12
+
13
+ type NativeCommands = TextInputNativeCommands<NativeType>;
14
+
15
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
16
+ supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
17
+ });
18
+
19
+ const WindowsTextInputComponent: NativeType =
20
+ requireNativeComponent<mixed>('RCTTextInput');
21
+
22
+ export default WindowsTextInputComponent;
23
+ // [Windows]
package/overrides.json CHANGED
@@ -142,6 +142,10 @@
142
142
  "baseFile": "packages/react-native/Libraries/Components/TextInput/TextInputState.js",
143
143
  "baseHash": "60655baaca427e1c7c1b8884833b848335c4033b"
144
144
  },
145
+ {
146
+ "type": "platform",
147
+ "file": "src/Libraries/Components/TextInput/Win32TextInputNativeComponent.js"
148
+ },
145
149
  {
146
150
  "type": "copy",
147
151
  "file": "src/Libraries/Components/ToastAndroid/ToastAndroid.win32.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.72.11",
3
+ "version": "0.72.12",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "repository": {
6
6
  "type": "git",