eftalyurtseven / react-native-wheel-of-fortune

React Native Wheel of Fortune Plugin
103 stars 89 forks source link

Spin wheel is moving for first time and then second time method called but wheel is not moving #11

Closed mohitdubey27 closed 3 years ago

mitalpatel5944 commented 4 years ago

Same problem

eftalyurtseven commented 4 years ago

Its added to do list.

leon2835 commented 4 years ago

Temporary walk around , just render using this.state.displayLuckyDraw to false, and set it back to true will do the work.

Xelanor commented 4 years ago

Some initial values should be set in the _onPress function if this is not the first run.

  1. The angle must be reset this._angle = new Animated.Value(0);
  2. The winner must be re-calculated. Because winner is defined in the beginning and does not change in the second run. this.winner = this.props.winner ? this.props.winner : Math.floor(Math.random() * this.numberOfSegments);
  3. The addListener should be called once again. Because even the upper suggestions are implemented, the "angle" and the "deg" does not change during the spin and winner number cannot be calculated.
    this._angle.addListener((event) => {
        this.angle = event.value;
    });

If you add these three things at the beginning of the _onPress() function. You will be able to spin the wheel more than once and get different results every time.

mohitdubey27 commented 4 years ago

Thanks a lot

On Fri, Aug 28, 2020 at 5:35 PM Xelanor notifications@github.com wrote:

Some initial values should be set in the _onPress function if this is not the first run.

  1. The angle must be 0 this._angle = new Animated.Value(0);
  2. The winner must be re-calculated. Because winner is defined in the beginning and does not change in the second run. this.winner = this.props.winner ? this.props.winner : Math.floor(Math.random() * this.numberOfSegments);
  3. The addListener should be called once again. Because even the upper suggestions are implemented, the "angle" and the "deg" does not change during the spin and winner number cannot be calculated.

    this._angle.addListener((event) => { this.angle = event.value; });

If you add these three things at the beginning of the _onPress() function. You will be able to spin the wheel more than once and get different results every time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eftalyurtseven/react-native-wheel-of-fortune/issues/11#issuecomment-682488578, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPH7J6YQIYLX3YHBIE4SZDSC6MR7ANCNFSM4M2RA2VQ .

-- Thanks and Regards,

Mohit Dubey www.singsys.com http://www.singsys.com/

SINGAPORE OFFICE 1 North Bridge Road #17-10 High Street Centre, Singapore (179094) P: +65-65613900

INDIA OFFICE Unit #4 to #8, 1st Floor, Omaxe Avenue Lucknow-226025 (India) P1: +91-9076566650 P2: +91-7991656548

http://www.linkedin.com/company/singsys-pte-ltd https://www.facebook.com/singsyspteltd https://twitter.com/singsyspteltd

Incorporated in Republic of Singapore Vide Company Registration Number: 200901690H and Republic of India Vide Corporate Identity Number: U72300UP2009PTC037410

Warning: Privileged/Confidential information may be contained in this communication (which includes any attachment). If you are not an intended recipient, you must not use, copy, disclose, distribute or retain this communication or any part of it. Instead, please delete all copies of this communication from your computer system and notify the sender immediately by reply mail. Thank you.

Please think of your environmental responsibility before printing this email.

eftalyurtseven commented 3 years ago

please upgrade to new version and call tryAgain function