Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 如何在其他样式化组件中使用样式化组件中的边距 从“React”导入React; 从“样式化组件/本机”导入样式化; 从“react native”导入{Text,View}; 导出默认函数HelloWorldApp(){ 返回( 你好,世界 你好,世界 ); } const StyledBody=styled.View` `; const StyledBody2=styled(StyledBody)` //它不起作用 利润率:20px; `;_React Native_Styled Components - Fatal编程技术网

React native 如何在其他样式化组件中使用样式化组件中的边距 从“React”导入React; 从“样式化组件/本机”导入样式化; 从“react native”导入{Text,View}; 导出默认函数HelloWorldApp(){ 返回( 你好,世界 你好,世界 ); } const StyledBody=styled.View` `; const StyledBody2=styled(StyledBody)` //它不起作用 利润率:20px; `;

React native 如何在其他样式化组件中使用样式化组件中的边距 从“React”导入React; 从“样式化组件/本机”导入样式化; 从“react native”导入{Text,View}; 导出默认函数HelloWorldApp(){ 返回( 你好,世界 你好,世界 ); } const StyledBody=styled.View` `; const StyledBody2=styled(StyledBody)` //它不起作用 利润率:20px; `;,react-native,styled-components,React Native,Styled Components,在react native中,边距在其他样式化组件内部的样式化组件中使用时不起作用。我需要特定的方式样式化(StyledBody) import React from 'react'; import styled from 'styled-components/native'; import { Text, View } from 'react-native'; export default function HelloWorldApp() { return ( <>

在react native中,边距在其他样式化组件内部的样式化组件中使用时不起作用。我需要特定的方式样式化(StyledBody)

import React from 'react';
import styled from 'styled-components/native';
import { Text, View } from 'react-native';

export default function HelloWorldApp() {
  return (
    <>
      <StyledBody2>
        <Text>Hello, world!1</Text>
      </StyledBody2>

      <Text>Hello, world!2</Text>
    </>
  );
}

const StyledBody = styled.View`

`;

const StyledBody2 = styled(StyledBody)`
  //it doesn't work
  margin: 20px;
`;