forked from hoangnm/react-native-week-view
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make header can scroll along with columns (hoangnm#30)
* make header can be scroll along with columns * move Title to new file * rename selectedDate to initialDate of Header * increase value for scrollEventThrottle * update gif image
- Loading branch information
Showing
9 changed files
with
121 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { Text, View } from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { getCurrentMonth } from '../utils'; | ||
import styles from './Title.styles'; | ||
|
||
const getFontSizeHeader = (numberOfDays) => { | ||
if (numberOfDays > 1) { | ||
return 12; | ||
} | ||
return 16; | ||
}; | ||
|
||
const Title = ({ | ||
style, | ||
numberOfDays, | ||
selectedDate, | ||
textColor, | ||
}) => { | ||
return ( | ||
<View style={[styles.title, style]}> | ||
<Text | ||
style={{ color: textColor, fontSize: getFontSizeHeader(numberOfDays) }} | ||
> | ||
{getCurrentMonth(selectedDate)} | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
Title.propTypes = { | ||
numberOfDays: PropTypes.oneOf([1, 3, 5, 7]).isRequired, | ||
selectedDate: PropTypes.instanceOf(Date).isRequired, | ||
style: PropTypes.object, | ||
textColor: PropTypes.string, | ||
}; | ||
|
||
export default React.memo(Title); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
const styles = StyleSheet.create({ | ||
title: { | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
width: 60, | ||
borderColor: '#fff', | ||
borderTopWidth: 1, | ||
}, | ||
}); | ||
|
||
export default styles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters