import React, { Component } from 'react'; import { SafeAreaView, KeyboardAvoidingView, } from 'react-native'; import events from '../../events'; import DevTool from './index'; import Modal from '../base/Modal'; class Events extends Component { constructor() { super(); this.state = { visible: false, }; this.listen = this.listen.bind(this); } componentDidMount() { events.listen(this.listen); } componentWillUnmount() { events.unlisten(this.listen); } listen(type, data) { if (type === 'SHOW_DEVTOOLS') { return this.setState({ visible: true, }); } if (type === 'HIDE_DEVTOOLS') { return this.setState({ visible: false, }); } } render() { const { ...others } = this.props; return ( { }} > { events.publish('HIDE_DEVTOOLS'); }} /> ) } } export default Events;