-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[Android] Adding prop android_minWidth to Switch component #29059
Conversation
Base commit: e6fc20e |
Base commit: e6fc20e |
ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java
Outdated
Show resolved
Hide resolved
why not support minWidth in style? |
@dulmandakh that could also work, but I guess it is because the minimum width is only supported on Android and not on iOS, so by naming the property |
Thanks for the support @HectorRicardo Thanks and Sorry, but I do not work on iOS. I can not tell if this is possible or not. TLDR I did a brief research, this are my inconclusive results on iOS: on iOS we are using UISwitch react-native/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm Lines 22 to 24 in a50fa55
as explained on stackoverflow
UISwitch *aSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(120, 120, 51, 31)];
aSwitch.transform = CGAffineTransformMakeScale(2.0, 2.0); Seems difficult to change the width without using I personally would not use The iOS developer would have to find a way to set the I could not find existing iOS api to set the minWidth of a UISwitch, I did not make extensive research as I want to specialize on Android. Thanks a lot. |
I also did some research, and although I don't have any Apple device to test, I am pretty sure the default UISwitch is not customizable. I suggest we leave the androidMinWidth attribute outside of the style object. |
Thanks a lot @dulmandakh for your code review. The main reason is that I am specializing on Android, Java and ReactNative/JS. It is harder for me to work with many different languages and tools. Thanks a lot |
Summary
This issue fixes #29047
Adding prop android_minWidth to Switch component.
Changelog
[Android] [Fixed] - Adding prop android_minWidth to Switch component
Test Plan
CLICK TO OPEN TESTS RESULTS
I will write separate pull request to update the docs on https://github.com/facebook/react-native-website