Javascript 获得与…StyleSheet.absoluteFillObject相同的效果,但不占用更多高度

Javascript 获得与…StyleSheet.absoluteFillObject相同的效果,但不占用更多高度,javascript,reactjs,react-native,react-native-android,Javascript,Reactjs,React Native,React Native Android,我必须在此样式表中添加位置: const mapStyles = StyleSheet.create({ container: { ...StyleSheet.absoluteFillObject, height: 400, width: 400, justifyContent: 'flex-end', alignItems: 'center', }, location: { ...StyleSheet.absoluteFillObje

我必须在此样式表中添加
位置

const mapStyles = StyleSheet.create({
  container: {
    ...StyleSheet.absoluteFillObject,
    height: 400,
    width: 400,
    justifyContent: 'flex-end',
    alignItems: 'center',
  },
  location: {
    ...StyleSheet.absoluteFillObject,
    width: 400,
    alignItems: 'center',
  }
})
到我的自动完成(
),以便在Android上自动完成列表将溢出其他组件

例如:



但是,它似乎将
下方的元素向下推至其下方的设备屏幕高度(因此,在
下有一个完全空白的屏幕,然后其他组件出现。如何获得与
…样式表相同的效果。absoluteFillObject
,其下方的组件应在屏幕下方进一步移动?

样式表。absoluteFillObject
将被此属性替换():

它适用于您的
组件(它必须是绝对的,才能“溢出”其他元素),但不适用于您的容器。 使用容器中的另一个元素
flex:1
使容器达到全高,它应该可以工作

const mapStyles = StyleSheet.create({
  container: {
    flex: 1,
    width: 400,
    justifyContent: 'flex-end',
    alignItems: 'center',
  },
  location: {
    ...StyleSheet.absoluteFillObject,
    width: 400,
    alignItems: 'center',
  }
})
const absoluteFillObject = {
  position: 'absolute',
  left: 0,
  right: 0,
  top: 0,
  bottom: 0,
};
const mapStyles = StyleSheet.create({
  container: {
    flex: 1,
    width: 400,
    justifyContent: 'flex-end',
    alignItems: 'center',
  },
  location: {
    ...StyleSheet.absoluteFillObject,
    width: 400,
    alignItems: 'center',
  }
})