Skip to content

React Native Flex弹性布局 #15

Open
@1uokun

Description

@1uokun

如果让宽度自适应内容? Auto width of flex column

flex:1布局有时候会让字体无法撑开

<View>
  <View style={{ flex: 1 }}>
    <Text style={{ flex: 1 }}>width auto by content</Text>
  </View>
</View>

需要改成

<View>
-  <View style={{ flex: 1 }}>
-    <Text style={{ flex: 1 }}>width auto by content</Text>
+  <View style={{ flex: undefined }}>
+    <Text style={{ flex: undefined }}>width auto by content</Text>
  </View>
</View>

Metadata

Metadata

Assignees

No one assigned

    Labels

    blog日常开发笔记

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions