首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >包含<Text>DeliverNow!</Text> <Text>Current位置</Text> <ChevronDownIcon/>的柔性盒增长视图容器需要占用整个空间

包含<Text>DeliverNow!</Text> <Text>Current位置</Text> <ChevronDownIcon/>的柔性盒增长视图容器需要占用整个空间
EN

Stack Overflow用户
提问于 2022-07-07 21:20:48
回答 1查看 44关注 0票数 1

**这里是我的主页代码**问题是包含<Text>DeliverNow!</Text> <Text>Current location</Text> <ChevronDownIcon/>的视图容器需要占用整个空间。但是它并没有占用整个左边的空间,UserIcon最终需要我使用的-增长,而不是工作,合理的内容属性,而不是工作

代码语言:javascript
复制
    *enter code here*
 <SafeAreaView className="bg-white pt-5">
      <Text className='text-red-500'>
        <View className="flex flex-row pb-3 items-center mx-4 space-x-2">
          <Image
            source={{
              uri: "https://links.papareact.com/wru",
            }}
            className="h-7 w-7 bg-gray-300 rounded-full p-4"
          />

> > > > flex-grow property is used here
**just Below view tag **
          <View className='flex-1'>
            <Text className="font-bold text-xs text-gray-300 ">
              Deliver Now!
            </Text>
            <Text className="font-bold text-xl">
              Current Location
              <ChevronDownIcon size={20} color="#00CCBB" />
            </Text>
          </View>
          <UserIcon size={35} color="#00CCBB"/>
        </View>
      </Text>
    </SafeAreaView>
EN

回答 1

Stack Overflow用户

发布于 2022-07-08 03:18:53

要使flex-1工作,关系应该是siblings而不是parent-child.,兄弟姐妹的父显示应该是灵活的。

代码语言:javascript
复制
Parent   // display flex
 - child // display flex-none or flex-1 or flex-auto
 - child // display flex-none or flex-1 or flex-auto

您的代码位于

代码语言:javascript
复制
<View>
  - <Image>
  - <View>    // This view is inside the other view because of which it is not showing the desired property.
     - <Text>
     - <Text>

要使事物正常工作,请使用以下继承结构

代码语言:javascript
复制
<View>
  - <Image>
<View>    
  - <Text>
  - <Text>

两个View的父类都应该具有flex显示属性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72904360

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档