/** * 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, TouchableHighlight, DeviceEventEmitter } from 'react-native'; type Props = {}; export default class SharedDialog extends Component { state = { modalVisible: false }; setModalVisible(visible) { this.setState({ modalVisible: visible }); } render() { return ( { this.setState({ modalVisible: false }); }} > this.setState({ modalVisible: false })} > 分享 发给到群/好友 发朋友圈 ); } wechat() { this.setModalVisible(false); this.props.friend(); } circle() { this.setModalVisible(false); this.props.CircleOfFriends(); } setModalVisible(visible) { this.setState({ modalVisible: visible }); } } /*** 使用方法 (this.shareddialog = view)} /> this.shareddialog.setModalVisible(true);//true显示,false消失 */