Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Remove unnecessary overrides to onFocus and onBlur in Pressable",
"packageName": "@office-iss/react-native-win32",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Remove unnecessary overrides to onFocus and onBlur in Pressable",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,22 +253,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
const viewRef = useRef<React.ElementRef<typeof View> | null>(null);
useImperativeHandle(forwardedRef, () => viewRef.current);

// [Windows
const _onBlur = (event: BlurEvent) => {
TextInputState.blurInput(viewRef.current);
if (props.onBlur) {
props.onBlur(event);
}
};

const _onFocus = (event: FocusEvent) => {
TextInputState.focusInput(viewRef.current);
if (props.onFocus) {
props.onFocus(event);
}
};
// Windows]

const android_rippleConfig = useAndroidRippleForView(android_ripple, viewRef);

const [pressed, setPressed] = usePressState(testOnly_pressed === true);
Expand Down Expand Up @@ -360,10 +344,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
<View
{...restPropsWithDefaults}
{...eventHandlers}
// [Windows
onBlur={_onBlur}
onFocus={_onFocus}
// Windows]
ref={viewRef}
style={typeof style === 'function' ? style({pressed}) : style}>
{typeof children === 'function' ? children({pressed}) : children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ function PressableFeedbackEvents() {
accessibilityLabel="pressable feedback events"
accessibilityRole="button"
// [Windows
onFocus={() => appendEvent('focus')}
onBlur={() => appendEvent('blur')}
onHoverIn={() => appendEvent('hover in')}
onHoverOut={() => appendEvent('hover out')}
// Windows]
Expand Down
20 changes: 0 additions & 20 deletions vnext/src/Libraries/Components/Pressable/Pressable.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,22 +253,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
const viewRef = useRef<React.ElementRef<typeof View> | null>(null);
useImperativeHandle(forwardedRef, () => viewRef.current);

// [Windows
const _onBlur = (event: BlurEvent) => {
TextInputState.blurInput(viewRef.current);
if (props.onBlur) {
props.onBlur(event);
}
};

const _onFocus = (event: FocusEvent) => {
TextInputState.focusInput(viewRef.current);
if (props.onFocus) {
props.onFocus(event);
}
};
// Windows]

const android_rippleConfig = useAndroidRippleForView(android_ripple, viewRef);

const [pressed, setPressed] = usePressState(testOnly_pressed === true);
Expand Down Expand Up @@ -360,10 +344,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
<View
{...restPropsWithDefaults}
{...eventHandlers}
// [Windows
onBlur={_onBlur}
onFocus={_onFocus}
// Windows]
ref={viewRef}
style={typeof style === 'function' ? style({pressed}) : style}>
{typeof children === 'function' ? children({pressed}) : children}
Expand Down