嵌套文本的样式不起作用反应原生

时间:2018-06-16 08:26:12

标签: javascript react-native

App.js:

import React, { Component } from "react";
import { Text, View, StyleSheet } from "react-native";

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>
          <Text>First</Text>
          <Text style={{ borderBottomWidth: 1 }}>Second</Text>
          <Text>Third</Text>
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
    backgroundColor: "#ECF0F1"
  }
});

如您所见,我们已嵌套<Text>个组件。问题是某些样式道具,例如borderBottomWidth - marginVertical - width不适用于嵌套组件!

解决这个问题的任何想法?

  

提前致谢!

0 个答案:

没有答案