【问题标题】:render error ract-native (text strings must be rendered within a<text>component)渲染错误 react-native(文本字符串必须在 <text> 组件内渲染)
【发布时间】:2022-10-08 16:47:15
【问题描述】:

我想不通,我尝试了很多东西

enter image description here

import { Text, View } from 'react-native'
import React, {useState} from 'react'

const App = () => {
  const [show, setShow] = useState(false);
  return (
    <view>
      <text>Hello</text>
    </view>
  )
}

export default App;

【问题讨论】:

标签: react-native


【解决方案1】:

您正在使用 &lt;view&gt; 和 &lt;text&gt; 而不是 &lt;View&gt; 和 &lt;Text&gt;
尝试这个,

import { Text, View } from 'react-native'
import React, {useState} from 'react'

const App = () => {
  const [show, setShow] = useState(false);
  return (
    <View>
      <Text>Hello</Text>
    </View>
  )
}

export default App;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-27
    • 2018-08-30
    • 2018-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多