-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Styles as an array not working #48330
Comments
@Bufib can you follow exactly this template for the issues? There are several information missing that would be helpful for debugging the issue. Also, can you create a reproducer with this template, that does not use Expo? |
Here is the missing information. I tried to create a reproducer without expo but I don't know how to work with pure react native since I'm a beginner, sorry! With expo:
|
Since the code snippet you shared above had other files import which are not provided. So, I tried to reproduce this in bare react native project using It's not reproducible at my end. Using latest RN version (0.77.0). Here is the code snippet I tried
@Bufib If you have a complete repro. Please share a repro link, so that we can try that out. |
Warning Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:
|
Also, if the issue is happening in an expo app, I suggest you to open an issue in the Expo repository. |
Edit: It has to do with
As soon as I remove asChild, it works! See images in comment beneath! @cipolleschi @shubhamguptadream11 I have this reproducer. https://github.com/Bufib/expo-problem-styles It uses expo since I'm new and can't handle bare react native. Expo told me it must be a react native issue, since they don't do anything which could change the styles. The important code:
and
|
@cipolleschi @shubhamguptadream11
|
This is an issue for Expo. The This is not an issue that is caused by React Native core, on the surface. Please, open the issue in the Expo repo (https://github.com/expo/expo) and they will investigate it and provide a fix for it if needed, or they will come back to us if the root cause is in core. |
related expo/expo#33745 |
Thanks! @cipolleschi @EvanBacon |
Description
Expo send me here. Please check "components" - > "QuestionLinksFirst" for the code.
Problem:
As soon as I change this line:
<Pressable style={styles.element}>
to this
<Pressable style={[styles.element, {backgroundColor: category.backgroundColor}]}>
or even this line
<Pressable style={[styles.element]}>
the styles.element don't get applied anymore.
The images show the following:
1: {styles.element}
2: {[styles.element]}
3: {[styles.element, {backgroundColor: category.backgroundColor}]}
Full code:
The text was updated successfully, but these errors were encountered: