react-native-navigation的迁移库

LightBoxScreen.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 LightBoxScreen 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 LightBox!
  18. </Text>
  19. {
  20. this.props.greeting &&
  21. <Text style={[styles.welcome, {fontSize: 16, marginTop: 20}]}>
  22. {this.props.greeting}
  23. </Text>
  24. }
  25. <TouchableOpacity onPress={() => this.onDismissPress()}>
  26. <Text style={styles.button}>Dismiss</Text>
  27. </TouchableOpacity>
  28. </View>
  29. );
  30. }
  31. onDismissPress() {
  32. this.props.navigator.dismissLightBox();
  33. }
  34. }
  35. var styles = StyleSheet.create({
  36. container: {
  37. flex: 1,
  38. width: Dimensions.get('window').width * 0.8,
  39. justifyContent: 'center',
  40. alignItems: 'center',
  41. backgroundColor: 'white',
  42. borderRadius: 10
  43. },
  44. welcome: {
  45. fontSize: 20,
  46. textAlign: 'center',
  47. margin: 10,
  48. },
  49. instructions: {
  50. textAlign: 'center',
  51. color: '#333333',
  52. marginBottom: 5,
  53. },
  54. button: {
  55. textAlign: 'center',
  56. fontSize: 18,
  57. marginBottom: 10,
  58. marginTop:10,
  59. color: 'blue'
  60. }
  61. });