0

我在这里有这段代码:

<View style={styles.pageContainer}>
      <ViewShot ref={viewShotRef} options={{ format: "jpg", quality: 0.9 }}>
        <Camera
          style={[
            styles.camera,
            { position: 'relative' }
          ]}
          type={type}
          ref={(ref) => {
            setCamera(ref)
          }}
        />

        <View
          style={{
            backgroundColor: '#000',
            width: screenWidth - (PAGE_HORIZONTAL_PADDING * 2),
            position: 'absolute',
            bottom: 50,
            left: 0,
          }}
        >
          <Text style={{ color: '#FFF' }}>kek lol</Text>
        </View>
      </ViewShot>

      <TouchableOpacity
        style={styles.takeShotButton}
        onPress={async () => {
          if (camera) {
            const uri = await captureRef(viewShotRef, {
              format: "jpg",
              quality: 0.8,
            })

            setAssetInformation({ uri })
          }
        }}
       >
         <Text style={styles.controlButtonText}>Take a picture</Text>
      </TouchableOpacity>
    </View>

问题是,当我这样做captureRef时,它只捕获 Camera 组件的内容,并没有捕获其中包含“kek lol”的文本组件。任何想法为什么?

4

0 回答 0