-1
私は、ピッカーと2つの入力/ラベルを持つ非常に単純なアプリケーションを構築しています。リアクションネイティブ:アレンジする要素
現在、私のiPhoneではこれは次のようです。
これは私のコード
import React from 'react';
import { StyleSheet, Text, View, Button, Modal, TextInput, Picker } from 'react-native';
export default class App extends React.Component {
constructor(props) {
super(props);
}
state = {
b1text: 'Kg',
b2text: 'Cm',
weight: '',
height: '',
standard: 'Metric'
}
render() {
return (
<View style={styles.container}>
<Picker
selectedValue={this.state.standard}
onValueChange={(itemValue, itemIndex) => {
this.setState({standard: itemValue});
if(itemValue === "Metric") {
this.setState({b1text: "Kg"});
this.setState({b2text: "Cm"});
}
if(itemValue === "Imperial") {
this.setState({b1text: "Lbs"});
this.setState({b2text: "Inches"});
}
} }
style={{height: 100, width: 100 }}
>
<Picker.Item label="Metric" value="Metric" />
<Picker.Item label="Imperial" value="Imperial" />
</Picker>
<TextInput
style={{height: 40, width: 60, borderColor: 'gray', borderWidth: 1}}
onChangeText={(text) => this.setState({text: weight})}
value={this.state.weight}
/>
<Text>{this.state.b1text}</Text>
<TextInput
style={{height: 40, width: 60, borderColor: 'gray', borderWidth: 1}}
onChangeText={(text) => this.setState({text: height})}
value={this.state.height}
/>
<Text>{this.state.b2text}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
},
});
あるしかし、私は以下に示すように、それはこのようなものを見てみたいです。
私はマージン、パディングなどを試しましたが、まだ運がありません。
誰かが私が私が欲しいかのようなUIを変更するために使用することができますフレックス何CSS /プロパティを教えてもらえますか?
あなたがここにあなたのコードを投稿することが要求されている、ではない第三者のサイトで使用できるスタイルプロパティのすべてのガイドを持っているリソースがありますあなたの答えを無用にして、明日は変わることができます。 https://stackoverflow.com/help/how-to-answer – Rob
これらのガイドラインを提供いただき、ありがとうございます。ここでコードを提供するために必要な調整を行いました。サポートを提供する際には、通常、コードソリューションを提供する必要があるときにsnack.expo.ioをリンクするため、お詫び申し上げます。 – Jim