【问题标题】:Text strings must be rendered within a <Text> component, while using MaterialDialog component在使用 MaterialDialog 组件时,文本字符串必须在 <Text> 组件中呈现
【发布时间】:2021-01-21 09:23:11
【问题描述】:

还有其他可用的解决方案,但它们与我的问题无关。 我在组件之外没有文本

 import { MaterialDialog } from 'react-native-material-dialog';
import React, {Component} from 'react';
import {View,Text,StyleSheet } from 'react-native';

export default class Test extends Component {
  constructor(props){
    super(props);[enter image description here][1]
    this.state = {
       visible: true,
    }
  }
  render() {
    return (
      <View>
        <MaterialDialog
          title={"Use Google's Location Service?"}
          visible={this.state.visible}
          onOk={() => this.setState({ visible: false })}
          onCancel={() => this.setState({ visible: false })}>
          <Text>
            Let Google help apps determine location. This means sending anonymous
            location data to Google, even when no apps are running.
          </Text>
        </MaterialDialog>;
      </View>
    )
  }
}

任何帮助表示赞赏!感谢这个美好的社区。​​p>

【问题讨论】:

    标签: android react-native


    【解决方案1】:

    删除分号 改变

    </MaterialDialog>;
    

    </MaterialDialog> 
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-30
    • 2021-02-02
    • 2019-02-20
    • 2022-01-18
    • 2020-10-25
    • 1970-01-01
    相关资源
    最近更新 更多