react-native-app-intro-slider
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -61,13 +61,20 @@ import React from 'react'; | ||
_renderButton = (content, onPress, isSkip) => { | ||
/*if (isSkip && !this.props.bottomButton && this.state.activeIndex == this.props.slides.length - 1) { | ||
return null; | ||
}*/ | ||
let style = isSkip ? styles.leftButtonContainer : styles.rightButtonContainer; | ||
_renderButton = (name, onPress) => { | ||
const show = (name === 'Skip' || name === 'Prev') ? this.props[`show${name}Button`] : !this.props[`hide${name}Button`]; | ||
const content = this.props[`render${name}Button`] ? this.props[`render${name}Button`]() : this._renderDefaultButton(name); | ||
return show && this._renderOuterButton(content, name, onPress); | ||
} | ||
_renderDefaultButton = (name) => { | ||
let content = <Text style={styles.buttonText}>{this.props[`${name.toLowerCase()}Label`]}</Text>; | ||
if (this.props.bottomButton) { | ||
content = <View style={[styles.bottomButton, isSkip && { backgroundColor: 'transparent' }]}>{content}</View>; | ||
style = styles.bottomButtonContainer; | ||
content = <View style={[styles.bottomButton, (name === 'Skip' || name === 'Prev') && { backgroundColor: 'transparent' }]}>{content}</View> | ||
} | ||
return content; | ||
} | ||
_renderOuterButton = (content, name, onPress) => { | ||
const style = (name === 'Skip' || name === 'Prev') ? styles.leftButtonContainer : styles.rightButtonContainer; | ||
return ( | ||
<View style={style}> | ||
<View style={this.props.bottomButton ? styles.bottomButtonContainer : style}> | ||
<TouchableOpacity onPress={onPress} style={this.props.bottomButton && styles.flexOne}> | ||
@@ -80,21 +87,9 @@ {content} | ||
_renderNextButton = () => { | ||
let content = this.props.renderNextButton ? this.props.renderNextButton() : <Text style={styles.buttonText}>{this.props.nextLabel}</Text>; | ||
return !this.props.hideNextButton && this._renderButton(content, this._onNextPress); | ||
} | ||
_renderNextButton = () => this._renderButton('Next', this._onNextPress) | ||
_renderPrevButton = () => { | ||
let content = this.props.renderPrevButton ? this.props.renderPrevButton() : <Text style={styles.buttonText}>{this.props.prevLabel}</Text>; | ||
return this.props.showPrevButton && this._renderButton(content, this._onPrevPress, true); | ||
} | ||
_renderPrevButton = () => this._renderButton('Prev', this._onPrevPress) | ||
_renderDoneButton = () => { | ||
let content = this.props.renderDoneButton ? this.props.renderDoneButton() : <Text style={styles.buttonText}>{this.props.doneLabel}</Text>; | ||
return !this.props.hideDoneButton && this._renderButton(content, this.props.onDone && this.props.onDone); | ||
} | ||
_renderDoneButton = () => this._renderButton('Done', this.props.onDone && this.props.onDone) | ||
_renderSkipButton = () => { | ||
let content = this.props.renderSkipButton ? this.props.renderSkipButton() : <Text style={styles.buttonText}>{this.props.skipLabel}</Text>; | ||
return this.props.showSkipButton && this._renderButton(content, this.props.onSkip && this.props.onSkip, true); | ||
} | ||
_renderSkipButton = () => this._renderButton('Skip', this.props.onSkip && this.props.onSkip) | ||
@@ -106,3 +101,2 @@ _renderPagination = () => { | ||
const skipBtn = (!isFirstSlide && this._renderPrevButton()) || (!isLastSlide && this._renderSkipButton()); | ||
// const skipBtn = this._renderPrevButton(); | ||
const btn = isLastSlide ? this._renderDoneButton() : this._renderNextButton(); | ||
@@ -109,0 +103,0 @@ |
@@ -22,5 +22,5 @@ import React from 'react'; | ||
<View style={[styles.mainContent, style]}> | ||
<Text style={styles.title}>{this.props.title}</Text> | ||
<Text style={[styles.title, this.props.titleStyle]}>{this.props.title}</Text> | ||
<Image source={this.props.image} style={this.props.imageStyle} /> | ||
<Text style={styles.text}>{this.props.text}</Text> | ||
<Text style={[styles.text, this.props.textStyle]}>{this.props.text}</Text> | ||
</View> | ||
@@ -27,0 +27,0 @@ ); |
{ | ||
"name": "react-native-app-intro-slider", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Simple and configurable app introduction slider for react native", | ||
@@ -5,0 +5,0 @@ "main": "AppIntroSlider.js", |
@@ -279,3 +279,5 @@ <h1 align="center">react-native-app-intro-slider</h1> | ||
title | `string` | The title | ||
titleStyle | `Style`-prop | Styling for the title (e.g color, fontSize) | ||
text | `string` | Main text of slide | ||
textStyle | `Style`-prop | Styling for the text (e.g color, fontSize) | ||
image | `Image`-source prop | Slide image | ||
@@ -282,0 +284,0 @@ imageStyle | `Style`-prop | Styling for the image (e.g. size) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
299
19662
243