Reactネイティブが初めてです。私は、render()であるメイン関数からコードを移動して、別の関数にコードを移すことに関連して、noobの質問をしています。React Native - render()のコードを別の関数に移動
はのは、私は次のコードを持っているとしましょう: -
render() {
return (
<View>
<Modal
animationType={"fade"}
transparent={true}
visible={this.state.signUpPopUpVisible}
onRequestClose={() => {alert("Modal has been closed.")}}>
{/* Other modal codes */}
</Modal>
<View style={styles.mainView}>
{/* Other mainView codes */}
</View>
</View>
);
}
は、どのように私は)別の関数にコード全体
<Modal
animationType={"fade"}
transparent={true}
visible={this.state.signUpPopUpVisible}
onRequestClose={() => {alert("Modal has been closed.")}}>
{/* Other modal codes */}
</Modal>
を移動して、(レンダリングでそれを呼び出すことができますか?
ありがとうございました。
'this.showModal'は、関数呼び出しではありません。それは単なる関数のプロトタイプです。 –