Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React native Text input, event.preventDefault() is not working as expected. #1811

Closed
AmmuRamasubramanian opened this issue Apr 22, 2024 · 1 comment

Comments

@AmmuRamasubramanian
Copy link

In React native textinput, event.preventDefault() is not working.I tried in react native textinput to textarea also. cursor still goes to nextline .Is there any way I can prevent this. I want the retur type as "Enter" only and with multiline true. <TextArea
ref={(ref)=>blockRefs.current[block.id]=ref}
key={${block.id}}
style={styles.paragraph}
value={${block.data.text}}
onChangeText={(text)=>handleTextInputChange(text)}
multiline
onKeyPress={(event) => {
event.preventDefault();
if (event.nativeEvent.key === 'Backspace') {
handleBackKeyPress_para(block);
}else if(event.nativeEvent.key==="Enter"){

                }
            }} 
            onFocus={()=>onFocusTxtinput(block)}
            autoCapitalize='none'
            autoCorrect={false}
            selectionColor={"white"}
            bgColor="white"
        />...in onChangeText , I have added this line. newText=newText.replace(/[\r\n]/g, '');
Copy link

@AmmuRamasubramanian: hello! 👋

This issue is being automatically closed because it does not follow the issue template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant