Comments (7)
On your switch component, assign a ref
prop as so;
ref={ref => this.dateSelectorSwitch = ref}
Then simply call the following (changing 0 for the index of the item to switch to);
this.dateSelectorSwitch.toggleItem(0);
from react-native-switch-selector.
@ChronSyn Thanks for this reply
from react-native-switch-selector.
im getting toggleItem of undefined.
Using "react-native-switch-selector": "^1.1.8"
from react-native-switch-selector.
Hi, i still cant get this to work, is there any other suggestions? on release build i get this error.
This error is log from xcode - e.props.showAlert is not a function
if i remove the line of code of ref = {...}, i wont get that error
from react-native-switch-selector.
@aliy321 have you solved this issue, i am facing same issue.
from react-native-switch-selector.
I solved by changing initial={this.state.opt} on trigger change the value of the "opt"
from react-native-switch-selector.
For those using hooks, this worked for me.
const switchRef = useRef(null);
//create a ref
ref={switchRef};
//Call the following (change 0 for the index of the other item)
switchRef.current.toggleItem(0);
from react-native-switch-selector.
Related Issues (20)
- Warning: componentWillReceiveProps is deprecated in 0.60 HOT 2
- valuePadding not working properly
- Add eslint in .circleci/config.yml HOT 2
- goBack and navigate again no border color and button color
- React Web version HOT 1
- Previous value on componentDidUpdate() HOT 1
- No spacing at the top on the button HOT 4
- Configuring initial with conditional based on prop HOT 2
- Change value dynamically after the initial render HOT 5
- Invalid prop type `options` HOT 3
- Problems with textColor and selectedColor HOT 2
- Custom font HOT 1
- Toggle not changed after change initial state at run time. HOT 3
- Accessibility Label HOT 5
- Switch selector not changing its values in "options" attribute when translated. HOT 1
- Allow change easing animation
- Change only de border color
- Change only the border color HOT 3
- Only one is usable per page
- SyntaxError: Support for the experimental syntax 'jsx' isn't currently enabled (154:9) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-switch-selector.