colbymillerdev / react-native-progress-steps

A simple and fully customizable React Native component that implements a progress stepper UI.
MIT License
377 stars 147 forks source link

Control the step change by ProgressStep components #35

Closed mateuscdomingos closed 4 years ago

mateuscdomingos commented 4 years ago

Change of control step by parent component. In my ProgressStep, there is a button that calls a route from my API, if it works, the Steps will need to call the next step.

colbymillerdev commented 4 years ago

Hello - Thanks for opening this issue! You can try using and updating the activeStep prop on the <ProgressSteps /> component.

mateuscdomingos commented 4 years ago

activeStep allows you to start the component on a specific screen; if I change activeStep, the component will not be rendered because ProgressSteps manages the state. I did a fork to solve my problem, but I already send it as a pull request

colbymillerdev commented 4 years ago

Ah sorry, I think I misunderstood your original question. Didn't realize you were trying to change steps without using the button onPress.

I don't see a PR from you currently, but if you open one I'll review and see if it makes sense to merge it in!

I will also look into this and see if there's a good way it can be achieved currently.

curtismenmuir commented 4 years ago

I have a fix this issue (along with other issues) in a PR: https://github.com/colbymillerdev/react-native-progress-steps/pull/38 -> added componentWillUpdate function to update state when activeStep prop is updated

15110011 commented 4 years ago

I've setState activeStep but it still dont rerender. Does it work?

curtismenmuir commented 4 years ago

@15110011 my PR has been merged but a new build has not been released to NPM / Yarn. You would need to pull the lib straight from git in your package,json to get the changes now! @colbymillerdev do you know when a build with the latest changes will be released?

colbymillerdev commented 4 years ago

@15110011 @curtismenmuir I'm gathering up a few more changes before pushing out the next release, but should have it out shortly

15110011 commented 4 years ago

@curtismenmuir So how to pull the lib, could you give me the package name? I dont know how to pull from PR. Could you guide me? @colbymillerdev I really need active step now, so try to merge it for release as soon as you can. Thank you xD

curtismenmuir commented 4 years ago

@15110011 if you need to test changes locally for now then you could pull my PR:

  1. Remove lib if previously installed
  2. Add "react-native-progress-steps": "git+https://github.com/curtismenmuir/react-native-progress-steps.git", to your package.json
  3. Install with yarn / npm install.

TBH I would recommend waiting for @colbymillerdev to release the package as this should not be used in production. Colby has also added more changes since my PR, you will NOT have access to them. If you do use my PR fork then you MUST update to pull from main package when released (I will be removing that fork once changes are available in main package). If you do not update to main package your builds will fail once I remove the fork. To remove my PR run yarn remove react-native-progress-steps and then install main package.

colbymillerdev commented 4 years ago

Sorry for the delay, but the newest release including these changes is now published on NPM.

https://github.com/colbymillerdev/react-native-progress-steps/releases/tag/v1.3.0