DevSettings
DevSettings
模組提供了在開發環境中為開發者自訂設定的方法。
參考
方法
addMenuItem()
tsx
static addMenuItem(title: string, handler: () => any);
將自訂選單項目新增到開發選單。
參數
名稱 | 類型 |
---|---|
title 必要 | string |
handler 必要 | function |
範例
tsx
DevSettings.addMenuItem('Show Secret Dev Screen', () => {
Alert.alert('Showing secret dev screen!');
});
reload()
tsx
static reload(reason?: string): void;
重新載入應用程式。可以直接調用或在使用者互動時調用。
範例
tsx
<Button title="Reload" onPress={() => DevSettings.reload()} />