-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dark mode has decent functionality now.
- Loading branch information
1 parent
8869c35
commit b369abb
Showing
11 changed files
with
206 additions
and
187 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
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
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export default { | ||
|
||
extraSmall: 2, | ||
small: 4, | ||
medium: 8, | ||
large: 16, | ||
extraLarge: 24, | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,50 +1,31 @@ | ||
import { Dimensions, PixelRatio, TouchableWithoutFeedback } from 'react-native'; | ||
import moment from 'moment'; | ||
import "moment-timezone"; | ||
import { Dimensions } from "react-native"; | ||
|
||
const {width, height} = Dimensions.get('window'); | ||
const { width, height } = Dimensions.get("window"); | ||
const scale = width/320 | ||
const MONTHS = ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."] | ||
|
||
export const formatDate = post => moment.utc(post.postDateGmt).tz("America/Los_Angeles").toDate().toLocaleDateString(); | ||
export const getThumbnailURL = ({thumbnailInfo}) => thumbnailInfo ? (thumbnailInfo.urls.mediumLarge || thumbnailInfo.urls.full): null; | ||
// export const formatAuthors = ({tsdAuthors}) => (tsdAuthors || []).map(e => e.displayName).join(", "); | ||
export const itemize = (elements) => { | ||
return [elements.slice(0, -1).join(", "), elements.length > 2 ? elements.last() : elements].join(" and ") | ||
} | ||
export function normalize(size) { | ||
const newSize = size * scale | ||
if (Platform.OS === 'ios') { | ||
return Math.round(PixelRatio.roundToNearestPixel(newSize)) | ||
} else { | ||
return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2 | ||
} | ||
} | ||
|
||
export function decodeEntityHTML(message) { | ||
const doc = new DOMParser().parseFromString(message, "text/html"); | ||
return doc.documentElement.textContent; | ||
} | ||
|
||
|
||
// const inferred = new Intl.RelativeTimeFormat(undefined, { numeric: "auto" }) // undefined means it auto-detects locale | ||
// const DIVISIONS = [ | ||
// { amount: 60, name: 'seconds' }, | ||
// { amount: 60, name: 'minutes' }, | ||
// { amount: 24, name: 'hours' }, | ||
// { amount: 7, name: 'days' }, | ||
// { amount: 4.34524, name: 'weeks' }, | ||
// { amount: 12, name: 'months' }, | ||
// { amount: Number.POSITIVE_INFINITY, name: 'years' } | ||
// ] | ||
|
||
// export function relativeDate(date) { | ||
// let duration = (date - new Date()) / 1000 | ||
|
||
// for (let i = 0; i <= DIVISIONS.length; i++) { | ||
// const division = DIVISIONS[i] | ||
// if (Math.abs(duration) < division.amount) { | ||
// return inferred.format(Math.round(duration), division.name) | ||
// } | ||
// duration /= division.amount | ||
// } | ||
// } | ||
export const formatDate = (instance) => { | ||
let formattedMonth = MONTHS[instance.getMonth()] | ||
let formattedDay = instance.getDate() | ||
let formattedYear = instance.getFullYear() | ||
let formattedHours = instance.getHours() % 12 | ||
if (formattedHours == 0) { | ||
formattedHours = 12 | ||
} | ||
let formattedMinutes = instance.getMinutes() | ||
if (formattedMinutes < 10) { | ||
formattedMinutes = `0${formattedMinutes}` | ||
} | ||
let formattedMeridian = instance.getUTCHours % 24 < 7 ? "a.m." : "p.m." | ||
return `${formattedMonth} ${formattedDay}, ${formattedYear}, ${formattedHours}:${formattedMinutes} ${formattedMeridian}` | ||
} |
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
Oops, something went wrong.