Skip to content

[Real device] TextInput cannot trigger the paste function in ViewPage  #278

Open
@zhuiye

Description

@zhuiye

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.

reportView

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>
  );
};

 2021-01-01 19 07 03

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions