更改 react-native-calendars 的背景颜色

huangapple go评论81阅读模式
英文:

Change backgroundColor of react-native-calendars

问题

我正在使用react-native-calendars制作一个应用程序。

我想将日历的背景颜色更改为蓝色。

<Calendar 
   style={{backgroundColor: "blue"}}
/>

我尝试了以下方法,但问题是只有日历的边框变了颜色。

我想要整个日历的背景变成蓝色。

如果您知道解决方法,请回复。

谢谢。

英文:

I'm making an app with react-native-calendars.

I want to change the background color of the calendar to blue.

&lt;Calendar 
   style={{backgroundColor: &quot;blue&quot;}}
/&gt;

I've tried the following, but the problem is that only the borders of the calendar change.

I want the background of the entire calendar to turn blue.

Please reply if you know a solution.

Thanks.

答案1

得分: 0

<!-- 开始代码段:js 隐藏:false 控制台:true Babel:false -->

<!-- 语言:lang-js -->

<日历
样式={{ 背景颜色:'透明' }}
主题={{
日历背景:'透明',
}}
/>

<!-- 结束代码段 -->

将calendarBackground设置为您所需的颜色

英文:

Can you try this ,

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

&lt;Calendar
        style={{ backgroundColor: &#39;transparent&#39; }}
        theme={{
          calendarBackground: &#39;transparent&#39;, 
        }}
      /&gt;

<!-- end snippet -->

Set calendarBackground to your desired color

huangapple
  • 本文由 发表于 2023年8月10日 11:46:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76872532.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定