question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Override style not working

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
cinnamonponcommented, Nov 23, 2021

To anyone experiencing this issue, it seems this only happens when Hermes is enabled. it worked as expected when I disabled Hermes in the project.

1reaction
djiworkscommented, Sep 12, 2022

Is there any plan to make it work with Hermes please ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Class Not Overriding Other CSS - html - Stack Overflow
When I wrap a chunk of a page in the text and background change but the links and headlines remain white (and are...
Read more >
How to fix style override issues - EventON - Documentation
Step 3: Write a CSS style to override this issue. Get the class name of the style that is overridden in EventON (in...
Read more >
Css override not working - OutSystems
Hello,. I'm trying to override (display: inline-block; ) in Basic.css file by creating a class in my own css file:
Read more >
How to Override CSS Styles - W3docs
How CSS overriding works, what is the cascading order and inheritance, what are the priorities and some tricks to override them.
Read more >
How to Edit, Customize, and Override Bootstrap CSS to Suit ...
Learn how to override Bootstrap CSS using simple CSS overrides or Sass variables and maps to customize your site.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found