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

Add larivaar settings and save them in Async Storage #32

Conversation

Gauravjeetsingh
Copy link
Contributor

@Gauravjeetsingh Gauravjeetsingh commented Jun 20, 2023

  • Save the larivaar assist and current Ang in storage
  • Add a toggle switch for larivaar

@Gauravjeetsingh Gauravjeetsingh changed the title Save the larivaar assist and current Ang in storage. Add larivaar settings and save them in Async Storage Jul 7, 2023
@Gauravjeetsingh Gauravjeetsingh marked this pull request as ready for review July 7, 2023 10:29
@Gauravjeetsingh Gauravjeetsingh self-assigned this Jul 7, 2023
useColorScheme,
View,
} from 'react-native';
import React, {useEffect, useState} from 'react';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using airbnb eslint style guide. Let's use that veerji

Already in the issues #31

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will get to this, after all current PRs are merged, and then will add another PR for this.


useEffect(() => {
readItemFromStorage();
// eslint-disable-next-line react-hooks/exhaustive-deps

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this comment from here and add readItemFromStorage as dependency to fix the issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried doing that way, but it didn't work. It keeps running the useEffect hook multiple times.

onValueChange={() => setLarivaarAssist(!larivaarAssist)}
/>
<Drawer.Navigator drawerContent={props => getSettings(props)}>
<Drawer.Screen name="Learn Larivaar" component={Launchpad} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n needs to be added to the project as well. The more we defer i18n, the harder it becomes to implement. You can do that in upcoming PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hnji veerji, will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created an issue for this here #36

Comment on lines 5 to 9
export const bakePankti = (
verse: string,
larivaar: Boolean,
larivaarAssist: Boolean,
) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended to have these arguments in object. Here's the benefit:

  1. We don't have to firmly abide by the order of arguments while passing in function call
  2. Extending the number of arguments without worrying about existing code is easy. Reduces the possibility of breaking change in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done veerji


useEffect(() => {
readItemFromStorage();
// eslint-disable-next-line react-hooks/exhaustive-deps

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be fixed. Similar issue mentioned above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this, and we even had a call about this, fixing the linting issue, makes this useEffect run on every change, we only want it to run once.

Comment on lines +25 to +28
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
marginTop: 16,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to specify display: 'flex' too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

display is by default flex here, so not needed.

@Gauravjeetsingh Gauravjeetsingh merged commit cd3b406 into KhalisFoundation:larivaar-rn-latest Aug 9, 2023
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

Successfully merging this pull request may close these issues.

2 participants