Coder Social home page Coder Social logo

Comments (7)

ChronSyn avatar ChronSyn commented on August 20, 2024 1

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.

jkdrangel avatar jkdrangel commented on August 20, 2024

@ChronSyn Thanks for this reply

from react-native-switch-selector.

aliy321 avatar aliy321 commented on August 20, 2024

im getting toggleItem of undefined.

Using "react-native-switch-selector": "^1.1.8"

from react-native-switch-selector.

aliy321 avatar aliy321 commented on August 20, 2024

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.

naveedshahji avatar naveedshahji commented on August 20, 2024

@aliy321 have you solved this issue, i am facing same issue.

from react-native-switch-selector.

naveedshahji avatar naveedshahji commented on August 20, 2024

I solved by changing initial={this.state.opt} on trigger change the value of the "opt"

from react-native-switch-selector.

fadiaIW avatar fadiaIW commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.