import React, { Component } from 'react'; import { Platform, SafeAreaView, StyleSheet, Text, View } from 'react-native'; import Wechat from '@uiw/react-native-wechat'; export default class App extends Component { state = { isInstall: false, isWXAppSupportApi: false, version: null, }; async componentDidMount() { const isInstall = await Wechat.isWXAppInstalled(); const isWXAppSupportApi = await Wechat.isWXAppSupportApi(); const version = await Wechat.getApiVersion(); this.setState({ isInstall, isWXAppSupportApi, version }); } render() { const { isInstall, isWXAppSupportApi, version } = this.state; return ( ☆Wechat Example☆ {isInstall ? '有' : '没有'}安装微信, 当前微信的版本{isWXAppSupportApi ? '支持' : '不支持'} OpenApi {version} ); } } const styles = StyleSheet.create({ container: { flex: 1, // justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, });