-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input focus area doesn't move when parent view is transformed #2063
Comments
I got the same issue! In my case I got a drawer element with an input that gets moved out of the screen. See here: screenshot.2024-02-03.at.16.41.02.mp4The solution in my case is to blur the input field before moving it. This only works with multiline input fields though, so I will make the single line input a multiline field. I also already tried setting the multiline prop right before blurring the input, but react-native absolutely does not like that and throws an error. |
I have an idea of why this happens, not sure it'll fix it. We override https://github.com/search?q=repo%3Amicrosoft%2Freact-native-macos%20drawFocusRing&type=code |
@AdrianFahrbach Also, if you replace the TextInput with a normal View, do you still repro? That would tell me it's TextInput specific. |
The focus is rounded on a regular view, it suffers from the same transform problem though: screenshot.00.27.23.mp4I did try removing the following from #pragma mark Focus ring
- (CGRect)focusRingMaskBounds
{
return self.bounds;
}
- (void)drawFocusRingMask
{
if ([self enableFocusRing]) {
CGContextRef context = NSGraphicsContext.currentContext.CGContext;
RCTCornerInsets cornerInsets = RCTGetCornerInsets(self.cornerRadii, NSEdgeInsetsZero);
CGPathRef path = RCTPathCreateWithRoundedRect(self.bounds, cornerInsets, NULL);
CGContextAddPath(context, path);
CGContextFillPath(context);
CGPathRelease(path);
}
} |
We will probably fix #2038 before this one to see if they are related |
This is still an issue after the fix. Not much of an annoyance though. |
Also having this issue. I can't find a suitable workaround. I'd love to see this fixed. |
Environment
Steps to reproduce the bug
When using the
translate
style to manipulate the position of a<View>
component, the new position doesn't seem to be applied to the focus area of any child<TextInput>
components.The following JSX in the demo project will recreate the issue:
Expected Behavior
The input focus area should be anchored to the bounding box of the input
Actual Behavior
You can see the blue input focus area is no longer positioned above the input:
Reproducible Demo
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: