Skip to content

Cannot modify the width of Switch component #29047

@HectorRicardo

Description

@HectorRicardo

Description

On Android, it is possible to modify the width of a Switch by using the android:switchMinWidth attribute

<Switch android:switchMinWidth="50dp" />

or by using the .setSwitchMinWidth(int pixels) method.

Switch mySwitch = findViewById(R.id.mySwitch);
mySwitch.setSwitchMinWidth(400);

image

There is no such attribute in React-Native. Ideally, it would be nice to have a "width" attribute for the Switch component, such that we can do

<Switch width={50} />

to achieve something similar as the above screenshot.

React Native version:

System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Memory: 6.39 GB / 15.87 GB
Binaries:
Node: 12.16.3 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
Android NDK: 17.2.4988734
IDEs:
Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6392135
Languages:
Python: 3.8.3 - C:\Python38\python.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.1 => 0.62.1
npmGlobalPackages:
react-native: Not Found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: SwitchPlatform: AndroidAndroid applications.Resolution: PR SubmittedA pull request with a fix has been provided.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions