2017-09-21 9 views

답변

0

model과 같이 대화 상자를 열 수 있습니다.

modeljs.js

import React, { Component } from 'react'; 
import { Text, View, Modal } from 'react-native'; 


export default class Modeljs extends Component { 

    render() { 
const { onPressCancel, onPressReport, visible } = this.props; 

    return (
     <Modal 
     animationType={'fade'} 
     transparent 
     visible={visible} 
     onRequestClose={() => { }} 
     > 
     <View 
      style={{ flex: 1, 
      justifyContent: 'center', 
      alignItems: 'center', 
      }} 
     > 
      <Text>You are in Model</Text> 
     </View> 
     </Modal>); 
    } 
} 
당신은 다음과 같이 화면에 modeljs을 사용할 수 있습니다

: 여기

그것을 위해 작은 예입니다 답변에 대한

state ={ 
    modalVisible: false, 
    seletData: [], 
    } 
    setModalVisible(visible) { 
    this.setState({ modalVisible: visible }); 
    } 
    modelPress(item) { 
    this.state = { ...this.state, seletData: item }; 
    this.setModalVisible(true); 
    } 
    renderReportDialog() { 
    return (
     <Modeljs 
     visible={this.state.modalVisible} 
     onPressCancel={() => { this.setModalVisible(false); }} 
     modelPress={(data) => { 
      this.setModalVisible(false); 
     }} 
     />); 
    } 
+0

감사의, 내가 정확히 무엇을했다 당신이 말했다,하지만 난이 오류가있어 –

+0

당신은 내게 오류를 줄 수 있습니까? 내 응용 프로그램 중 하나에서 이미 구현되었습니다. – Nirmalsinh

+0

답장을 보내 주셔서 감사합니다. 정확히 말했지만,이 오류가 있습니다. "정의되지 않은 함수 (평가하는 'inst.render()') –