BarCodeScanner resizes itself on Android devices - SDK32

Hello,

I’m using a BarCodeScanner from Expo, here’s the code:

<View style={styles.slot}>
          {this.state.hasCameraPermission === null
            ? <Text>Requesting for camera permission</Text>
            : this.state.hasCameraPermission === false
                ? <Text >
                    Camera permission is not granted
                  </Text>
                : <BarCodeScanner
                    onBarCodeRead={this.onSuccess.bind(this)}
                    style={{
                      height:Dimensions.get('window').width/2,
                      width:Dimensions.get('window').width/2
                    }}
                  />}
          </View>

When I open this screen, the preview of the camera is square, but as soon as I move the device and that the camera really focus, it changes the ration to what appears to be the same one as the ratio of the screen. The thing is it can put itself on top of other components if I don’t put enough margin. Is there a way to force the ratio to a square one?

Here’s picture of the resized qr scanner (should be square) to understand:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.