TextInput's onFocus and onBlur functions are not being executed
Environment
react-native -v: react-native-cli: 2.0.1 react-native: 0.60.6npm ls rnpm-plugin-windows: [email protected]npm ls react-native-windows: [email protected]node -v: v10.15.0npm -v: 6.13.1
Then, specify:
- Target Platform Version(s): 10.0.18362.0
- Target Device(s): Desktop
- Visual Studio Version: 2017
- Build Configuration: Debug
Steps to Reproduce
- Create a TextInput in a project using React Native Windows
- Supply an onFocus and onBlur function to the TextInput
- Launch the app and focus or blur the TextInput
- Observe that the code in the onFocus and onBlur provided to the TextInput is not executed
Example code:
import * as RN from "react-native";
render() {
return (
<RN.TextInput onFocus={this._onFocus} onBlur={this._onBlur} />
);
}
_onFocus = (event: RN.NativeSyntheticEvent<RN.TextInputFocusEventData>) => {
...
}
_onBlur = (event: RN.NativeSyntheticEvent<RN.TextInputFocusEventData>) => {
...
}
Expected Behavior
I expected the code in the _onFocus and _onBlur functions to be executed.
Actual Behavior
The code in the _onFocus and _onBlur functions was not executed.
@licanhua You implemented focus and blur. Were the callbacks implemented (we have a bug) or not (we just need to go implement)
I hit this issue as well. (specifically for onFocus on TextInput). Debugging I'm not able to figure out where the bug is. The event makes it from native to JS, and makes it to getListener in ReactNativeRenderer-dev.js, but onFocus in the props is always undefined. In TextInput.windows.js I was able to see the onFocus prop getting set, I wasn't able to see why it's undefined when the props are retrieved later.
Hopefully this info helps a little :)
@chrisglein @licanhua Can you provide an update on this issue? Were you able to determine whether the callbacks were implemented or not?
@kaiguo Follow up with @licanhua about the state of this and see what action we need to take.
@kaiguo Can you provide a status update on this issue?
@kaiguo Kai Guo FTE Can you provide a status update on this issue?
This is the next item on my list, I'll start on this pretty soon hopefully : )
It's possible related the merge of .60. I just debugged with kai and the onFocus event is already sent from native to JS side. Still don't know why it's dropped finally
Should be fixed by the PR above.