以下是一个在React Native中启用Flipper的示例代码:
import {FlipperPlugin} from 'react-native-flipper';
const myPlugin = new FlipperPlugin('my-plugin-id');
myPlugin.onConnect(() => {
console.log('Connected to Flipper!');
});
myPlugin.addMenuEntry({
action: 'do-thing',
handler: () => {
console.log('Doing thing');
},
});
myPlugin.start();
// 然后在App.js中做一个小改动以添加Flipper集成
import './my-flipper-plugin';