Skip to content

Commit bbb4c3c

Browse files
committed
Add custom Elements, Button
1 parent 204b01d commit bbb4c3c

File tree

8 files changed

+94
-21
lines changed

8 files changed

+94
-21
lines changed

src/navigators/navigation.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export const tabbedNavigation = () =>
3535
bottomTab: {
3636
fontSize: 12,
3737
text: 'Home',
38-
textColor: TYPOGRAPHY.Color.Primary,
39-
selectedTextColor: TYPOGRAPHY.Color.Primary,
38+
textColor: TYPOGRAPHY.COLOR.Primary,
39+
selectedTextColor: TYPOGRAPHY.COLOR.Secondary,
4040
icon: require('../view/assets/images/tabbar/home.png'),
4141
selectedIcon: require('../view/assets/images/tabbar/home.png'),
4242
},
@@ -61,8 +61,8 @@ export const tabbedNavigation = () =>
6161
bottomTab: {
6262
text: 'Settings',
6363
fontSize: 12,
64-
textColor: TYPOGRAPHY.Color.Primary,
65-
selectedTextColor: TYPOGRAPHY.Color.Primary,
64+
textColor: TYPOGRAPHY.COLOR.Primary,
65+
selectedTextColor: TYPOGRAPHY.COLOR.Secondary,
6666
icon: require('../view/assets/images/tabbar/settings.png'),
6767
selectedIcon: require('../view/assets/images/tabbar/settings.png'),
6868
},
@@ -77,7 +77,7 @@ export const tabbedNavigation = () =>
7777
bottomTabs: {
7878
visible: true,
7979
titleDisplayMode: 'alwaysShow',
80-
backgroundColor: TYPOGRAPHY.Color.Default,
80+
backgroundColor: TYPOGRAPHY.COLOR.Default,
8181
drawBehind: true,
8282
},
8383
},

src/view/assets/images/ts_rn.png

-26.9 KB
Binary file not shown.

src/view/elements/buttons.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as React from 'react';
2+
import { TouchableOpacity } from 'react-native';
3+
4+
import { GLOBAL } from '../styles/global';
5+
import { CText } from './custom';
6+
7+
type Callback = () => any;
8+
export interface Props {
9+
title: string;
10+
onClick: Callback;
11+
style?: Text.propTypes.style;
12+
}
13+
14+
interface State {}
15+
16+
/**
17+
* Default Button
18+
*/
19+
const ButtonDefault = ({ title, onClick, style }: Props) => (
20+
<TouchableOpacity
21+
activeOpacity={GLOBAL.CTA.TouchableOpacity.default}
22+
style={[GLOBAL.CTA.Style.primary, GLOBAL.LAYOUT.shadow, style]}
23+
onPress={() => onClick()}
24+
>
25+
<CText style={GLOBAL.CTA.Style.primaryText}>{title}</CText>
26+
</TouchableOpacity>
27+
);
28+
29+
export { ButtonDefault };

src/view/elements/custom.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import * as React from 'react';
2+
import { Text } from 'react-native';
3+
4+
import { GLOBAL } from '../styles/global';
5+
6+
export interface Props {
7+
style: Text.propTypes.style;
8+
}
9+
10+
interface State {}
11+
12+
class CText extends React.PureComponent<Props, State> {
13+
static defaultProps = {
14+
style: GLOBAL.TEXT.Default,
15+
};
16+
17+
render() {
18+
const { style, children } = this.props;
19+
20+
return (
21+
<Text {...this.props} style={[GLOBAL.TEXT.Default, style]}>
22+
{children}
23+
</Text>
24+
);
25+
}
26+
}
27+
28+
export { CText };

src/view/screens/home/Component.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as React from 'react';
2-
import { View, Text } from 'react-native';
2+
import { View } from 'react-native';
33

44
import styles from './styles';
5+
import { CText } from '../../elements/custom';
56

67
export interface Props {
78
name: string;
@@ -15,7 +16,7 @@ class Home extends React.PureComponent<Props, State> {
1516
constructor(props: Props) {
1617
super(props);
1718
this.state = {
18-
name: props.name || 'Amit',
19+
name: props.name || 'RN + TS + RNN2',
1920
};
2021
}
2122

@@ -26,8 +27,8 @@ class Home extends React.PureComponent<Props, State> {
2627

2728
return (
2829
<View style={styles.container}>
29-
<Text>Home</Text>
30-
<Text>{name}</Text>
30+
<CText>Home</CText>
31+
<CText>{name}</CText>
3132
</View>
3233
);
3334
}

src/view/screens/settings/Component.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as React from 'react';
2-
import { View, Text } from 'react-native';
2+
import { View } from 'react-native';
33

44
import styles from './styles';
5+
import { CText } from '../../elements/custom';
56

67
export interface Props {}
78

@@ -18,7 +19,7 @@ class Settings extends React.PureComponent<Props, State> {
1819
render() {
1920
return (
2021
<View style={styles.container}>
21-
<Text>Settings</Text>
22+
<CText>Settings</CText>
2223
</View>
2324
);
2425
}

src/view/screens/splash/Component.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as React from 'react';
2-
import { View, Text, SafeAreaView, Button } from 'react-native';
2+
import { View, Image, SafeAreaView } from 'react-native';
33

44
import { tabbedNavigation } from '../../../navigators/navigation';
55
import styles from './styles';
6+
import { ButtonDefault } from '../../elements/buttons';
67

78
export interface Props {}
89

@@ -24,8 +25,19 @@ class Splash extends React.PureComponent<Props, State> {
2425
return (
2526
<SafeAreaView style={{ flex: 1 }}>
2627
<View style={styles.container}>
27-
<Text>Splash</Text>
28-
<Button title="Continue" onPress={this.navigateToHome} />
28+
<Image
29+
style={styles.image}
30+
resizeMode="contain"
31+
source={require('../../assets/images/rnn2.png')}
32+
/>
33+
<Image
34+
resizeMode="center"
35+
source={require('../../assets/images/rn_ts.png')}
36+
/>
37+
<ButtonDefault
38+
title="Continue To App"
39+
onClick={this.navigateToHome}
40+
/>
2941
</View>
3042
</SafeAreaView>
3143
);

src/view/styles/global.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { StyleSheet, Platform } from 'react-native';
22

3-
import { TYPOGRAPHY } from './TYPOGRAPHY';
3+
import { TYPOGRAPHY } from './typography';
44

55
export const widgetPaddingValue = 16;
66

@@ -16,10 +16,10 @@ const LAYOUT = StyleSheet.create({
1616
padding: 16,
1717
},
1818
shadow: {
19-
shadowOpacity: 0.5,
20-
shadowRadius: 2.5,
21-
shadowOffset: { width: 2, height: 2 },
22-
elevation: Platform.OS === 'ios' ? 0 : 7,
19+
shadowOpacity: 0.25,
20+
shadowRadius: 3,
21+
shadowOffset: { width: 3, height: 3 },
22+
elevation: Platform.OS === 'ios' ? 0 : 3,
2323
},
2424
});
2525

@@ -31,8 +31,10 @@ const CTA = {
3131
justifyContent: 'space-between',
3232
height: 48,
3333
paddingVertical: 8,
34-
paddingHorizontal: 10,
35-
borderRadius: 5,
34+
paddingHorizontal: 20,
35+
borderRadius: 10,
36+
borderWidth: 1,
37+
backgroundColor: TYPOGRAPHY.COLOR.Default,
3638
},
3739
primaryText: {
3840
fontSize: 16,

0 commit comments

Comments
 (0)