我的应用 View
style
不工作。我将 react 0.44.0 与 2 个模拟器一起使用,但它们都无法正常工作。有人能帮我吗?
这是我的代码:
import React, { Component } from 'react';
import {
AppRegistry,
View,
ReactNative,
Text
} from 'react-native';
const Estilos = {
estiloTexto: {
fontSize: 40,
backgroundColor: '#08509B'
},
estiloView: {
backgroundColor: 'skyblue',
height: 300
}
};
//Criar o componente
const App = () => {
const { estiloTexto, estiloView } = Estilos;
return (
<View sytle={{ backgroundColor: 'skyblue', height: 300 }}>
<Text style={estiloTexto}>Frases do Dia</Text>
</View>
);
};
//Renderizar para o dispositivo
AppRegistry.registerComponent('app2', () => App);
应出现以下内容:IOS emulator 但是我得到了这个:Android
最佳答案
你的代码有错别字
<View sytle={{ backgroundColor: 'skyblue', height: 300 }}>
将 sytle
更改为 style
关于android - react native 。 View 的样式不起作用,我该如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52430489/