javascript - React Native Router Styling Issue Login Form Fields Stacking Up IOS Simulator -
i have loginform component if used without react-native-flux appears normal depicted in image below.
however if same component displayed through router , scene components of react-native-router-flux fields stackup depicted below.
below code of router.js file
import react 'react'; import { scene, router, stack } 'react-native-router-flux'; import loginform './components/loginform'; const routercomponent = () => { return ( <router scenestyle={{ paddingtop: 65, margintop: 20 }}> <stack key="root"> <scene key="login" component={loginform} title="please login" /> </stack> </router> ); }; export default routercomponent; loginform.js
import react, { component } 'react'; import { text } 'react-native'; import { connect } 'react-redux'; import { button, card, cardsection, input, spinner } './common'; import { emailchanged, passwordchanged, loginuser } '../actions'; class loginform extends component { onemailchange(text) { this.props.emailchanged(text); } onpasswordchange(text) { this.props.passwordchanged(text); } onbuttonpress() { const { email, password } = this.props; this.props.loginuser({ email, password }); } onloginsuccess() { this.setstate({ email: '', password: '', loading: false, error: '' }); } onloginfail() { this.setstate({ error: 'authentication failed.', loading: false }); } renderbutton() { if(this.props.loading) { return <spinner size="large" />; } return ( <button onpress={this.onbuttonpress.bind(this)}> log in </button> ); } render() { return ( <card> <cardsection> <input placeholder="example@example.com" label="email" value={this.props.email} onchangetext={this.onemailchange.bind(this)} /> </cardsection> <cardsection> <input securetextentry placeholder="password" label="password" value={this.props.password} onchangetext={this.onpasswordchange.bind(this)} /> </cardsection> <text style={styles.errorstyle}> {this.props.error} </text> <cardsection> {this.renderbutton()} </cardsection> </card> ); } } const styles = { errorstyle: { fontsize: 20, alignself: 'center', color: 'red' } }; const mapstatetoprops = ({ auth }) => { const { email, password, error, loading } = auth; return { email, password, error, loading }; }; export default connect(mapstatetoprops, { emailchanged, passwordchanged, loginuser })(loginform); here styles applied input
const styles = { inputstyle: { color: '#000', paddingright: 5, paddingleft: 5, fontsize: 18, lineheight: 23, flex: 2 }, labelstyle: { fontsize: 18, paddingleft: 20, flex: 1 }, containerstyle: { height: 40, flex: 1, flexdirection: 'row', alignitems: 'center' } } here style applied cardsection
const styles = { containerstyle: { borderbottomwidth: 1, padding: 5, backgroundcolor: '#fff', justifycontent: 'flex-start', flexdirection: 'row', bordercolor: '#ddd', position: 'relative' } }; here style applied 'card`
const styles={ containerstyle: { borderwidth: 1, borderradius: 2, bordercolor: '#ddd', borderbottomwidth: 0, shadowcolor: '#000', shadowoffset: { width: 0, height: 2 }, shadowopacity: 0.1, shadowradius: 2, elevation: 1, marginleft: 5, marginright: 5, margintop: 10 } }; i have tried various methods of no use. appreaciate sort out issue.


Comments
Post a Comment