rn-app-intro
rn-app-intro is a react native component implementing a parallax effect welcome page using base on react-native-swiper , similar to the one found in Google's app like Sheet, Drive, Docs...
rn-app-intro Screen Capture
Support ios、android
Installation
$ npm i rn-app-intro --save
Basic Usage
You can use pageArray quick generation your app intro with parallax effect. With the basic usage, the Android status bar will be updated to match your slide background color.
;;; { Alert; console; } { Alert; } { Alert; console; } { console; } { const pageArray = title: 'Page 1' description: 'Description 1' img: 'https://goo.gl/Bnc3XP' imgStyle: height: 80 * 25 width: 109 * 25 backgroundColor: '#fa931d' fontColor: '#fff' level: 10 title: 'Page 2' description: 'Description 2' img: imgStyle: height: 93 * 25 width: 103 * 25 backgroundColor: '#a4b602' fontColor: '#fff' level: 10 ; return <AppIntro onNextBtnClick=thisnextBtnHandle onDoneBtnClick=thisdoneBtnHandle onSkipBtnClick=thisonSkipBtnHandle onSlideChange=thisonSlideChangeHandle pageArray=pageArray /> ; } AppRegistry;
Advanced Usage
If you need customized page like my Example, you can pass in View
component into AppIntro component and set level. Remember any need use parallax effect component, Need to be <View level={10}></View>
inside.
;;; const styles = StyleSheet; { return <AppIntro> <View style=stylesslide backgroundColor: '#fa931d' > <View level=10><Text style=stylestext>Page 1</Text></View> <View level=15><Text style=stylestext>Page 1</Text></View> <View level=8><Text style=stylestext>Page 1</Text></View> </View> <View style=stylesslide backgroundColor: '#a4b602' > <View level=-10><Text style=stylestext>Page 2</Text></View> <View level=5><Text style=stylestext>Page 2</Text></View> <View level=20><Text style=stylestext>Page 2</Text></View> </View> <View style=stylesslide backgroundColor: '#fa931d' > <View level=8><Text style=stylestext>Page 3</Text></View> <View level=0><Text style=stylestext>Page 3</Text></View> <View level=-10><Text style=stylestext>Page 3</Text></View> </View> <View style=stylesslide backgroundColor: '#a4b602' > <View level=5><Text style=stylestext>Page 4</Text></View> <View level=10><Text style=stylestext>Page 4</Text></View> <View level=15><Text style=stylestext>Page 4</Text></View> </View> </AppIntro> ; }AppRegistry;
And in Android, image inside view component, view need width、height.
<View style= position: 'absolute' top: 80 left: 30 width: windowswidth height: windowsheight level=20> <Image style= width: 115 height: 70 source= /></View>
Properties
Prop | PropType | Default Value | Description |
---|---|---|---|
dotColor | string | 'rgba(255,255,255,0.3)' | Bottom of the page dot color |
activeDotColor | string | '#fff' | Active page index dot color |
rightTextColor | string | '#fff' | The bottom right Text Done、> color |
leftTextColor | string | '#fff' | The bottom left Text Skip color |
onSlideChange | (index, total) => {} | function to call when the pages change | |
onSkipBtnClick | (index) => {} | function to call when the Skip button click | |
onDoneBtnClick | func | function to call when the Done button click | |
onNextBtnClick | (index) => {} | function to call when the Next '>' button click | |
doneBtnLabel | string、Text element | Done | The bottom right custom Text label |
skipBtnLabel | string、Text element | Skip | The bottom left custom Text label |
nextBtnLabel | string、Text element | › | The bottom left custom Text label |
pageArray | array | In the basic usage, you can input object array to render basic view example: [[{title: 'Page 1', description: 'Description 1', img: 'https://goo.gl/uwzs0C', imgStyle: {height: 80 * 2.5, width: 109 * 2.5 }, backgroundColor: '#fa931d', fontColor: '#fff', level: 10 }] , level is parallax effect level ,if you use pageArray you can't use custom view |
|
defaultIndex | number | 0 | number of the index of the initial index |
showSkipButton | bool | true | a boolean defining if we should render the skip button |
showDoneButton | bool | true | a boolean that defines if we should render the done button |
showDots | bool | true | a boolean that defines if we should render the bottom dots |
Children View Properties
Prop | PropType | Default Value | Description |
---|---|---|---|
level | number | parallax effect level |