【问题标题】:React Native change calendar heightReact Native 更改日历高度
【发布时间】:2020-05-01 21:16:52
【问题描述】:

我正在尝试制作一个带有日历和其他内容的页面。我正在使用 wix/react-native-calendars 并且无法更改日历的高度。当我输入高度时,我希望它只是剪掉日历。

  <CalendarList
    horizontal={true}
    pagingEnabled={true}
    style={{height: SCREEN_HEIGHT * 0.4}}
  />

【问题讨论】:

    标签: react-native react-native-calendars


    【解决方案1】:

    如果您想完全控制日历样式,可以通过覆盖默认 style.js 文件来实现。例如,如果您想先覆盖样式,则必须找到此文件的样式表 ID:

    https://github.com/wix/react-native-calendars/blob/master/src/calendar/header/style.js#L4

    在这种情况下,它是 stylesheet.calendar.header。接下来,您可以使用此 ID 将覆盖样式表添加到您的主题中。

    https://github.com/wix/react-native-calendars/blob/master/example/src/screens/calendars.js#L56

     theme={{
          arrowColor: 'white',
          'stylesheet.calendar.header': {
            week: {
              marginTop: 5,
              flexDirection: 'row',
              justifyContent: 'space-between'
            }
          }
        }}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多