Skip to content

Commit

Permalink
fix/props/style
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunGovil committed Jan 15, 2023
1 parent 39b9367 commit 89ed700
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 29 deletions.
36 changes: 36 additions & 0 deletions src/components/common/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import {View, Text, Image, useWindowDimensions} from 'react-native';
import {styles} from '../../styles';
import {TextStyles} from '../../types';

type ListItemProps = {
icon: any;
title: string;
description: string;
headingStyle?: TextStyles;
descriptionStyle?: TextStyles;
};

const ListItem = ({
icon,
title,
description,
headingStyle,
descriptionStyle,
}: ListItemProps) => {
const {width} = useWindowDimensions();
return (
<View style={[styles.swipeItem, {width: width}]}>
<Image style={styles.image} source={icon} />
<Text style={[styles.primaryText, headingStyle && headingStyle]}>
{title}
</Text>
<Text
style={[styles.secondaryText, descriptionStyle && descriptionStyle]}>
{description}
</Text>
</View>
);
};

export default ListItem;
10 changes: 7 additions & 3 deletions src/components/standard/StandardStepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ export default function StandardStepper({
<Text style={[styles.nextButton]}>Next</Text>
</TouchableOpacity>
) : (
<TouchableOpacity style={styles.skipButton} onPress={onFinish}>
<Text
style={[styles.skipItem, {backgroundColor: accentColor ? accentColor : '#93c01f'}]}>
<TouchableOpacity
style={[
styles.skipButton,
{backgroundColor: accentColor ? accentColor : '#93c01f'},
]}
onPress={onFinish}>
<Text style={styles.skipItem}>
{buttonTitle ? buttonTitle : 'Get Started'}
</Text>
</TouchableOpacity>
Expand Down
28 changes: 4 additions & 24 deletions src/screens/FlatBoard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {View, Text, Image, StatusBar, FlatList} from 'react-native';
import {View, StatusBar, FlatList} from 'react-native';
import React, {useState, useRef} from 'react';
import {useWindowDimensions} from 'react-native';
import {styles} from '../styles';
import {OnBoardingData, TextStyles} from '../types';
import ModernStepper from '../components/modern/ModernStepper';
import StandardStepper from '../components/standard/StandardStepper';
import ListItem from '../components/common/ListItem';

type FlatBoardProps = {
data: OnBoardingData[];
Expand All @@ -27,7 +27,6 @@ export default function FlatBoard({
headingStyle,
descriptionStyle,
}: FlatBoardProps) {
const {width} = useWindowDimensions();
const swipeRef = useRef<FlatList>(null);
const [step, setStep] = useState(0);

Expand All @@ -49,27 +48,6 @@ export default function FlatBoard({
});
};

type ListItemProps = {
icon: any;
title: string;
description: string;
};

const ListItem = ({icon, title, description}: ListItemProps) => {
return (
<View style={[styles.swipeItem, {width: width}]}>
<Image style={styles.image} source={icon} />
<Text style={[styles.primaryText, headingStyle && headingStyle]}>
{title}
</Text>
<Text
style={[styles.secondaryText, descriptionStyle && descriptionStyle]}>
{description}
</Text>
</View>
);
};

return (
<View style={styles.container}>
<StatusBar barStyle={'dark-content'} backgroundColor={'white'} />
Expand All @@ -92,6 +70,8 @@ export default function FlatBoard({
icon={item.icon}
description={item.description}
title={item.title}
headingStyle={headingStyle}
descriptionStyle={descriptionStyle}
/>
)}
contentContainerStyle={[
Expand Down
2 changes: 0 additions & 2 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ export const styles = StyleSheet.create({
skipButton: {
padding: 5,
borderRadius: 24,
backgroundColor: '#93c01f',
color: '#ffffff',
minWidth: 90,
textAlign: 'center',
},
skipItem: {
color: '#ffffff',
Expand Down

0 comments on commit 89ed700

Please sign in to comment.