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

feat: Replace share text with an image on iOS #242

Merged
merged 17 commits into from
Oct 3, 2019
Merged
Prev Previous commit
Next Next commit
Linting
  • Loading branch information
James Pearson committed Oct 3, 2019
commit ca4762b63906c1dd3068eff567e36b9084b547f4
4 changes: 2 additions & 2 deletions App/Screens/Home/SelectFrequency/SelectFrequency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ interface SelectFrequencyProps extends ScrollViewProps {
onChangeFrequency: (frequency: Frequency) => void;
}

export function SelectFrequency(props: SelectFrequencyProps) {
export function SelectFrequency (props: SelectFrequencyProps) {
const scroll = useRef<ScrollView>(null);
const [dailyWidth, setDailyWidth] = useState(0); // Width of the daily button

const { frequency, onChangeFrequency, style, ...rest } = props;

function handleChangeFrequency(f: Frequency) {
function handleChangeFrequency (f: Frequency) {
setTimeout(() => {
onChangeFrequency(f);
}, 400);
Expand Down
10 changes: 5 additions & 5 deletions App/components/CigaretteBlock/CigaretteBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface CigaretteBlockProps extends ViewProps {
displayFrequency?: boolean
}

function getSwearWord(cigaretteCount: number) {
function getSwearWord (cigaretteCount: number) {
if (cigaretteCount <= 1) return i18n.t('home_common_oh');

// Return a random swear word
Expand All @@ -40,7 +40,7 @@ function getSwearWord(cigaretteCount: number) {
/**
* Compute the number of cigarettes to show
*/
export function getCigaretteCount(frequency: Frequency, cigarettePerDay: number) {
export function getCigaretteCount (frequency: Frequency, cigarettePerDay: number) {
switch (frequency) {
case 'daily': {
return cigarettePerDay;
Expand All @@ -53,11 +53,11 @@ export function getCigaretteCount(frequency: Frequency, cigarettePerDay: number)
}
}

export function CigaretteBlock(props: CigaretteBlockProps) {
export function CigaretteBlock (props: CigaretteBlockProps) {
const { isGps } = useContext(CurrentLocationContext)!;
const { cigarettesPerDay, frequency, style, displayFrequency, ...rest } = props;

const cigaretteCount = getCigaretteCount(frequency, cigarettesPerDay)
const cigaretteCount = getCigaretteCount(frequency, cigarettesPerDay);

const renderCigarettesText = () => {
// Round to 1 decimal
Expand All @@ -79,7 +79,7 @@ export function CigaretteBlock(props: CigaretteBlockProps) {
console.log('text :', text);
const [firstPartText, secondPartText] = text.split('<');

const frequencyText = displayFrequency ? (<Text>{i18n.t(`frequency_${frequency}`)}</Text>) : null
const frequencyText = displayFrequency ? (<Text>{i18n.t(`frequency_${frequency}`)}</Text>) : null;

return (
<Text style={styles.shit}>
Expand Down