0
親コンポーネントからProactを介してReact Nativeの子にデータを送信しようとしました。 Parent Component
Reactネイティブの子コンポーネントを設定する
<Card>
<CardSection>
<Input
proportion={5}
label="Email"
/>
</CardSection>
<CardSection>
<Input
proportion={3}
label="Password"
/>
</CardSection>
</Card>
Children Component
const Input = ({ proportion, label }) => {
const { inputStyle } = styles;
inputStyle.flex = proportion;
return (
<View style={containerStyle}>
<Text>{label}</Text>
<TextInput style={inputStyle} />
</View>
);
};
const style = {
inputStyle: {
flex: 2
}
};
そして、私はエラーYou attempted set the key 'flex' with the value '3' on an object that is meant to be immutable and has been frozen
を持っています。面白い事実、私が1つを持っているとき<Input /> Component
すべてがうまく動作し、flex: 5
を設定し、私が望むものに到達しますが、秒で<Input /> Component
私はエラーを持っています。どのように私はこれを修正し、適切に設定できますか?
RNの別の方法は 'style = {[inputStyle、{flex:proportion}}}' – madox2
@ madox2です。あなたのオプションは、 –