Skip to content

Commit

Permalink
add re-usable message screen template
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszpmroz committed Apr 9, 2020
1 parent 9a12503 commit 890771c
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 0 deletions.
Binary file added src/assets/images/bvWalletIconSuccess.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/bvWalletIconSuccess@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/bvWalletIconSuccess@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const images = {
addressBookInactive: require('./images/addressBookInactive.png'),
settings: require('./images/settings.png'),
settingsInactive: require('./images/settingsInactive.png'),
success: require('./images/bvWalletIconSuccess.png'),
dashboardNoWallet: require('./images/bvWalletIconNoCards.png'),
addressBookNoContacts: require('./images/addressBookNoContacts.png'),
};
2 changes: 2 additions & 0 deletions src/navigators/RootNavigator.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { createStackNavigator } from 'react-navigation';

import { MainTabNavigator } from './MainTabNavigator';
import { MessageScreen } from 'screens';

export const RootNavigator = createStackNavigator(
{
MainTabNavigator,
Message: MessageScreen,
},
{
headerMode: 'none',
Expand Down
47 changes: 47 additions & 0 deletions src/screens/MessageScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import { Image, FastImageSource } from 'components/Image';
import { ButtonProps } from 'react-native-elements';
import { Text, View, StyleSheet } from 'react-native';
import { useNavigationParam } from 'react-navigation-hooks';
import { Button } from 'components/Button';

import { typography, palette } from 'styles';

export const MessageScreen = () => {
const title: string = useNavigationParam('title');
const source: FastImageSource = useNavigationParam('source');
const description: string = useNavigationParam('description');
const button: ButtonProps | undefined = useNavigationParam('button');

return (
<View style={styles.container}>
<Text style={styles.title}>{title}</Text>
<Image source={source} style={styles.image} resizeMode="contain" />
<Text style={styles.description}>{description}</Text>
{button && <Button {...button} />}
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
padding: 50,
},
title: { ...typography.headline4 },
image: {
height: 172,
width: '100%',
marginTop: 40,
marginBottom: 40,
},
description: {
...typography.caption,
color: palette.textGrey,
textAlign: 'center',
lineHeight: 19,
marginBottom: 97,
},
});
1 change: 1 addition & 0 deletions src/screens/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { AddressBookScreen } from './AddressBookScreen';
export { MessageScreen } from './MessageScreen';
8 changes: 8 additions & 0 deletions src/services/NavigationService.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as React from 'react';

export const navigationRef: any = React.createRef();

export function navigate(name: string, params?: any) {
// eslint-disable-next-line prettier/prettier
navigationRef.current?.navigate(name, params);
}

0 comments on commit 890771c

Please sign in to comment.