You can resize the switch by using transform property from styling,

<Switch value={true}
style={{ transform: [{ scaleX: .8 }, { scaleY: .8 }] }}
onValueChange={(value) => {}} />

also for best result determine scaling values based on screen dimension.

Answer from Eltaf Hussain on Stack Overflow
🌐
React Native
reactnative.dev › docs › switch
Switch · React Native
1 month ago - On iOS, custom color for the background. This background color can be seen either when the switch value is false or when the switch is disabled (and the switch is translucent).
🌐
npm
npmjs.com › package › react-native-switch
react-native-switch - npm
February 21, 2022 - import { Switch } from 'react-native-switch'; export const App = () => ( <Switch value={true} onValueChange={(val) => console.log(val)} disabled={false} activeText={'On'} inActiveText={'Off'} circleSize={30} barHeight={1} circleBorderWidth={3} backgroundActive={'green'} backgroundInactive={'gray'} circleActiveColor={'#30a566'} circleInActiveColor={'#000000'} renderInsideCircle={() => <CustomComponent />} // custom component to render inside the Switch circle (Text, Image, etc.) changeValueImmediately={true} // if rendering inside circle, change state immediately or wait for animation to comple
      » npm install react-native-switch
    
Published   Feb 21, 2022
Version   1.5.1
🌐
Swmansion
docs.swmansion.com › react-native-reanimated › examples › switch
Switch | React Native Reanimated
2 weeks ago - <Animated.View onLayout={(e) => { height.value = e.nativeEvent.layout.height; width.value = e.nativeEvent.layout.width; }} style={[switchStyles.track, style, trackAnimatedStyle]}>
🌐
Medium
medium.com › @songyishu.yang › react-native-switch-recolor-resize-6dc6a2ce183a
React Native Switch: recolor & resize | by Songyishu Yang | Medium
April 11, 2019 - Missing in React Native Switch Documentation… · To change the color of the switch when turned ON: Add props onTintColor = color · To resize the size of the switch to smaller or larger: Add props style = transformation: [{scaleX: resizeRatio},{scaleY:rezieRatio} ] Code example: <Switch onTintColor={Colors.tintColor} onValueChange={value=>this.setState({switchAll:value}} value={this.state.switchAll} style={{ transform:[{ scaleX: .7 }, { scaleY: .7 }] }} /> React Native ·
🌐
React Native Elements
reactnativeelements.com › switch
Switch | React Native Elements
This renders a boolean value. React native elements provide you with additional theme and color support in the Switch Button.
🌐
Peerlist
peerlist.io › blog › engineering › creating-custom-switch-component-in-react-native
Creating a Custom Toggle Switch Component in React Native
import { Pressable, View, Animated, ... We have to define two sets of styles: defaultStyles for the switch in its default state and activeStyles for when the switch is toggled on....
Top answer
1 of 1
1

I think a good way is to make a custom factory I made a custom switch once, I'll post it here. I did not modify the looks of the Switch but I'm confident you could create a component that looks like your image and then use it in your factory. In my case I aligned some text with the switch with a clickable link and so on. I have not tried it but i guess you can replace the Switch component with your own.

import React from 'react';
import { View, Text, Switch, TouchableOpacity } from 'react-native';
import t from 'tcomb-form-native';
import Strings from '../config/strings.js';

var Component = t.form.Component;

class TermsSwitch extends Component {

  constructor (props) {
    super(props);
    var locals = super.getLocals();
  }

  getLocals () {
    var locals = super.getLocals();
    return locals;
  }

  getTemplate () {
    return function (locals) {
      var stylesheet = locals.stylesheet;
      var formGroupStyle = stylesheet.formGroup.normal;
      var controlLabelStyle = stylesheet.controlLabel.normal;
      var checkboxStyle = stylesheet.checkbox.normal;
      var helpBlockStyle = stylesheet.helpBlock.normal;
      var errorBlockStyle = stylesheet.errorBlock;

      if (locals.hasError) {
        formGroupStyle = stylesheet.formGroup.error;
        controlLabelStyle = stylesheet.controlLabel.error;
        checkboxStyle = stylesheet.checkbox.error;
        helpBlockStyle = stylesheet.helpBlock.error;
      }

      var label = locals.label ? <Text style={controlLabelStyle}>{locals.label}</Text> : null;
      var help = locals.help ? <Text style={helpBlockStyle}>{locals.help}</Text> : null;
      var error = locals.hasError && locals.error ? <Text accessibilityLiveRegion="polite" style={[errorBlockStyle, {marginTop: 2}]}>{locals.error}</Text> : null;

      return (
        <View style={formGroupStyle}>
          {label}
          <View style={{flexDirection: 'row', alignItems: 'center'}}>
            <View style={{flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center'}}>
              <Text style={{fontSize: 14}}>Jag har läst och accepterar </Text>
              <TouchableOpacity onPress={() => locals.config.onPressTerms()}>
                <Text style={{fontStyle: 'italic', fontSize: 14, textDecorationLine: 'underline'}}>villkoren</Text>
              </TouchableOpacity>
            </View>
            <View style={{flex: 1, flexDirection: 'column', justifyContent: 'center', paddingTop: 6}}>
              <Switch
                accessibilityLabel={locals.label}
                ref="input"
                disabled={locals.disabled}
                onTintColor={locals.onTintColor}
                thumbTintColor={locals.thumbTintColor}
                tintColor={locals.tintColor}
                style={checkboxStyle}
                onValueChange={(value) => locals.onChange(value)}
                value={locals.value} />
            </View>
          </View>
          {help}
          {error}
        </View>
      );
    }
  }
}

export default TermsSwitch

And then use your factory like:

const options = {
    fields: {
        your_switch: {
          config: {
            onPressTerms: () => {
              ...
            },
          },
          factory: TermsSwitch,
          stylesheet: stylesheet,
        },
        ...
    },
}

I hope this can help you!

Good luck!

Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › react_native › react_native_switch.htm
React Native - Switch
import React, { Component } from ... ({ container: { flex: 1, alignItems: 'center', marginTop: 100 } }) If we press the switch, the state will be updated....
🌐
GitHub
github.com › nithinpp69 › react-native-switch-toggles
GitHub - nithinpp69/react-native-switch-toggles: react Native customizable switch component library
import Switch from 'react-native-switch-toggles'; const [isEnabled, setIsEnabled] = React.useState(false); .... <> <Text style={styles.label}>Simple Switch</Text> <Switch value={isEnabled} onChange={(value) => setIsEnabled(value)} /> </> <> <Text style={styles.label}>Switch with on/off indicator</Text> <Switch value={isEnabled} onChange={(value) => setIsEnabled(value)} activeTrackColor={'#45D058'} renderOffIndicator={() => ( <Text style={{ fontSize: 8, color: 'white' }}>OFF</Text> )} renderOnIndicator={() => ( <Text style={{ fontSize: 8, color: 'white' }}>ON</Text> )} /> </> <> <Text style={st
Starred by 19 users
Forked by 3 users
Languages   TypeScript 97.3% | JavaScript 2.2% | Shell 0.5% | TypeScript 97.3% | JavaScript 2.2% | Shell 0.5%
🌐
GitHub
github.com › shahen94 › react-native-switch
GitHub - shahen94/react-native-switch: Customisable switch component for RN · GitHub
import { Switch } from 'react-native-switch'; export const App = () => ( <Switch value={true} onValueChange={(val) => console.log(val)} disabled={false} activeText={'On'} inActiveText={'Off'} circleSize={30} barHeight={1} circleBorderWidth={3} backgroundActive={'green'} backgroundInactive={'gray'} circleActiveColor={'#30a566'} circleInActiveColor={'#000000'} renderInsideCircle={() => <CustomComponent />} // custom component to render inside the Switch circle (Text, Image, etc.) changeValueImmediately={true} // if rendering inside circle, change state immediately or wait for animation to comple
Starred by 293 users
Forked by 169 users
Languages   JavaScript
🌐
React Native
doc.ebichu.cc › react-native › releases › 0.43 › docs › switch.html
Switch
'use strict'; var React = require('react'); var ReactNative = require('react-native'); var { Platform, Switch, Text, View } = ReactNative; class BasicSwitchExample extends React.Component { state = { trueSwitchIsOn: true, falseSwitchIsOn: false, }; render() { return ( <View> <Switch onValueChange={(value) => this.setState({falseSwitchIsOn: value})} style={{marginBottom: 10}} value={this.state.falseSwitchIsOn} /> <Switch onValueChange={(value) => this.setState({trueSwitchIsOn: value})} value={this.state.trueSwitchIsOn} /> </View> ); } } class DisabledSwitchExample extends React.Component { rend
🌐
GitHub
github.com › baderahmed › react-native-customisable-switch
GitHub - baderahmed/react-native-customisable-switch: A React Native module that allows you to customize switch (style, form and animation), availble for android and IOS. · GitHub
import React, { Component } from 'react'; import { Text, View } from 'react-native'; import Switch from 'react-native-customisable-switch'; export default class Test extends Component { constructor(props) { super(props); this.state = { switchOneValue: false, switchTwoValue: false, switchThreeValue: true, }; } render() { const { switchOneValue, switchTwoValue, switchOneValue, } = this.state; return( <View style={styles.container}> <View style={styles.container}> <Switch value={switchOneValue} onChangeValue={() => this.setState({ switchOneValue: !switchOneValue })} /> </View> <View style={styles
Starred by 38 users
Forked by 28 users
Languages   JavaScript
🌐
CodingDeft
codingdeft.com › posts › react-native-switch
React Native Switch Example | CodingDeft.com
March 21, 2021 - Tutorial on how to implement a toggle switch component in React Native. Also, learn how to change the switch color based on the ON or OFF state .
🌐
EDUCBA
educba.com › home › software development › software development tutorials › react native tutorial › react-native switch
React-Native Switch | How Switch Component works in React-Native?
April 3, 2023 - import React, { Component } from 'react' import {StyleSheet, Switch, View, Text} from 'react-native' export default class SwitchExample extends Component { state = { switchValue: false }; render() { return ( <View style={styles.container}> <Text style={styles.textStyle}>This is an Example of Switch</Text> <Text style={styles.textStyle}>{this.state.switchValue ?
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Top answer
1 of 1
3

I have made a custom switch in react native and You can do the styling in it a source code is given below -

import React from 'react'
import { Text, TouchableOpacity } from 'react-native'
import styled from 'styled-components/native'

class App extends React.Component {
  state = {
    active: false
  }
  handleOFF = () => {
    this.setState({
      active: false
    });

  }

  handleOn = () => {
    this.setState({
      active: true
    });
  }

  render() {
    return (
      <MainView>
        <Label>
          <LabelOff onPress={this.handleOFF} active={this.state.active} activeOpacity={0.8}>
            <Off>OFF</Off>
          </LabelOff>
          <LabelOn onPress={this.handleOn} active={this.state.active} activeOpacity={0.8}>
            <On>ON</On>
          </LabelOn>
        </Label>
      </MainView>
    )
  }
}


const MainView = styled.View`
  margin:50px;
`
const Label = styled.View`
  height:60px;
  width:240px;
  flex-direction:row;
  justify-content:space-around;
  align-items:center;
  background-color:transparent;
`

const LabelOff = styled.TouchableOpacity`
  height:60px;
  width:120px;
  background-color:${props => props.active ? 'transparent' : '#cb6161'};
  border:2px solid #cb6161;
  border-right-width:0px;
  align-items:center;
  justify-content:space-around;
`
const LabelOn = styled.TouchableOpacity`
  height:60px;
  width:120px;
  background-color:${props => props.active ? '#55acee' : 'transparent'};
  border:2px solid #55acee;
  border-left-width:0px;
  align-items:center;
  justify-content:space-around;
`
const Off = styled.Text`
  font-size:22px;
`
const On = styled.Text`
  font-size:22px;
`
export default App 

Custom switch is done !

🌐
Callstack
oss.callstack.com › switch
Switch | React Native Paper
import * as React from 'react'; import { Switch } from 'react-native-paper'; const MyComponent = () => { const [isSwitchOn, setIsSwitchOn] = React.useState(false); const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn); return <Switch value={isSwitchOn} onValueChange={onToggleSwitch} />; }; export default MyComponent;
🌐
Callstack
oss.callstack.com › react-native-paper › 4.0 › switch.html
Switch · React Native Paper
Custom color for switch. onValueChange · Type: Function · Callback called with the new value when it changes. style · Type: StyleProp<ViewStyle> theme · Type: ReactNativePaper.Theme ·
🌐
Javatpoint
javatpoint.com › react-native-switch
React Native Switch - javatpoint
React Native Switch with tutorial, introduction, environment setup, first app hello world, state, props, flexbox, height and width, listview, scrollview, images, buttons, router, etc.
🌐
About React
aboutreact.com › home › react native switch
Example of React Native Switch Component - About React
November 21, 2020 - A Switch is a controlled component that requires a callback onValueChange that updates the value prop in order for the component to reflect user actions. If the value prop is not updated, the component will continue to render the supplied value ...