Screen freezed after goBack from login screen
**When I come on the login screen without pressing on the input field goBack is working but when I press the input field then after coming to back screen freezes **
issue is coming in android TV `import styled from '@emotion/native'; import { SpatialNavigationNode,DefaultFocus } from 'react-tv-space-navigation'; import { TextInput as RNTextInput } from 'react-native'; import { useRef ,useEffect} from 'react'; import { Typography } from './Typography'; import { Box } from './Box'; import { Spacer } from './Spacer'; import React from 'react';
/**
-
It works, but it's not perfect.
-
If you press the back button on Android to dismiss the keyboard,
-
focus is in a weird state where we keep listening to remote control arrow movements.
-
Ideally, we'd like to always remove the native focus when the keyboard is dismissed. */ export const TextInputs = ({ label,onChange,value,error,readOnly }: { label: string,onChange:any,onBlur:any,value:any ,error:any,readOnly:any}) => { const ref = useRef<RNTextInput>(null); useEffect(() => { return () => { ref.current?.blur(); // Clear focus when component unmounts }; }, []); return ( <Box> <Typography>{label}</Typography> <Spacer direction="vertical" gap="$5" /> <DefaultFocus> <SpatialNavigationNode isFocusable={readOnly?false: true} onSelect={() => { readOnly? null : setTimeout(() => { ref?.current?.focus(); }, 500);
}} onFocus={() => { // ref?.current?.focus(); }} onBlur={() => { ref?.current?.blur(); }}{({ isFocused }) => <StyledTextInput ref={ref} value={value} onChangeText={onChange} keyboardType='email-address' isFocused={isFocused} error={error} readOnly={readOnly} />}
); };
const StyledTextInput = styled(RNTextInput)<{ isFocused: boolean,error:any,readOnly:boolean }>(({ isFocused, theme ,error,readOnly}) => ({ borderColor: isFocused ? 'white' : error ? 'red' :'black', borderWidth: 2, borderRadius: 8, color:readOnly? 'gray' : 'white', backgroundColor: theme.colors.background.inputBG, paddingHorizontal:8 })); `
I have tried to remove the onSelect code and isFocusable condition but the issue is still present Please help
Hey, I am having a very hard time understanding your issue. The code is not formatted properly, and it looks like you're mixing native components (not supported by the lib) with custom components for the lib 🤔
I'm closing this as the issue is not explicit enough. Feel free to reopen with a more illustrated example or a reproducible example.