Repository navigation
Closed
Closed
Copy link
Labels
Component: TextInputRelated to the TextInput component.Needs: Author FeedbackNeeds: Environment InfoPlease run `react-native info` and edit your issue with that command's output.Platform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.
Description
Environment
react: 16.11.0
react-native: 0.62.2
const inputAddPoints = useRef(null);
const inputAddName = useRef(null);
const onAddName = () => {
if (name.length > 0) {
setNameAdded(true);
inputAddPoints.current.focus();
}
};
const onEditAddName = () => {
setNameAdded(!nameAdded);
if (!nameAdded) {
inputAddName.current.focus();
}
};
<View style={styles.viewInput}>
<TextInput
ref={inputAddName}
placeholder="Enter Driver's Name"
shadowed={false}
style={renderStyleAddNameInput()}
value={name}
onChangeText={setName}
editable={!nameAdded}
onFocus={_onFocusInput(ADD_NAME)}
onSubmitEditing={_onSubmitAddName}
selectTextOnFocus
/>
{nameAdded && (
<View style={styles.iconCheck}>
<Ionicons
size={30}
color={Colors.button}
name="md-checkmark-circle"
/>
</View>
)}
</View>
<View style={styles.type}>
<Text style={styles.textType}>Name</Text>
</View>
<View style={styles.bgButton}>
<TouchableOpacity
onPress={!nameAdded ? onAddName : onEditAddName}
disabled={disableAddNameButton()}
style={[styles.verifyButton, renderStyleAddNameButton()]}>
<Text style={styles.txtBtn}>{!nameAdded ? 'ADD' : 'EDIT'}</Text>
</TouchableOpacity>
</View>
</View>Hi guys, there is my code, when I press onAddName function I can focus inputAddPoints input. But when I click onEditAddName I cannot focus inputAddName, Please help me any solution, Thanks!
Metadata
Metadata
Assignees
Labels
Component: TextInputRelated to the TextInput component.Needs: Author FeedbackNeeds: Environment InfoPlease run `react-native info` and edit your issue with that command's output.Platform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.
Activity
github-actions commentedon Dec 16, 2020
react-native infoin a console.github-actions commentedon Dec 17, 2021
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.