Skip to content

Commit

Permalink
Adds initial layout
Browse files Browse the repository at this point in the history
  • Loading branch information
danielweinmann committed May 20, 2017
1 parent 7fd2459 commit 355b386
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
43 changes: 43 additions & 0 deletions Picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React, { Component } from 'react'
import ReactNative, { Platform, TouchableOpacity, Text, StyleSheet } from 'react-native'

class PickerItem extends Component {
render() {
return(
<Text>Item</Text>
)
}
}

export default class Picker extends Component {
static Item = PickerItem

render() {
if (Platform.OS === 'ios') {
const { style, selectedValue } = this.props
const flatStyle = StyleSheet.flatten(style)
const textStyle = {
fontSize: 12,
lineHeight: (style && flatStyle.height ? flatStyle.height : 12),
}
return(
<TouchableOpacity style={{
alignSelf: 'stretch',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
paddingHorizontal: 6,
}}>
<Text style={[{
flex: 1,
}, textStyle, style]}>
{selectedValue}
</Text>
<Text style={[textStyle, style, {color: 'black'}]}></Text>
</TouchableOpacity>
)
} else {
return(<ReactNative.Picker {...this.props} />)
}
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A dropdown that uses React Native's Picker for Android and ActionSheetIOS for iO

```yarn add react-native-picker-dropdown```

Or
or

```npm install react-native-picker-dropdown --save```

Expand Down Expand Up @@ -39,7 +39,7 @@ export default class App extends Component {
}}>
<Picker
selectedValue={this.state.language}
onValueChange={(lang) => this.setState({language: lang})}
onValueChange={(language) => this.setState({language})}
mode="modal"
style={{
alignSelf: 'stretch',
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Picker from './Picker'

module.exports = { Picker }

0 comments on commit 355b386

Please sign in to comment.