/** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow */ import React, { Component } from "react"; import { Platform, StyleSheet, Text, View, Image, TouchableOpacity, ImageBackground, TextInput, Button, StatusBar, Modal, ScrollView, TouchableHighlight, DeviceEventEmitter, findNodeHandle, UIManager } from "react-native"; import CitysData from "../../data/citys.json"; type Props = {}; export default class GradeSelectionModal extends Component { state = { modalVisible: false, grade_data: [ "一年级", "二年级", "三年级", "四年级", "五年级", "六年级", "七年级", "八年级", "九年级" ] }; render() { return ( { this.setState({ modalVisible: false }); }} > 我所在的年级 {this.centerView()} this.commit()} > 确定 ); } centerView() { return ( this.clickGrade()} style={styles.item} > 一年级 二年级 三年级 四年级 五年级 六年级 七年级 八年级 九年级 ); } commit() { alert("确定"); } setModalVisible(visible) { this.setState({ modalVisible: visible }); } clickGrade() {} } const styles = StyleSheet.create({ item: { width: 127, height: 53, backgroundColor: "rgba(61, 192, 252, 0.15)", borderRadius: 30 }, item_text: { flex: 1, textAlign: "center", textAlignVertical: "center", color: "rgba(58, 58, 58, 1)", fontSize: 18 } });