Skip to content
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

prop to change the size of the date number? On OnePlus5. The date text is being cut off. #86

Closed
ZeerakHameem opened this issue Mar 9, 2018 · 17 comments

Comments

@ZeerakHameem
Copy link

No description provided.

@peacechen
Copy link
Collaborator

See #64 for suggestions on controlling the sizing.

If that doesn't work, PR #87 might address it

@ZeerakHameem
Copy link
Author

Tried #64, it didn't work. When are you planning to release the Pull request?

@ZeerakHameem
Copy link
Author

screenshot_20180310-142602
It should show 10 after 9, when i remove all the styling for the DateNumberText in the CalendarStrip file. It shows the whole text. But when the default styles are applied the text is being cut off. Any help would be really appreciated.

@peacechen
Copy link
Collaborator

You can point directly to this repo to try the latest code which has the prop allowFontScaling.

It looks like the text is too wide to fit in the container and is getting truncated. Please post your <CalendarStrip ...> code.

@ZeerakHameem
Copy link
Author

<CalendarStrip
ref={(ref) => this._calendar = ref}
calendarAnimation={{type: 'parallel', duration: 30}}
daySelectionAnimation={{
type: 'background',
duration: 200,
highlightColor: '#ff9800'
}}
style={{height: 100, paddingTop: 20, paddingBottom: 10}}
calendarHeaderStyle={{color: '#28318c'}}
calendarColor={'#ffffff'}
responsiveSizingOffset={-10}
dateNumberStyle={{color: '#28318c'}}
dateNameStyle={{color: '#28318c'}}
maxDayComponentSize={25}
showMonth={true}
onDateSelected={(date) => this.settingDateAndMakingNetworkCall(date.year(), date.month(), date.date())}
selectedDate={this.state.selectedDay}
highlightDateNumberStyle={{color: '#ffffff'}}
highlightDateNameStyle={{color: '#ffffff'}}
weekendDateNameStyle={{color: '#28318c'}}
weekendDateNumberStyle={{color: '#28318c'}}
disabledDateNameStyle={{color: 'green'}}
disabledDateNumberStyle={{color: 'green'}}
iconLeft={left_arrow}
iconRight={right_arrow}
iconContainer={{flex: 0.1}}

@ZeerakHameem
Copy link
Author

I am already pointing to version 1.3.1. That doesn't have the allowFontScalling prop.

@peacechen
Copy link
Collaborator

Pointing to a version pulls from the npm registry. Use the repo url:

dependencies: {
  "react-native-calendar-strip": "https://github.com/BugiDev/react-native-calendar-strip"
} 

@ZeerakHameem
Copy link
Author

Hi, the allowFontScalling prop didn't solve the issue. I dug a little deeper in the code and started doing some changes in the CalendarStrip locally on my machine.
If you go to CalendarStrip -> CalendarDay -> In the return method there is a top level View under TouchableOpacity. That View has some styles, the styles.dateContainerstyle has three properties. If I remove the alignItems:'center' property the complete date shows up but the text is slightly displaced (not in complete center).
I hope this will help you to resolve the issue.

@peacechen
Copy link
Collaborator

It appears that the calculated font size dateNameFontSize in CalendarDay.js is too big in your case. Would you try setting responsiveSizingOffset={-20} or a smaller number?

Another test would be to reduce the width of the CalendarStrip, either forced through its style or wrap it in a View container. That's just an experiment, not proposing it as a solution for you. If that works, a new prop may be needed to fine tune the responsive text sizing.

@peacechen
Copy link
Collaborator

peacechen commented Mar 31, 2018

@ZeerakHameem
It's tough to adjust this correctly for you since I don't have the device. Would you try tweaking the size values in calcSizes?
https://github.com/BugiDev/react-native-calendar-strip/blob/master/src/CalendarDay.js#L113

The easiest way for you to iterate on it is to edit the files under node_modules/react-native-calendar-strip/src/

I'm not thrilled with the magic numbers used to calculate the sizes. It may need to take into account PixelRatio or some other dynamically fetched value.

@asimkhan0
Copy link
Contributor

asimkhan0 commented Aug 13, 2018

@peacechen @ZeerakHameem I have a pull request for this issue
#106

@peacechen
Copy link
Collaborator

Thanks @asimkhan0 👍

I'll publish on npm after it's gotten more testing. For the time being you can use this by pointing the package.json directly to this repo:

  "dependencies": {
    "react-native-calendar-strip": "https://github.com/BugiDev/react-native-calendar-strip.git",
    // ...
  }

@rusticdeity
Copy link
Contributor

The text cutoff issue on OnePlus devices is caused due to the OnePlus Slate font. Change the default font to Roboto and it should work. I have tested this on a OnePlus device. Also adding an extra space at the end of string literals will fix the issue. But the recommended approach is to load your font and use it throughout the App.

@peacechen
Copy link
Collaborator

Thanks @GIT-Sachin for reporting that. Would you mind creating a PR to add that information to the Readme? Create a new section towards the bottom titled Device Specific Notes.

Does reducing the fontSize passed to the dateNumberStyle prop fix the issue when using the OnePlus Slate font? If not, that sounds like OnePlus Slate is not properly respecting the fontSize attribute.

@rusticdeity
Copy link
Contributor

@peacechen I have tested with fontSize for dateNumberStyle and it still does not work. Also I have created a pull request. I haven't mentioned the workaround of adding space at the end of string literals since it is not applicable in this case and also not recommended.

rusticdeity added a commit to rusticdeity/react-native-calendar-strip that referenced this issue Jun 9, 2020
* Update Readme with device specific notes for OnePlus font (BugiDev#188, BugiDev#86)

* Add callback feature to markedDates prop. 

Fix selected dot style.

* Fix scrollable initial month header and next selector (BugiDev#191).

* Debounce onLayout to reduce resize thrashing (BugiDev#184).

* 2.0.2

* Fix scrolling animation bug on iOS devices (BugiDev#193)

* Add prop `onHeaderSelected` (BugiDev#182).

* 2.0.3

* Add `lines` feature to markedDates (BugiDev#190). 

Update example app with lines and dots.

* Add `headerText` prop to support custom header text (BugiDev#129).

Co-authored-by: peacechen <github@ghpc.33mail.com>
Co-authored-by: Caio Biodere <caiobiodere@gmail.com>
@peacechen
Copy link
Collaborator

See Readme for OnePlus work-around
https://github.com/BugiDev/react-native-calendar-strip#device-specific-notes

@ChristopherDcosta
Copy link

How to get only the month name like you're getting in your screen? I'm getting month name with year, I don't want that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants