且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

以编程方式/命令打开iOS开发者菜单

更新时间:2023-10-03 10:12:04

不幸的是.

您可以在这里.这不是理想的,但应该可以.(下面粘贴的代码副本)

You can vote for it on Canny here. Until then, your best bet for iOS is to use a workaround such as one of the ones suggested from the original Github issue. For example, creating your own multi-touch shortcut for opening the dev menu as seen here. It's not ideal but it should work. (code copy pasted below)

import React from 'react';
import {
  View,
  PanResponder,
  NativeModules,
}            from 'react-native';


const DevMenuTrigger = ({children}) => {
  const {DevMenu} = NativeModules;
  const panResponder = PanResponder.create({
    onStartShouldSetPanResponder: (evt, gestureState) => {
      if (gestureState.numberActiveTouches === 3) {
        DevMenu.show();
      }
    },
  });
  return <View style={{flex: 1}} {...panResponder.panHandlers}>{children}</View>;
};


...

AppRegistry.registerComponent('myApp', (): any => <DevMenuTrigger><MyApp></DevMenuTrigger>