1 | import React, { Component } from 'react';
|
2 | import { StyleSheet, Text, View, } from 'react-native';
|
3 | import PropTypes from 'prop-types';
|
4 | import Color from './Color';
|
5 | import { StylePropType } from './utils';
|
6 | const styles = StyleSheet.create({
|
7 | container: {
|
8 | alignItems: 'center',
|
9 | justifyContent: 'center',
|
10 | flex: 1,
|
11 | marginTop: 5,
|
12 | marginBottom: 10,
|
13 | },
|
14 | text: {
|
15 | backgroundColor: Color.backgroundTransparent,
|
16 | color: Color.defaultColor,
|
17 | fontSize: 12,
|
18 | fontWeight: '300',
|
19 | },
|
20 | });
|
21 | export default class SystemMessage extends Component {
|
22 | render() {
|
23 | const { currentMessage, containerStyle, wrapperStyle, textStyle, } = this.props;
|
24 | if (currentMessage) {
|
25 | return (<View style={[styles.container, containerStyle]}>
|
26 | <View style={wrapperStyle}>
|
27 | <Text style={[styles.text, textStyle]}>{currentMessage.text}</Text>
|
28 | </View>
|
29 | </View>);
|
30 | }
|
31 | return null;
|
32 | }
|
33 | }
|
34 | SystemMessage.defaultProps = {
|
35 | currentMessage: {
|
36 | system: false,
|
37 | },
|
38 | containerStyle: {},
|
39 | wrapperStyle: {},
|
40 | textStyle: {},
|
41 | };
|
42 | SystemMessage.propTypes = {
|
43 | currentMessage: PropTypes.object,
|
44 | containerStyle: StylePropType,
|
45 | wrapperStyle: StylePropType,
|
46 | textStyle: StylePropType,
|
47 | };
|
48 |
|
\ | No newline at end of file |