24ark / react-native-step-indicator Goto Github PK
View Code? Open in Web Editor NEWA simple react-native implementation of step indicator widget compatible with the ViewPager and ListView.
License: Apache License 2.0
A simple react-native implementation of step indicator widget compatible with the ViewPager and ListView.
License: Apache License 2.0
Was curious if there was support for animation between steps? I have some code that may achieve this. I'll test the library tomm and see if I can integrate.
Great library been looking for a nice solution for this one for a while :)
Update: I have attached this zip with working animation version built on top of 'react-native-scrollable-tab-view' - I have not yet reviewed your solution but this might be a nice feature to support this as well.
Please Help
Need validation in each swipe of screens. Please help me
Can I change the alignment of labels?
I couldn't find any changelog that indicates a change in the api related to this property.
This occurs only when the step indicator is loaded with a certain step, but once it is animated to another step the coloring of the separator restores its correct behavior.
Also, if you noticed, the separator extends beyond the last step, i haven't looked into this yet. I only upgraded to 0.0.2, no code changes.
labels = [
languageStore.get('job', 'hire'),
languageStore.get('job', 'shareInfo'),
languageStore.get('job', 'agreement'),
languageStore.get('job', 'completion'),
languageStore.get('job', 'feedback')
];
customStyles = {
currentStepIndicatorLabelFontSize: 13,
currentStepIndicatorSize: 30,
currentStepLabelColor: colors.white,
currentStepStrokeWidth: 3,
labelColor: colors.white75,
labelSize: 13,
separatorFinishedColor: colors.yellow,
separatorStrokeWidth: 2,
separatorUnFinishedColor: colors.white,
stepIndicatorCurrentColor: colors.white,
stepIndicatorFinishedColor: colors.yellow,
stepIndicatorLabelCurrentColor: colors.white,
stepIndicatorLabelFinishedColor: colors.yellow,
stepIndicatorLabelFontSize: 13,
stepIndicatorLabelUnFinishedColor: colors.white,
stepIndicatorSize: 25,
stepIndicatorUnFinishedColor: colors.white,
stepStrokeCurrentColor: colors.white,
stepStrokeFinishedColor: colors.yellow,
stepStrokeUnFinishedColor: colors.white,
stepStrokeWidth: 3
};
// ..
<StepIndicator
labels={this.labels}
customStyles={this.customStyles}
currentPosition={jobStore.job.step} // 0-5
/>
I have used external components my code looks like this
import StepOne from '../StepOne'; import StepTwo from '../StepTwo'; import StepThree from '../StepThree'; const PAGES = [{"id":1,"page":<StepOne></StepOne>},{"id":2,"page":<StepTwo></StepTwo>},{"id":3,"page":<StepThree></StepThree>}];
Now the problem here is I need to manually trigger the transitions between pages I tried putting onPress={()=>this.viewpager.goToPage(2)}
in my StepOne component but it dosen't work
I have no idea is this even possible as i didn't find any example of the same. Can someone please help me with this.
Kindly add some example in doc or example app
I want to show like this
Basically i want to render tick image inside step circle and i've tried doing like this, but no success
<StepIndicator
customStyles={customStyles}
currentPosition={this.state.currentPosition}
stepCount={3}
renderStepIndicator={(state)=>{_this.putTickIndicator(state)}}
/>
putTickIndicator = (state)=> {
console.log(state)
return <Image source={require('./../../images/ic_backwd.png')} style={{tintColor: '#000000',height: 10, width:10}}/>
}
Can we have a spinner on the current step? Or a kind of pulsing animation?
I'm trying to use steps in the simplest way and typescript complains but when i run the app it works fine
import StepIndicator from 'react-native-step-indicator';
render() {
return (<StepIndicator currentPosition={0} labels={steps} />); // error shown here
}
[ts]
JSX element type 'StepIndicator' is not a constructor function for JSX elements.
Types of property 'state' are incompatible.
Type 'null' is not assignable to type 'Readonly<{}>'. [2605]
dependencies
"react": "16.6.1",
"react-native": "0.57.5",
"react-native-step-indicator": "0.0.9",
dev dependencies
"@types/node": "^10.12.9",
"@types/react": "16.7.6",
"@types/react-native": "0.57.11",
"typescript": "3.1.6"
vscode: v1.29.1
os: linux
hint: when i use const x = new StepIndicator({ labels: pasos, currentPosition: 0 });
it doesn't show errors and i can see the props suggestions
As the title says it would be cool to allow the developer to pass custom component to be used when rendering a particular step.
As the title says, we are getting warnings that componentWillReceiveProps is deprecated and will be removed in the next major version.
Please update to get this warning removed.
I am on versions
react-native: 0.60.5
react: 16.8.6
Hey, do you know if there would be an easy way to make labels alternate between both side of the bar?
(example: label 1 on left, label 2 on right etc.)
It would be nice if it adds support for custom label component instead of string
It's not possible to update styles after the component has been constructed. This is could be solved by storing the customStyles inside the component's state. This way it should respond to style changes.
Hello,
I have an issue for this repo but i don't see any template so i just write this issue.
I use this component in my project for several page and found something weird that i can't handle by my self.
Case : in one page, i have 2 tabs( let's say TAB 1 and TAB 2) and step indicator component for each page. At the first load, step indicators is running well and looks nice. But, when i press indicator number 2 in TAB 1 then i move to TAB 2 i found current indicator in TAB 2 is number 2. So i press again indicator number 3 in TAB 2 then i move back to TAB 1 i found current indicator in TAB 1 is number 3.
FYI, i use version 0.0.9 of this component. I used this with redux to save current indicator because i need current indicator index to scroll to next section so i can calculate x and y value.
I've implemented the step indicator in my app and It worked great so far, recently the onPress function of the step indicator stoped working. I dont know why, but when I inspect it (toggle inspector) and checkt it with react-devtools after I close the inspector it works again. I tried both on android studio emulator and on my android phone.
this is the code for the indicator:
<StepIndicator
onPress={(number) => this.stepPress(number)}
stepCount={4}
customStyles={customStyles}
currentPosition={this.state.currentPage}
labels={labels}
/>
and the handler:
stepPress(number) { console.log(number); if (number <= this.state.allowPages) { this.setState({currentPage: number}); this.refs.scrollview.setPage(number); } else { Alert.alert('you have to fill all forms before moving forward'); } }
the problem is that it doesn't even console until I open the inspector. please help thank you
Great work on the implementation. Only thing it only works with ListViews on iOS and not android.
If you convert to FlatList and add.
renderPage = ({item}) => {
return (
{item.title}
{item.body}
);
}
getVisibleRows = (visibleRows) => {
const visibleRowNumbers = visibleRows.viewableItems.map((row) => {
return row.index;
});
this.setState({currentPage:visibleRowNumbers[0]})
}
it will work across both platforms.
I can change stepIndicatorSize and currentStepIndicatorSize, but there should also be finishedStepIndicatorSize to update the size of the indicator as soon as it is finished
stepIndicatorLabelFinishedColor and stepIndicatorLabelUnFinishedColor do not work on ios on nexts steps just when current position is 0.
listview scrolling the StepIndicator was not follow
Can I use a gradient color on the background?
Hi,Im new to App development,and now im creating android and Ios apps in flutter framework.I really needed to add this step indicator in my application.Can anyone tell me how to add this into mine???
I tried react-native-step-indicator
with react-native new version. But it not worked. This is the package.json file.
{
"name": "app-test",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "25.0.0",
"react-native-scripts": "1.11.1",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^25.0.0",
"firebase": "^4.9.0",
"react": "16.2.0",
"react-dom": "^16.2.0",
"react-native": "0.52.0",
"react-native-android-kit": "^1.2.1",
"react-native-gesture-handler": "^1.0.0-alpha.40",
"react-native-indicators": "^0.11.1",
"react-native-paged-scroll-view": "^2.0.4",
"react-native-pathjs-charts": "0.0.33",
"react-native-router-flux": "^4.0.0-beta.28",
"react-native-step-indicator": "0.0.7",
"react-native-tab-view": "^0.0.74",
"react-native-tabs": "^1.0.9",
"react-native-viewpager": "^0.2.13",
"react-navigation": "^1.0.0-beta.27",
"victory": "^0.25.4",
"victory-native": "^0.17.0"
}
}
Good afternoon, I'm having trouble creating next and previous button, would you have any examples ??
I'm trying to use the RN navigation but it's not working, it brings me the error undefined is not object (evaluating this2.props.navigation.navigate)
Hi there,
I have tried using the property "labelAlign" with either values 'right' or 'left' to align the labels to the either side. However, the labels' alignment does not update and is still has the default 'center' alignment.
I see the blur in Android devices, what is the cause, I am I only getting this error.
The custom style I used
customStyles = {
stepIndicatorSize: 25,
currentStepIndicatorSize:35,
separatorStrokeWidth: 8,
currentStepStrokeWidth: 6,
stepStrokeCurrentColor: '#0b4f7c',
stepStrokeWidth: 0,
stepStrokeFinishedColor: '#196ea7',
stepStrokeUnFinishedColor: '#0b4f7c',
separatorFinishedColor: '#196ea7',
separatorUnFinishedColor: '#0b4f7c',
stepIndicatorFinishedColor: '#196ea7',
stepIndicatorUnFinishedColor: '#0b4f7c',
stepIndicatorCurrentColor: '#196ea7',
stepIndicatorLabelFontSize: 15,
currentStepIndicatorLabelFontSize: 15,
stepIndicatorLabelCurrentColor: '#ffffff',
stepIndicatorLabelFinishedColor: '#ffffff',
stepIndicatorLabelUnFinishedColor: '#ffffff',
labelColor: '#999999',
labelSize: 12,
currentStepLabelColor: '#196ea7'
}
Hello. i have long forms in ViewPager pages and when i Change pages step indiactor position work very slowly. i show my forms like this
` <ViewPager
style={{flexGrow:1}}
ref={(viewPager) => {this.viewPager = viewPager}}
onPageSelected={(page) => {this.setState({currentPage:page.position})}}
>
</ViewPager>`
i don't know how to set width of label
Awesome plugin. Followed your steps. I've set my currentPosition state to 0 initially and in componentdidupdate, I am changing the currentPosition state. I dont know how to animate this though. Can you please provide instructions for that?
thanks
How to change customStyle for specific position. For example, I have 4 steps, in which I have viewed 3. When I go back to step 1 or 2, until 3 steps the color should be the same and for 4th step it should be different.
What is the correct way to import StepIndicator
?
import StepIndicator from "react-native-step-indicator";
and import * as StepIndicator from "react-native-step-indicator";
not work. It says Property render is missing
. Changing this line to import * as React from "react"
work.
Here is my code
`const customStyles = {
stepIndicatorSize: 30,
currentStepIndicatorSize:35,
separatorStrokeWidth: 8,
currentStepStrokeWidth: 1,
stepStrokeCurrentColor: '#fe7013',
stepStrokeWidth: 3,
stepStrokeFinishedColor: '#fe7013',
stepStrokeUnFinishedColor: '#aaaaaa',
separatorFinishedColor: '#fe7013',
separatorUnFinishedColor: '#aaaaaa',
stepIndicatorFinishedColor: 'red',
stepIndicatorUnFinishedColor: '#ffffff',
stepIndicatorCurrentColor: 'red',
stepIndicatorLabelFontSize: 16,
currentStepIndicatorLabelFontSize: 16,
stepIndicatorLabelCurrentColor: '#fff',
stepIndicatorLabelFinishedColor:'#fff',
stepIndicatorLabelUnFinishedColor: '#000',
}
render() {
return (
<View style={styles.container}>
<StepIndicator
customStyles={customStyles}
currentPosition={this.state.currentPosition}
stepCount={3}
/>
</View>
);
}`
stepIndicatorLabelCurrentColor is working as shown in screenshot(white) but stepIndicatorLabelFinishedColor and stepIndicatorLabelUnFinishedColor are not working
Due react-native-viewpager
is no more maintenance. So please provide an example of another package. I suggest using https://github.com/zbtang/React-Native-ViewPager
Not able to apply custom fontFamily to the Label Text
Version 0.0.3
StepIndicator kept being updated with animating the current circle as another text input is typing in.
I want get index of item, go back or next to. I has read docs and i no see any props to i can do this.
So can you help me do this?
Thanks
It would be nice if it adds support for rtl.
steps from right to left
After running the example project, I get this error
Error: Couldn't find preset "es2015" relative to directory
I also try to install babel preset es2015 but the problem isn't resolved.
Can I know is it possible now to update customStyles dynamically ?
I Have set my styles in state and using the same in customStyles prop in StepIndicator.
I my case customStyle will change as pr the status change on indicator.
return
But the colors / styles are not reflecting/changing.
Please help me out here.
Hi,
I have written the same code from your example (HorizontalStepIndicator.js).
Happy with it,but i wanted something like i have a button below to the step indicators, and when i click on that button the step has to move to the next,so how do i achieve that.
(what is the onPress() that i have to write on that button)?
Please help.
I currently have a use case where I'd like the finished color per step to be dependent on some state of completion of the form that they have filled in.
For example, on each page of the form the user can check off "Opt out", and if they move on to the next page without fully completing the form, I'd like to render a different fill color for that step depending on the "completeness" of that step.
I currently just feed in an array of state that correspond to the position, and that conditionally renders the finished color for each step as complete("green"), or incomplete("red").
How would you approach this with the current API? Would this be a common use case for others that could warrant a pull request? I'm happy to contribute if so, but would like your input before I proceed.
Awesome component by the way, 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.