-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[New Arch] TextInput text change flickers if within Portal #4580
Labels
Comments
same problem |
Same problem. Does anyone know a fix? |
There's no fix atm afaik |
For the time being I decided to just use standard react-native modal and add semi-transparrent background etc (bugs like that must not stop from going to prod), might actually stick to this as it's much simpler than paper approach:
|
Have you tried using a ref to store text input instead? export default function HomeScreen() {
const [ showModal, setShowModal ] = useState(false)
const [ showDialog, setShowDialog ] = useState(false)
const [ text, setText ] = useState('')
const dialogText = useRef('')
const modalText = useRef('')
const handleDialogTextChange = useCallback((text: string) => {
dialogText.current = text;
}, []);
const handleModalTextChange = useCallback((text: string) => {
modalText.current = text;
}, []);
return (
<SafeAreaProvider>
<PaperProvider>
<SafeAreaView>
<Text>This input works fine:</Text>
<TextInput value={text} onChangeText={setText} />
<Button mode='outlined' onPress={() => setShowModal(true)}>Show modal</Button>
<Button mode='outlined' onPress={() => setShowDialog(true)}>Show dialog</Button>
</SafeAreaView>
<Portal>
<Modal
visible={showModal}
onDismiss={() => setShowModal(false)}
contentContainerStyle={styles.modalStyle}>
<Text>This input flickers:</Text>
<TextInput defaultValue='' onChangeText={handleModalTextChange} />
</Modal>
<Dialog visible={showDialog} onDismiss={() => setShowDialog(false)}>
<Dialog.Content>
<Text>This input flickers:</Text>
<TextInput defaultValue='' onChangeText={handleDialogTextChange} />
</Dialog.Content>
</Dialog>
</Portal>
</PaperProvider>
</SafeAreaProvider>
);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current behaviour
Under new arch any
TextInput
component (be it from react-native-paper or from react-native) withinPortal
(modal or dialog) will flicker when text is being changed.Expected behaviour
Editing text is smooth.
How to reproduce?
Clone this repo: https://github.com/codan84/text-input-flicker
Open in Expo Go.
Preview
ScreenRecording_12-19-2024.20-43-14_1.mov
What have you tried so far?
Nothing, I see loads of issues related to Portal under new arch so I guess this is another one?
Your Environment
The text was updated successfully, but these errors were encountered: