react-native-week-view: React Native on macOS or on web - broken width and month not changing
The library is not working when compiling a react-native project for macOS (Catalyst for example). Itโs not working either when using react-native-web version.
The following elements are not working:
- The width of the day header is not correct
- The scroll is hard to test in these conditions, but it seems to not be able to trigger a next month change when you scroll past a certain amount of time horizontally.
Please find a video illustrating the first examples:

Steps to reproduce:
- create a react-native-web repository (u can use boilerplates like https://github.com/infinitered/ignite that support iOS/android and web
- add
react-native-week-viewpackage - fix the issue reported on https://github.com/hoangnm/react-native-week-view/issues/196
- include the
<WeekView... />component on a page - try to render it on a web page
Notes
- It could be some simple width and height calculation to update and that would make it work ๐ค
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 17
The current workaround is to add navigation button to navigate to previous or next week.
PR #201 will fix up to 4.1.
As to 4.2, Iโm afraid without scroll events in web there is not much more we can do. I see a lot of attention in rn-web, (e.g. https://github.com/necolas/react-native-web/issues/2249, https://github.com/necolas/react-native-web/pull/2241), hopefully they will have a fix soon
On the side, Iโm implementing some performance improvements, and that might include migrating to recycler-list-view, which should support rn-web scroll events. Although these changes are taking me a bit longer.(Iโll probably open a separate issue regarding this soon). UPDATE: See #209, we are not migrating to another library for now.So our best bet might be to wait for
react-native-webto supportonMomentumScrollEnd.Maybe this comment is related to our issue: https://github.com/expo/expo/issues/16822#issuecomment-1099169366 ?
TL;DR: I fixed some things, but is still not working 100%, probably due to an upstream bug from react-native-web
VirtualizedList. Demo:(btw the cursor is not moving because I was scrolling with the wheel)
Details:
There are multiple things in the initial example that were wrong:
startHouris not performed (i.e. you cannot callscrollTo()for theScrollViewref)What I did:
ScrollViewโs height toheight: '100vh'(100 viewportโs height, web only)VirtualizedListandFlatListhave shown issues in react-native-web (for example see a list of issues here: https://github.com/necolas/react-native-web/pull/2241#issuecomment-1055824946)initialScrollIndexbehavior was fixed --> the week starts pointing to today (see gif)yarn add react-native-web@0.0.0-b2a3e86d, see preview here: https://github.com/necolas/react-native-web/pull/2248)onMomentumScrollEndevent from the horizontalVirtualizedListis not being triggeredVirtualizedListexample, and I think this is an issue from react-native-web (I can provide more details for a small repro)4.2 is probably a dealbreaker for most apps. We should corroborate if it is a bug from react-native-web; hopefully they will have a workaround soon
I havenโt added meets on the first test I did. Let me give it a try and get back to u