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:
|
||||
return <SignInSheet onHide={onHide} />;
|
||||
case ACTIVE_SHEET_SETTINGS:
|
||||
return <SettingsSheet onHide={onHide} />;
|
||||
return <SettingsSheet platform={process.platform} onHide={onHide} />;
|
||||
case ACTIVE_SHEET_DOCTOR:
|
||||
return <DoctorSheet onHide={onHide} />;
|
||||
case ACTIVE_SHEET_SELECT_PLUGINS_TO_EXPORT:
|
||||
|
||||
@@ -27,8 +27,6 @@ import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel';
|
||||
import {reportUsage} from '../utils/metrics';
|
||||
import os from 'os';
|
||||
|
||||
const platform = os.platform();
|
||||
|
||||
const Container = styled(FlexColumn)({
|
||||
padding: 20,
|
||||
width: 800,
|
||||
@@ -43,6 +41,7 @@ const Title = styled(Text)({
|
||||
|
||||
type OwnProps = {
|
||||
onHide: () => void;
|
||||
platform: NodeJS.Platform;
|
||||
};
|
||||
|
||||
type StateFromProps = {
|
||||
@@ -113,21 +112,22 @@ class SettingsSheet extends Component<Props, State> {
|
||||
<ToggledSection
|
||||
label="iOS Developer"
|
||||
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 => {
|
||||
this.setState({
|
||||
updatedSettings: {...this.state.updatedSettings, enableIOS: v},
|
||||
});
|
||||
}}>
|
||||
{' '}
|
||||
{platform === 'darwin' && (
|
||||
{this.props.platform === 'darwin' && (
|
||||
<ConfigText
|
||||
content={'Use "xcode-select" to switch between Xcode versions'}
|
||||
/>
|
||||
)}
|
||||
{platform !== 'darwin' && (
|
||||
{this.props.platform !== 'darwin' && (
|
||||
<ConfigText
|
||||
content={'iOS development is only supported on MacOS'}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user