Skip to content

Instantly share code, notes, and snippets.

@Karniej
Last active August 16, 2018 06:58
Show Gist options
  • Save Karniej/86082a5d09e8147dacedb23b5e5aa7f5 to your computer and use it in GitHub Desktop.
Save Karniej/86082a5d09e8147dacedb23b5e5aa7f5 to your computer and use it in GitHub Desktop.
import React from 'react';
import { View, Text, Picker, Platform } from 'react-native';
class MyPicker extends React.Component {
state = {
system: ''
};
render() {
return (
<View style={{ justifyContent: 'center', alignItems: 'center', flex: 1 }}>
<Text>React Native Picker{' '}{Platform.select({ android: 'Android', ios: 'IOS' })}</Text>
<Picker
selectedValue={this.state.system}
style={{ height: 50, width: 100 }}
onValueChange={itemValue => this.setState({ system: itemValue })}
itemstyle={{ width: 100 }}
>
<Picker.Item label="IOS" value="IOS" />
<Picker.Item label="Android" value="Android" />
</Picker>
</View>
);
}
}
export default MyPicker;
@marysieek
Copy link

lines 5-26, please indent :D @Karniej

@marysieek
Copy link

line 12, it does not look aesthetic - it could be a one-line string

@marysieek
Copy link

please apply the formatting to this file - you can choose the extension when creating a gist file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment