Make SeetingsSheet test deterministic
Summary: The platform check is a side-effect and shouldn't be in the UI component itself. Reviewed By: mweststrate Differential Revision: D20159799 fbshipit-source-id: c5fa99e0b915a140f10056283671cf5b7368e9c9
This commit is contained in:
committed by
Facebook Github Bot
parent
5c441d5efb
commit
4c9b1dfd1a
@@ -94,7 +94,7 @@ export class App extends React.Component<Props> {
|
|||||||
case ACTIVE_SHEET_SIGN_IN:
|
case ACTIVE_SHEET_SIGN_IN:
|
||||||
return <SignInSheet onHide={onHide} />;
|
return <SignInSheet onHide={onHide} />;
|
||||||
case ACTIVE_SHEET_SETTINGS:
|
case ACTIVE_SHEET_SETTINGS:
|
||||||
return <SettingsSheet onHide={onHide} />;
|
return <SettingsSheet platform={process.platform} onHide={onHide} />;
|
||||||
case ACTIVE_SHEET_DOCTOR:
|
case ACTIVE_SHEET_DOCTOR:
|
||||||
return <DoctorSheet onHide={onHide} />;
|
return <DoctorSheet onHide={onHide} />;
|
||||||
case ACTIVE_SHEET_SELECT_PLUGINS_TO_EXPORT:
|
case ACTIVE_SHEET_SELECT_PLUGINS_TO_EXPORT:
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel';
|
|||||||
import {reportUsage} from '../utils/metrics';
|
import {reportUsage} from '../utils/metrics';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
const platform = os.platform();
|
|
||||||
|
|
||||||
const Container = styled(FlexColumn)({
|
const Container = styled(FlexColumn)({
|
||||||
padding: 20,
|
padding: 20,
|
||||||
width: 800,
|
width: 800,
|
||||||
@@ -43,6 +41,7 @@ const Title = styled(Text)({
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
onHide: () => void;
|
onHide: () => void;
|
||||||
|
platform: NodeJS.Platform;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateFromProps = {
|
type StateFromProps = {
|
||||||
@@ -113,21 +112,22 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
<ToggledSection
|
<ToggledSection
|
||||||
label="iOS Developer"
|
label="iOS Developer"
|
||||||
toggled={
|
toggled={
|
||||||
this.state.updatedSettings.enableIOS && platform === 'darwin'
|
this.state.updatedSettings.enableIOS &&
|
||||||
|
this.props.platform === 'darwin'
|
||||||
}
|
}
|
||||||
frozen={platform !== 'darwin'}
|
frozen={this.props.platform !== 'darwin'}
|
||||||
onChange={v => {
|
onChange={v => {
|
||||||
this.setState({
|
this.setState({
|
||||||
updatedSettings: {...this.state.updatedSettings, enableIOS: v},
|
updatedSettings: {...this.state.updatedSettings, enableIOS: v},
|
||||||
});
|
});
|
||||||
}}>
|
}}>
|
||||||
{' '}
|
{' '}
|
||||||
{platform === 'darwin' && (
|
{this.props.platform === 'darwin' && (
|
||||||
<ConfigText
|
<ConfigText
|
||||||
content={'Use "xcode-select" to switch between Xcode versions'}
|
content={'Use "xcode-select" to switch between Xcode versions'}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{platform !== 'darwin' && (
|
{this.props.platform !== 'darwin' && (
|
||||||
<ConfigText
|
<ConfigText
|
||||||
content={'iOS development is only supported on MacOS'}
|
content={'iOS development is only supported on MacOS'}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user