React Native学习

RN跳转详情页面,用HTML显示

2018-11-11  本文已影响5人  废材helloword

import React, { Component } from "react";

import { View, Text, ScrollView, Dimensions } from "react-native";

import HTML from "react-native-render-html";

export default class Detils extends Component {


//标题

  static navigationOptions = ({ navigation }) => {

    return {

      title: navigation.getParam("name").title

    };

  };

  constructor(props) {

    super(props);

    this.state = {

      content: this.props.navigation.getParam("name").content

    };

  }

  render() {

    return (

      <ScrollView>

        <HTML

          html={this.state.content}

          imagesMaxWidth={Dimensions.get("window").width}

        />

      </ScrollView>

    );

  }

}

上一篇下一篇

猜你喜欢

热点阅读