react-native-global-props icon indicating copy to clipboard operation
react-native-global-props copied to clipboard

SetCustomTextInput not working on React Native 0.57.3

Open Rodrigo77777 opened this issue 7 years ago • 16 comments

Hey @Ajackster ,

First I wanted to thank you for building this, it has allowed me to save a lot of time building an app for my company and it is really easy to use!

I am having one small issue though. I've recently updated to React Native 0.57.3 (I was previously on 0.55.4). I noticed that for some reason the font family on my text inputs has stopped being updated to my choice of font. All my text components are still respecting the font change, but the text inputs are not (they seem to default to the system font).

So I am calling setCustomText and setCustomTextInput in the same way and one seems to run correctly but the other does not. Any chance you can have a look at this?

Here are a couple of images from my app where you can tell the text inputs do not have the same font as the rest of the text.

https://ibb.co/bxZYRV https://ibb.co/jJhytA

Thanks for your time!

Rodrigo77777 avatar Oct 29 '18 16:10 Rodrigo77777

I'm also having this issue, this could maybe be happening since react-native is moving away from proptypes and more towards flow according to the RN 0.57 changelog?

siminn-arnarfs avatar Nov 01 '18 13:11 siminn-arnarfs

The same issue. When fix will be?

berpcor avatar Jan 28 '19 05:01 berpcor

I have upgraded to the latest version (1.1.5 at the time of writing this comment) and it worked for me.

pavermakov avatar Mar 01 '19 08:03 pavermakov

It doesn't work on 1.1.5 with react-native ^0.59.3.

@pavermakov what's your version of react-native?

zhigang1992 avatar Apr 05 '19 04:04 zhigang1992

Thank you for the library. I can also confirm at setCustomTextInput does not work w/ RN 0.59.3 with rn-global-props 1.1.5

kenkotch avatar Apr 05 '19 15:04 kenkotch

Just realize that it's not working for styled-components components but it does work for vanilla react native components.

zhigang1992 avatar Apr 11 '19 10:04 zhigang1992

+1

jdgalani avatar May 16 '19 05:05 jdgalani

Any updates? 0.57.7 also doesn't work. How is the situation with the latest version of RN?

vtolochk avatar Jun 05 '19 07:06 vtolochk

Tested this with react-native 0.59.9 and it seems to be working. Am I missing something here?

Ajackster avatar Jun 12 '19 12:06 Ajackster

in expo 33.0 is works. but i have a question.

Tested this with react-native 0.59.9 and it seems to be working. Am I missing something here?

in Expo 33.0 is works. but i have a question, for custom font we have to use specific font styling like "bold" using "font-bold", fot italic using "font-italic". How to implement this??

hotaryuzaki avatar Jun 24 '19 03:06 hotaryuzaki

I'm having the same issue running react-native 0.59.10 and react-native-global-props 1.1.5. I'm not using styled components or anything like that, just regular styles created using StyleSheet.create(), also I'm not using Expo. I tried setting custom styling on View and Text and both are working, but looks like something is wrong with TextInput as this component is not receiving my custom styling. Any hints?

gguidotti avatar Jul 09 '19 15:07 gguidotti

@gguidotti I haven't tried on 0.59.10 but it was working for me on 0.59.9. What styles are you trying to apply? Can you give me some code to look at?

Ajackster avatar Jul 12 '19 15:07 Ajackster

@Ajackster thank your for writing me back! I put the functions to set my custom props in the main entry of my app, App.js. Inside it there is AppContainer, which is the routing configuration imported from a separated file.

Inside my App.js:

import {
  setCustomTextInput,
  setCustomText
} from 'react-native-global-props';

const customTextProps = {
  style: {
    color: 'red'
  }
};
const customTextInputProps = {
  style: {
    color: 'red'
  }
}

setCustomText(customTextProps);
setCustomTextInput(customTextInputProps);

My Login view receives the color property for my Text components, but my TextInputs aren't. The only styling I'm applying to the TextInputs is related to flex, margin and padding, so I'm pretty sure I'm not overriding colors by mistake: textInputStyle: { flex: 1, margin: 0, padding: 0, paddingHorizontal: 10 }

If you look at the screenshot, you can see my footer text with red color, as expected, but my TextInputs are still in the default color. Let me know if you'd like to see a bit more code.

Schermata 2019-07-15 alle 12 10 22

gguidotti avatar Jul 15 '19 10:07 gguidotti

in expo 33.0 is works. but i have a question.

Tested this with react-native 0.59.9 and it seems to be working. Am I missing something here?

in Expo 33.0 is works. but i have a question, for custom font we have to use specific font styling like "bold" using "font-bold", fot italic using "font-italic". How to implement this??

oh sorry, for setCustomTextInput not worked, im using expo 33.0. Im using fontFamily

hotaryuzaki avatar Jul 18 '19 06:07 hotaryuzaki

@Ajackster @gguidotti any fix for this yet?

LPGill avatar Jan 03 '20 06:01 LPGill

@LPGill I decided to remove this package and create some custom elements to import all over my app instead of relying on the React Native default components, since it was a small project it didn't take much time and I was happier with this approach.

gguidotti avatar Jan 03 '20 09:01 gguidotti