Comments (7)
It also looks like the focus ring is the only clickable area of the input fields. In this video the input fields are transformed down by 40.
screenshot.mp4
We override drawFocusRingMask so we can support corner radius, etc.
In my case the focus ring does not follow the border radius of the input field. Increasing the border radius makes this a lot more visible:
Is this intentional or should the focus ring have the same border radius as well?
Second question: Can I maybe help you by testing your theory by removing some lines in the node_modules?
from react-native-macos.
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.mp4
The 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.
from react-native-macos.
I have an idea of why this happens, not sure it'll fix it.
We override drawFocusRingMask
so we can support corner radius, etc. Perhaps we also need to account for translation there? Because it's mask
(I.E: the thing you put on top of a rect, not where the rect is) I'm not sure if that's the right path forward, but maybe a shot?
https://github.com/search?q=repo%3Amicrosoft%2Freact-native-macos%20drawFocusRing&type=code
from react-native-macos.
@AdrianFahrbach
Oof, yes both of examples look wrong to me.
You should be able to just make local edits and build, yeah. I'm not sure what local edits per say, but stuff around drawFocusRingMask
or any of these overrides to start: https://developer.apple.com/documentation/appkit/nsview/appearance#1662106
Also, if you replace the TextInput with a normal View, do you still repro? That would tell me it's TextInput specific.
from react-native-macos.
The focus is rounded on a regular view, it suffers from the same transform problem though:
screenshot.00.27.23.mp4
I did try removing the following from react-native-macos/React/Views/RCTView.m
, but I didn't get any focus border at all then.
#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);
}
}
from react-native-macos.
We will probably fix #2038 before this one to see if they are related
from react-native-macos.
Related Issues (20)
- [RCTConvert] Deprecate UIBarStyle
- [RCTConvert] Remove UIBarStyle
- [SocketRocket] Upstream visionOS Support
- Is __apply_Xcode_12_5_M1_post_install_workaround now obsolete? HOT 4
- The transform style does not work in version 0.73.* HOT 7
- Unable to resolve module
- [Fabric] TextInput UI is not updated when changing prop `value` or calling `inputRef.current.clear()` / `inputRef.current.setNativeProps({text: ''})` HOT 2
- Web inspector flashing on production/release build when starting the app HOT 6
- Keyboard shortcuts (copy, paste, select) not working in TextInput HOT 6
- "Fatal error: 'ExpoModulesCore/ExpoModulesCore.h' file not found" in run-macos HOT 3
- I want to request a feature like in-app Purchases support, and Firebase support. HOT 3
- useWindowDimensions causes infinite re-rendering HOT 3
- Wrong image pixel density version on initial launch HOT 6
- Right click context menu HOT 5
- No version of react-native-macos@^0.70.0-0 found! HOT 1
- <Text onBlur={() => {}}> throws -[RCTTextView setOnBlur:]: unrecognized selector sent HOT 1
- How can i get the microphone or camera permission in react-native-macOS, i am using react-native-permissions HOT 3
- ERROR: No bundle URL present. HOT 10
- `Text` elements' `backgroundColor` style prop extends to the entire background
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-macos.