Skip to content

Override style not working #21

Open
@backendbyyuto

Description

@backendbyyuto

Hello, I did:

import { setCustomTextInput } from "react-native-global-props";
const customTextInputProps = {
  style: {
    //fontFamily: theme.fontFamily.regular,
    //color: theme.colors.text,

    backgroundColor: "#E0E7FF33",
    borderColor: "#E0E7FF",
    borderRadius: 5,
    borderWidth: 1,
    marginVertical: 5,
    paddingVertical: 7,
    paddingHorizontal: 18,
    fontSize: 14,
    fontFamily: theme.fontFamily.regular,
    //color: "red"
  }
};

setCustomTextInput(customTextInputProps);

If I write:

<TextInput value={code} />

The global styles are applied correctly

But if I try to override one property of the style for a particular TextInput, the global styles dissapear, for example writting:

<TextInput 
   value={code} 
   style={{color: "red"}}
/>

It only apply the red color, and the rest of the style is gone. No border, no padding, etc.

What I'm doing wrong?

If I do:

<TextInput 
   value={code} 
   style={[TextInput.defaultProps.style, {color: "red"}]}
/>

It worked as expected... But then... whats the point using this library?

Can you help me please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions