Open
Description
Ask your Question
Thanks for providing such a great library. In the process of using it recently, I found that if TextInput is nested in ViewPage, TextInput cannot trigger the paste function, please see the animation below.
here is my code
import React, { useEffect, useCallback } from 'react';
import { View, Text, TextInput } from 'react-native';
import ViewPager from '@react-native-community/viewpager';
const App = () => {
return (
<View style={{ flex: 1 }}>
<TextInput
placeholder="placeholder"
style={{ borderWidth: 1, borderColor: 'red' }}
/>
<ViewPager style={{ flex: 1 }}>
<View style={{ flex: 1 }}>
<TextInput
placeholder="TextInput in ViewPage"
style={{ borderWidth: 1, borderColor: 'red' }}
/>
</View>
<View style={{ flex: 1, backgroundColor: 'red' }} />
</ViewPager>
</View>
);
};
I accidentally discovered that if the textinput is re-rendered, the paste function is restored.
here is my code
const App = () => {
const [visible, setVisible] = useState(false);
return (
<View style={{ flex: 1 }}>
<TextInput
placeholder="placeholder"
style={{ borderWidth: 1, borderColor: 'red' }}
/>
<ViewPager style={{ flex: 1 }}>
<View style={{ flex: 1 }}>
{visible && (
<TextInput
placeholder="TextInput in ViewPage"
style={{ borderWidth: 1, borderColor: 'red' }}
/>
)}
<Button
title="make TextInput reRender"
onPress={() => {
setVisible(true);
}}
/>
</View>
<View style={{ flex: 1, backgroundColor: 'red' }} />
</ViewPager>
</View>
);
};
I don't know what happened and why the paste function will not work. Is this a bug? Finally, thank you for reading this question during your busy schedule and looking forward to your reply, thank you.
iOS work fine. no try it
Library :
react-native : 0.63.2
@react-native-community/viewpager: ^4.2.2,
device :
device : xiaomi(android10) and huawei