react native - How can I center items and selected item in RN Picker android? -
is possible center android picker items , selected item? i've searched everywhere, , tried alignitems:'center' & justifycontent:'center', items still aligned left (visible on photos), when put alignself:'center' picker no longer visible. have clues?
var reports = [ {name: 'report 1', id: 'r1'}, {name: 'report 2', id: 'r2'}, {name: 'report 3', id: 'r3'}, {name: 'report 4', id: 'r4'}, {name: 'report5', id: 'r5'}, {name: 'report6', id: 'r6'} ]; ... <picker style={styles.androidpicker} mode={'dropdown'} selectedvalue={this.state.report} itemstyle={styles.reports.iospicker} onvaluechange={(reportid) => this.onreportchanged(reportid)}> {reports.map(function (reports) { return <picker.item style={{alignself:'center'}} label={reports.name} value={reports.id} key={reports.name + reports.id}/>;})} </picker> ...
styles:
var styles = stylesheet.create({ androidpicker: { flex: 1, color: '#6d6d6d', backgroundcolor: '#fff', marginbottom: 20, height: 40, alignitems:'center', justifycontent:'center', flexdirection: 'row' } })
here snapshoots of closed , opened picker:
thanks in advance! :)
would try below :
var styles = stylesheet.create({ androidpicker: { color: '#6d6d6d', backgroundcolor: '#fff', marginbottom: 20, height: 40, alignself: 'stretch', alignitems:'center', justifycontent:'center', } })
Comments
Post a Comment