-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Calendar] [theme] Calendar theme stylesheet customization isn't working as expected #2336
Comments
+1 having the same issue, or we fix how we get the theme value, or types for Theme interface. |
For now as a workaround one can override the styles by directly setting the theme on <Calendar
theme={{
'stylesheet.calendar.main': {
week: {
justifyContent: 'space-between',
flexDirection: 'row',
},
monthView: {
padding: 0,
margin: 0,
},
dayContainer: {
alignItems: 'center',
flex: 1,
},
container: {
padding: 0,
},
},
}}
/> |
I was updating an old project and had to update this library.
but they are still working, as stated above by @badalsaibo I just had to add a comment above my code to prevent TS errors: I have no idea if in the newer version, the documentation is right or the types are, so I am going to finish updating this project as quickly as I can, so I don't enter a "dependencies update hell"... |
I think this is only half the solution For example, So, I think in all return StyleSheet.create({
// default styles,
...(theme?.stylesheet?.xxx?.yyy || {}) // or worse, ...(theme['stylesheet.xxx.yyy'])
}) should ideally be changed into this: return StyleSheet.flatten(
{
// default styles,
},
theme?.stylesheet?.xxx?.yyy ?? {}
}) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hey everyone, I’ve set up a PR to address this issue: #2573. If you’d like to use the fix before it’s merged, you can apply it using patch-package. A quick note: overriding specific styles using the This issue could potentially be resolved by implementing something similar to bartvanandel's suggestion of using |
Description
Calendar theme stylesheet customization isn't working as expected. The
theme
props accepts thestylesheet
object of the following structure as derived from its typesHence, adding the following object to the theme prop should work
Expected Behavior
The theming should be applied.
Observed Behavior
The theming isn't applied.
Why is this happening
If you look at
node_modules/react-native-calendars/src/calendar/style.js
you'll observe thatgetStyle
function hasthis should be changed to
The text was updated successfully, but these errors were encountered: