import React, { Component } from 'react';import { AppRegistry, StyleSheet, Text, View, ScrollView, Dimensions,} from 'react-native';import QuestionItem from './QuestionItem';var questionData = { title:"1.根据我们所学的正、负数的知识,请回答:海水涨了-4cm的意义 ( )", select1:"(A)海水涨了4cm", select2:"(B)海水下降了4cm", select3:"(C)海水水位没有变化", select4:"(D)海水上涨或下降的数字是个相对值,因此不存在负数的说法",}class Question extends Component { constructor(props) { super(props); this.state = {dataArray: []}; this.fetchData(); } render() { return ( { this.state.dataArray.map((item, i) => this.renderQuestionItem(item, i)) } ); } renderQuestionItem(item, i) { return } fetchData() { for (let i = 0;i < 10;i++) { this.state.dataArray.push(questionData); } }}const styles = StyleSheet.create({ scrollView: { flex: 1, backgroundColor: '#F5FCFF', width:Dimensions.get('window').width, margin:5, },});AppRegistry.registerComponent('Hello', () => Question);
react-native ScrollView的简单应用
最新推荐文章于 2024-04-29 00:32:49 发布