aminebenkeroum / toggle-switch-react-native Goto Github PK
View Code? Open in Web Editor NEWToggle Switch React Native Component works on both iOS and Android
License: MIT License
Toggle Switch React Native Component works on both iOS and Android
License: MIT License
I found that your component takes much CPU when app in background, around 20%.
Could you please figure out the reason?
Is it possible to set disabled state for toggle switch?
<ToggleSwitch isOn={this.state.toggle} />
When I change the toggle state to true once all the components are rendered it doesn't update the toggle button to true
My code for changong the toggle state :
this.setState({ toggle: true })
Hey i'm using this in flatlist which render multiple switches, but it is not updating isOn value
Module parse failed: Unexpected token (52:19)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
|
> static propTypes = {
| isOn: PropTypes.bool.isRequired,
| label: PropTypes.string,
babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
"@babel/plugin-proposal-class-properties",
[
"babel-plugin-inline-import",
{
extensions: [".svg"],
},
],
],
};
};
It could be nice to have disabled
style prop. It's better to change the color or opacity when the switch is disabled so it doesn't look like it's active. Thanks!
This should be the setting for medium toggle button, not the current one
{ width: 60, padding: 14, circleWidth: 24, circleHeight: 24, translateX: 30 }
When installing this lib in a TypeScript project (e.g default Expo project) the included definition does not work.
Should probably look like this (which I'm using):
/// <reference types="node" />
declare module 'toggle-switch-react-native' {
import React from 'react';
import {StyleProp, TextStyle, ViewStyle} from 'react-native';
export type ToggleSwitchProps = {
isOn: boolean;
label?: string;
onColor?: string;
offColor?: string;
size?: string;
labelStyle?: StyleProp<TextStyle>;
thumbOnStyle?: StyleProp<ViewStyle>;
thumbOffStyle?: StyleProp<ViewStyle>;
trackOnStyle?: StyleProp<ViewStyle>;
trackOffStyle?: StyleProp<ViewStyle>;
onToggle?: (isOn: boolean) => any;
icon?: React.ReactNode;
disabled?: boolean;
animationSpeed?: number;
useNativeDriver?: boolean;
circleColor?: string;
};
class ToggleSwitch extends React.Component<ToggleSwitchProps> {}
export default ToggleSwitch;
}
The event was not monitored when it was closed
Hi,
Can you help here.
Toggle-switch-react-native is working fine for android but in ios it is not working it,s not getting on please help...
Will it work for ios or only for android.
Sometimes the hit area is too small to tap on, it will be good if we can have a prop to control the hitSlop
.
You can also add the following features
1.Label text need to change dynamically for on and off like "available" "not-available"
2.Label text position left or right options
3.Icon size with custom height and width instead of small,medium, and large
Hi, I noticed there was no way to pass in any Accessibility props so users with their screen readers enabled cannot know what this plugin can do.
At minimum:
I was planning on making a PR to add in these props but wanted to submit this "issue/enhancement" first.
Typing this:
npm i --save-dev @types/toggle-switch-react-native
Will result:
'@types/toggle-switch-react-native@*' is not in this registry.
You should bug the author to publish it (or use the name yourself!)
Can't wait to see it fix :)
Thank you,
Take care
Is it possible to add "Label" style to left and "Toggle" to right in the same usage? The label will be on left of Toggle for now but it seems can't add more space style between it. May be I just don't know how to do it. Can't you guys (someone) guide me? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.