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

Bug - TextInputMask is not a controlled component #297

Open
semcelik opened this issue Jun 14, 2023 · 1 comment
Open

Bug - TextInputMask is not a controlled component #297

semcelik opened this issue Jun 14, 2023 · 1 comment

Comments

@semcelik
Copy link

semcelik commented Jun 14, 2023

Hello,
I was trying to use TextInputMask in my project but I saw that this component is not a controlled component. When I set a fixed value, I expect that input to not to change no matter what. But as I see, TextInputMask behaves different than TextInput. Is that a bug or is that the behaviour? When I check the react-native documents for TextInput there is a section it says

The value to show for the text input. TextInput is a controlled component

Here is a sample code and video recording from a recently created project

Version

  "dependencies": {
    "react": "18.2.0",
    "react-native": "0.71.10",
    "react-native-text-input-mask": "^3.1.4"
  },

Code

import React from "react";
import { SafeAreaView, ScrollView, Text, TextInput } from "react-native";
import TextInputMask from "react-native-text-input-mask";

function App() {
  return (
    <SafeAreaView>
      <ScrollView contentInsetAdjustmentBehavior="automatic">
        <Text>TextInput</Text>
        <TextInput value="1234" />
        <Text style={{ marginTop: 24 }}>TextInputMask</Text>
        <TextInputMask value="1234" />
      </ScrollView>
    </SafeAreaView>
  );
}

export default App;

Video recording

Screen.Recording.2023-06-14.at.17.04.19.mov

Thank you.

@semcelik
Copy link
Author

semcelik commented Sep 5, 2023

Hey there, any update about this?

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

No branches or pull requests

1 participant