小编HE *_*hao的帖子

如何破解.map功能

如何打破.map功能?代码示例如下.我希望在索引达到5时打破外观,因为我只想将5个头像渲染到屏幕上.

<View style={{ flexDirection: 'row', marginTop: 20, marginLeft: 30  }}>
    {
      peopleGroup.map((people, i) => {
        if(i<5) {
          return (
            <Avatar
              key={people.id}
              width={30}
              position='absolute'
              containerStyle={{ transform: [{translate: [-28 + (28 * i), 0, 1 - (i * 0.1)]}] }}
              small
              rounded
              source={{uri: people.image}}
              activeOpacity={0.7}
              />
          )
        }else if(i===5) {
          return (
          <View key={i} style={{ transform: [{translate: [(25 * i), 9, 0]}]  }}>
            <Text>{peopleGroup.length}</Text>
          </View>
          )
        }
      }
      )
    }
</View>
Run Code Online (Sandbox Code Playgroud)

reactjs react-native

8
推荐指数
1
解决办法
6896
查看次数

错误:“ @ scalarList”的策略参数的有效值为:RELATION

@scalarList在运行pyramida部署后,程序会弹出->(策略参数的有效值是:RELATION。)。谁知道为什么?

type User {
  id: ID! @id
  name: String!
  email: String! @unique
  password: String!
  age: Int
  img: String
  location: Location
  hostedEvents: [Event]! @relation(name: "HostedEvents", onDelete: CASCADE)
  joinedEvents: [Event]! @relation(name: "EventMembers", onDelete: CASCADE)
  pushNotificationTokens: [PushNotificationTokens]!
  createdAt: DateTime! @createdAt
  updatedAt: DateTime! @updatedAt
}
Run Code Online (Sandbox Code Playgroud)
type Event {
  id: ID! @id
  owner: User! @relation(name: "HostedEvents")
  name: String!
  imgs: [String]!
  description: String
  start: DateTime!
  end: DateTime!
  categories: [Category]!
  members: [User]! @relation(name: "EventMembers")
  chatRoom: GroupChatRoom!
  pendingRequests: [PendingRequest]!
  locations: [Location]!
  comments: [Comment]!
  createdAt: DateTime! @createdAt
  updatedAt: …
Run Code Online (Sandbox Code Playgroud)

graphql prisma prisma-graphql

3
推荐指数
1
解决办法
673
查看次数

标签 统计

graphql ×1

prisma ×1

prisma-graphql ×1

react-native ×1

reactjs ×1