通过地图功能循环使用样式

时间:2016-11-02 16:01:32

标签: reactjs react-native

我试图使用map函数循环遍历样式,但它返回数字83到90而不是为什么会发生这种情况?

        DispatchQueue.global(qos: DispatchQoS.QoSClass.background).async(execute: {

        if self.mainNode == nil {

            self.mainNode = ASDisplayNode()
            self.videoNode = ASVideoNode()
            self.videoNode!.frame = CGRect(x: 0.0, y: 0.0, width: self.bounds.width, height: self.bounds.height)
            self.videoNode!.gravity = AVLayerVideoGravityResizeAspectFill
            self.videoNode!.shouldAutoplay = true
            self.videoNode!.shouldAutorepeat = false
            self.videoNode!.muted = false
            self.videoNode.delegate = self
            self.videoNode.isUserInteractionEnabled = true
            self.videoNode!.placeholderEnabled = true
            DispatchQueue.main.async(execute: {
                self.mainNode!.addSubnode(self.videoNode!)
                self.addSubview(self.mainNode!.view)
            })
        }

        self.videoNode?.asset = AVAsset(url: self.url)
        DispatchQueue.main.async(execute: {
          self.videoNode?.placeholderImage()
        })
    })

1 个答案:

答案 0 :(得分:1)

您需要返回地图结果:

let stylesArray = [styles.punt1, styles.punt2, 
                   styles.punt3, styles.punt4, 
                   styles.punt5, styles.punt6, 
                   styles.punt7, styles.punt8
                  ]

 {stylesArray.map(function(object, i){
    console.log(object);
    return (
        <TouchableHighlight onPress={openQuestionOverview} style={[styles.punt, object]}>
            <Image source={vraag1} />
        </TouchableHighlight>
    )
 })}

您也不会使用映射步骤的结果。