react-native-navigation的迁移库

NotificationScreen.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React, {Component} from 'react';
  2. import {
  3. StyleSheet,
  4. Text,
  5. View,
  6. TouchableOpacity,
  7. Dimensions
  8. } from 'react-native';
  9. export default class NotificationScreen extends Component {
  10. constructor(props) {
  11. super(props);
  12. }
  13. render() {
  14. return (
  15. <View style={styles.container}>
  16. <Text style={styles.welcome}>
  17. This is a Notification!
  18. </Text>
  19. <TouchableOpacity onPress={ this.onDismissPress.bind(this) }>
  20. <Text style={styles.button}>Dismiss</Text>
  21. </TouchableOpacity>
  22. </View>
  23. );
  24. }
  25. onDismissPress() {
  26. this.props.navigator.dismissInAppNotification();
  27. }
  28. }
  29. var styles = StyleSheet.create({
  30. container: {
  31. flex: 1,
  32. width: Dimensions.get('window').width,
  33. justifyContent: 'center',
  34. alignItems: 'center',
  35. backgroundColor: '#d6e7ad'
  36. },
  37. welcome: {
  38. fontSize: 20,
  39. textAlign: 'center',
  40. margin: 10,
  41. paddingTop: 20
  42. },
  43. button: {
  44. textAlign: 'center',
  45. fontSize: 18,
  46. marginBottom: 10,
  47. marginTop:10,
  48. color: '#4692ad'
  49. }
  50. });