Инвариантное расширение: объекты недопустимы как дочерние элементы React (найдено: объект с ключами {fontweight, fontsize}) - PullRequest
1 голос
/ 16 января 2020
Код

не читает значения веса шрифта и размера шрифта, но прекрасно работает с контейнером. как мне это исправить?

import React, { Component } from 'react'
import { StyleSheet, Text, View } from 'react-native'
export default class Splash extends Component {
    render() {
        return (
            <View style={styles.container}>
                <Text> style={styles.title} </Text>
            </View>
        )
    }
}
const styles = StyleSheet.create({
    container: {
        backgroundColor: 'white',
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    },
    title: {
        fontWeight: 'bold',
        fontSize: 18 
    }
})

1 Ответ

0 голосов
/ 16 января 2020

В этой строке кода

<Text> style={styles.title} </Text>

пожалуйста, измените ti:

<Text style={styles.title}>my data </Text>
...