首页 > 解决方案 > react-native-navigation showModal 自定义大小

问题描述

我使用 wix react-native-navigation。Navigation.showModal 打开全屏大小。是否可以打开自定义尺寸?我在哪里可以找到有关导航布局的所有属性列表?文档太少了...

标签: wix-react-native-navigation

解决方案


模态总是全屏。您可以在 jsx 中控制视图的尺寸。而不是flex: 1- 根据您的需要使用预定义的宽度和高度。

render() {
  return (
    <View style={{width: '80%', height: 150}}>
    { /* render Modal content */ }
    </View.
  );
}

或者,如果您需要与 Modal 后面的 UI 进行交互,您应该使用Navigation.showOverlay

Navigation.showOverlay({
  component: {
    name: 'example.Overlay',
    options: {
      overlay: {
        interceptTouchOutside: false // this make touch events pass through the invisible parts of the overlay
      }
    }
  }
});

有关使用的 Overlay 的更多示例,您可以在Playground 应用程序中查看代码示例


推荐阅读