You could create your own custom component with React Native. Just Inherit it and Create Own component like as https://github.com/arshigtx/react-native-custom-switch create a component copy inner src fix issues then make it your own. Please start the project.
----- Edited ------
https://snack-web-player.s3.us-west-1.amazonaws.com/v2/46/index.html?initialUrl=exp%3A%2F%2Fexp.host%2F%40snack%2Fsdk.46.0.0-HVS884TWR6&origin=https%3A%2F%2Fsnack.expo.dev&verbose=false
import React, { useState } from "react";
import { View, Switch, StyleSheet,Text } from "react-native";
const App = () => {
const [isEnabled, setIsEnabled] = useState(false);
const toggleSwitch = () => setIsEnabled(previousState => !previousState);
return (
<View style={styles.container}>
<View>
{
isEnabled ? <Text style={{position: 'absolute', color: 'white', top: 3, left: 2, zIndex: 5, fontSize: 11}} >On</Text> : <Text style={{position: 'absolute', color: 'white', top: 3, left: 20, zIndex: 5, fontSize: 11}}>Off</Text>
}
<Switch
trackColor={{ false: "#767577", true: "#81b0ff" }}
thumbColor={isEnabled ? "#f5dd4b" : "#f4f3f4"}
ios_backgroundColor="#3e3e3e"
onValueChange={toggleSwitch}
value={isEnabled}
/>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
}
});
export default App;
Answer from Cafer Yükseloğlu on Stack OverflowReact Native
reactnative.dev › docs › switch
Switch · React Native
3 weeks ago - Invoked when the user tries to change the value of the switch. Receives the new value as an argument.
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
Videos
05:29
React Native Switch Component - How to Add On/Off Toggle for Settings ...
React Native Switch Component Tutorial: How to Implement ...
React Native Tutorial - 61 - Switch
06:48
48 - React Native de A à Z - Switch - YouTube
09:35
React Native Tutorial 25 - React Native Switch Example - YouTube
Aprende sobre Switch en React Native
Swmansion
docs.swmansion.com › react-native-reanimated › examples › switch
Switch | React Native Reanimated
1 week ago - const Switch = ({ value, onPress, style, duration = 400, trackColors = { on: '#82cab2', off: '#fa7f7c' }, }) => { const height = useSharedValue(0); const width = useSharedValue(0); const trackAnimatedStyle = useAnimatedStyle(() => { const color = interpolateColor( value.value, [0, 1], [trackColors.off, trackColors.on] ); const colorValue = withTiming(color, { duration }); return { backgroundColor: colorValue, borderRadius: height.value / 2, }; }); const thumbAnimatedStyle = useAnimatedStyle(() => { const moveValue = interpolate( Number(value.value), [0, 1], [0, width.value - height.value] ); c
Normalize.css
necolas.github.io › react-native-web › docs › switch
Switch // React Native for Web
import { Switch } from 'react-native'; <Switch {...props} />;
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;
GitHub
github.com › nithinpp69 › react-native-switch-toggles
GitHub - nithinpp69/react-native-switch-toggles: react Native customizable switch component library
<> <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={styles.label}>Switch with on/off thumb indicator</Text> <Switch size={40} value={isEnabled} onChange={(value) => s
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%
React Native Archive
archive.reactnative.dev › docs › switch
Switch · React Native Archive
Renders a boolean input · This is a controlled component that requires an onValueChange callback 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 ...
npm
npmjs.com › package › toggle-switch-react-native
toggle-switch-react-native - npm
November 9, 2021 - Toggle Switch Component for react native, it works on Android, iOS and Web (react-native-web).
» npm install toggle-switch-react-native
Published Nov 09, 2021
Version 3.3.0
Author aminebenkeroum
TutorialsPoint
tutorialspoint.com › react_native › react_native_switch.htm
React Native - Switch
import React, { Component } from 'react' import { View, Switch, StyleSheet } from 'react-native' export default SwitchExample = (props) => { return ( <View style = {styles.container}> <Switch onValueChange = {props.toggleSwitch1} value = {props.switch1Value}/> </View> ) } const styles = StyleSheet.create ({ container: { flex: 1, alignItems: 'center', marginTop: 100 } })
GitHub
github.com › shahen94 › react-native-switch
GitHub - shahen94/react-native-switch: Customisable switch component for RN
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 297 users
Forked by 170 users
Languages JavaScript 100.0% | JavaScript 100.0%
Callstack
oss.callstack.com › react-native-paper › 4.0 › switch.html
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;
GitHub
github.com › arshigtx › react-native-custom-switch
GitHub - arshigtx/react-native-custom-switch: A fully customizable switch component for react native. · GitHub
Starred by 33 users
Forked by 12 users
Languages JavaScript
npm
npmjs.com › package › react-native-switch-toggle
react-native-switch-toggle - npm
This component supports horizontal switch toggle with animation with several options like start/end background colors, start/end circle colors, and duration for animation. Current package is fully redesigned in 2.0.0. We recommend you to use this package version >=2.0.0. Do you enjoy using react-native-switch-toggle?
» npm install react-native-switch-toggle
Published Jul 12, 2021
Version 2.2.1
Author dooboolab@gmail.com