Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/Page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dimensions, Text, View } from 'react-native';
import { Dimensions, Platform, Text, View } from 'react-native';
import PropTypes from 'prop-types';
import React from 'react';

Expand All @@ -14,12 +14,15 @@ const Page = ({
allowFontScaling = true,
titleStyles = null,
subTitleStyles = null,
fontFamily = null,
}) => {
let titleElement = title;
if (typeof title === 'string' || title instanceof String) {
titleElement = (
<View style={styles.padding}>
<Text allowFontScaling={allowFontScaling} style={[styles.title, isLight ? styles.titleLight : {}, titleStyles]}>
<Text allowFontScaling={allowFontScaling} style={[styles.title, isLight ? styles.titleLight : {}, titleStyles,
fontFamily || {},
]}>
{title}
</Text>
</View>
Expand All @@ -30,7 +33,9 @@ const Page = ({
if (typeof subtitle === 'string' || subtitle instanceof String) {
subtitleElement = (
<View style={styles.padding}>
<Text allowFontScaling={allowFontScaling} style={[styles.subtitle, isLight ? styles.subtitleLight : {}, subTitleStyles]}>
<Text allowFontScaling={allowFontScaling} style={[styles.subtitle, isLight ? styles.subtitleLight : {}, subTitleStyles,
fontFamily || {},
]}>
{subtitle}
</Text>
</View>
Expand Down Expand Up @@ -67,6 +72,9 @@ Page.propTypes = {
}),
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
fontFamily: PropTypes.shape({
style: PropTypes.any,
}),
};

const { width, height } = Dimensions.get('window');
Expand Down
10 changes: 8 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
I18nManager,
StatusBar,
SafeAreaView,
View,
Platform,
} from 'react-native';

import PropTypes from 'prop-types';
Expand Down Expand Up @@ -90,6 +90,7 @@ class Onboarding extends Component {
imageContainerStyles,
allowFontScalingText,
titleStyles,
fontFamily,
subTitleStyles,
} = this.props;

Expand All @@ -104,6 +105,7 @@ class Onboarding extends Component {
containerStyles={containerStyles}
imageContainerStyles={imageContainerStyles}
allowFontScaling={allowFontScalingText}
fontFamily={fontFamily}
titleStyles={Object.assign(
{},
titleStyles || {},
Expand Down Expand Up @@ -271,9 +273,12 @@ Onboarding.propTypes = {
}),
allowFontScalingText: PropTypes.bool,
allowFontScalingButtons: PropTypes.bool,
titleStyles: PropTypes.shape({
fontFamily: PropTypes.shape({
style: PropTypes.any,
}),
fontFamily:PropTypes.shape({
style:PropTypes.string
}),
subTitleStyles: PropTypes.shape({
style: PropTypes.any,
}),
Expand Down Expand Up @@ -304,6 +309,7 @@ Onboarding.defaultProps = {
allowFontScalingText: true,
allowFontScalingButtons: true,
titleStyles: null,
fontFamily:null,
subTitleStyles: null,
transitionAnimationDuration: 500,
skipToPage: null,
Expand Down