小编new*_*ser的帖子

发送 props 到 @react-navigation/drawer 组件

我正在尝试将 prop 发送到 Drawer.Screen 内的组件。我正在使用@react-navigation/drawer。我终于将道具发送到导航容器,但无法将道具发送到 Drawer.Screen 中的 component={homeStackScreen}。如何将道具发送到 homeStackScreen 类。而且它没有写在文档中。请需要帮助。

const Drawer = createDrawerNavigator();

<NavigationContainer>
            <Drawer.Navigator initialRouteName="Home">
                {props.leftMenu.map((x,index) =>                 
                <Drawer.Screen name={x.name} key = {index} component={homeStackScreen} />
                )}
            </Drawer.Navigator>
</NavigationContainer>
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

6
推荐指数
2
解决办法
7608
查看次数

Kubernetes 负载均衡器 外部 IP 待定

我在 Kubernetes 中创建 RabbitMQ 集群。我正在尝试添加负载均衡器。但我无法获取负载均衡器外部 IP,它仍处于待处理状态。

apiVersion: v1
kind: Service
metadata:
  name: rabbitmq
  labels:
    run: rabbitmq
spec:
  type: NodePort
  ports:
  - port: 5672
    protocol: TCP
    name: mqtt
  - port: 15672
    protocol: TCP
    name: ui
  selector:
    run: rabbitmq
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbitmq
spec:
  replicas: 1
  selector:
    matchLabels:
      run: rabbitmq
  template:
    metadata:
      labels:
        run: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: rabbitmq:latest
        imagePullPolicy: Always
Run Code Online (Sandbox Code Playgroud)

我的负载均衡器在下面。我给负载均衡器的nod​​ePort是随机的,端口号是来自kubernetes创建的RabbitMQ mqtt端口号,目标端口号是来自kubernetes创建的RabbitMQ UI端口号

apiVersion: v1
kind: Service
metadata:
  name: loadbalanceservice
  labels:
    app: rabbitmq
spec: …
Run Code Online (Sandbox Code Playgroud)

rabbitmq docker kubernetes docker-compose kubernetes-pod

4
推荐指数
1
解决办法
9699
查看次数

类型错误:(0,_reactNativeScreens.useScreens)不是一个函数

我搜索了这个错误,但没有找到解决方案。

TypeError: (0, _reactNativeScreens.useScreens) is not a function. (In '(0, _reactNativeScreens.useScreens)()', '(0, _reactNativeScreens.useScreens)' is undefined)
 Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
 Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
Run Code Online (Sandbox Code Playgroud)

首先,我收到此错误```错误:错误:无法解析模块:react-native-screensnode_modules\react-native-stack\src\NavigatorIos\index.js项目中找不到react-native-screens。


After this error I installed
```npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view``` 

I am trying to run in android.
Run Code Online (Sandbox Code Playgroud)

react-native react-native-navigation

3
推荐指数
1
解决办法
1750
查看次数