우리는 그들이 다음 버튼을 쳤을 때 다른 1 개 텍스트 입력에서 이동합니다 심판을 사용하려고 실행하는
에 정의되지 않은. 암호에 대한 기본 사용자 이름입니다.
누구든지 아이디어가 있으십니까? 아래는 우리가 사용하는 코드입니다. 스택에서 발견 한 다른 게시물에서 이것은 그들이 한 일입니다. 그러나 이것이 우리에게 말하고있는 것은 .refs는 정의되지 않았다. 작동 렌더링 원래의 내부에 난 그냥 탐색기로하지만, renderScene 기능에 아래의 코드를 렌더링하는 경우
UPDATE는 그래서 나는
render() {
return (
<Navigator
renderScene={this.renderScene.bind(this)}
navigator={this.props.navigator}
navigationBar={
<Navigator.NavigationBar style={{backgroundColor: 'transparent'}}
routeMapper={NavigationBarRouteMapper} />
} />
);
}
까지 문제를 축소 한 것이 작동하지 않습니다. 아무도 이유를 아나요? 또는 네비게이터를 표시하고 renderScene의 코드를 원래 렌더링에 표시하는 방법은 무엇입니까?
class LoginIOS extends Component{
constructor(props) {
super(props);
this.state={
username: '',
password: '',
myKey: '',
};
}
render() {
return (
<Navigator
renderScene={this.renderScene.bind(this)}
navigator={this.props.navigator}
navigationBar={
<Navigator.NavigationBar style={{backgroundColor: 'transparent'}}
routeMapper={NavigationBarRouteMapper} />
} />
);
}
renderScene() {
return (
<View style={styles.credentialContainer}>
<View style={styles.inputContainer}>
<Icon style={styles.inputPassword} name="person" size={28} color="#FFCD00" />
<View style={{flexDirection: 'row', flex: 1, marginLeft: 2, marginRight: 2, borderBottomColor: '#e0e0e0', borderBottomWidth: 2}}>
<TextInput
ref = "FirstInput"
style={styles.input}
placeholder="Username"
autoCorrect={false}
autoCapitalize="none"
returnKeyType="next"
placeholderTextColor="#e0e0e0"
onChangeText={(text) => this.setState({username: text})}
value={this.state.username}
onSubmitEditing={(event) => {
this.refs.SecondInput.focus();
}}
>
</TextInput>
</View>
</View>
<View style={styles.inputContainer}>
<Icon style={styles.inputPassword} name="lock" size={28} color="#FFCD00" />
<View style={{flexDirection: 'row', flex: 1, marginLeft: 2, marginRight: 2, borderBottomColor: '#e0e0e0', borderBottomWidth: 2}}>
<TextInput
ref = "SecondInput"
style={styles.input}
placeholder="Password"
autoCorrect={false}
secureTextEntry={true}
placeholderTextColor="#e0e0e0"
onChangeText={(text) => this.setState({password: text})}
value={this.state.password}
returnKeyType="done"
onSubmitEditing={(event)=> {
this.login();
}}
focus={this.state.focusPassword}
>
</TextInput>
</View>
</View>
</View>
);
}
문제를 해결하기위한 시도 : 생성자에서 렌더링 장면 함수를 바인딩 해보십시오. 그래서 다음 줄을 추가하십시오 : this.renderScene = this.renderScene.bind (this) –
그걸로 행운이 없습니다. 생성자에서 bind와 render render가있는 곳에서 시도해 보았습니다. renderScene = {this.renderScene.bind (this)}. 그럼 그냥 생성자에서 그것을 시도했다. – wdlax11
@AlexHarrison renderScene과 관련이 있다는 것을 알았습니다. 내비게이션 막대를 제거하고 원래 렌더링의 입력 값 만 반환하면 작동합니다. 그러나 탐색 바가 필요합니다. 어떤 생각? – wdlax11