如何删除博览会 BarCodeScanner 中的多余空白

Zee*_*ari 6 react-native expo

iOS 工作正常 BarCodeScanner 全屏显示,但当我使用 android 时,会有额外的空白。

<BarCodeScanner
  onBarCodeScanned={scanned ? undefined : this._handleBarCodeScanned}
  style={[StyleSheet.absoluteFill, { flex: 1 }]}
/>
Run Code Online (Sandbox Code Playgroud)

我也通过提供不同的风格进行检查,但没有运气

style={{
  height: Dimensions.get('window').height,
  width: Dimensions.get('window').width,
}}
Run Code Online (Sandbox Code Playgroud)

空白示例

Fre*_*Vds 7

这似乎是最新版本的 expo-barcode-scanner 中的一个问题。一种可能的解决方法是将 BarCodeScanner 的尺寸显式设置为屏幕的尺寸:

import { Dimensions } from 'react-native';

<BarCodeScanner style={{
    width: Dimensions.get('screen').width,
    height: Dimensions.get('screen').height,
}} />           
Run Code Online (Sandbox Code Playgroud)

请注意,像您尝试的那样将其设置为窗口的尺寸是行不通的。