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:

rn android picker closed rn android picker opened

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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -