React native를 처음 사용합니다. render()라는 주요 함수에서 코드를 옮겨서 코드를 다른 함수에 넣는 것과 관련된 멍청한 질문이 있습니다.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' 함수 호출하지 않습니다. 함수 프로토 타입 일뿐입니다. –