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

Feature/progress indicator #43

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

jawwadurrehman
Copy link

No description provided.


return (
<View style={containerStyle} onLayout={handleLayout}>
<Svg width="100%" height="100%" style={progressStyle}>
Copy link
Contributor

@thetaungg thetaungg Dec 13, 2022

Choose a reason for hiding this comment

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

does this work on the mobile?
need to check

Copy link
Contributor

Choose a reason for hiding this comment

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

DId you check?

},
};

export const Circular: ComponentStory<typeof CircularExample> = args => (
Copy link
Contributor

Choose a reason for hiding this comment

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

CircularExample has props

  • animatedValue
  • trackColor - not required for circular
  • visible - doesn't do anything

Also, What is the use for indeterminateMaxWidth in Circular indicator?

}, [animationScale, progress, progressAnim]);

// if it's indeterminate state, we want to use ActivityIndicator instead
if (indeterminate)
Copy link
Contributor

Choose a reason for hiding this comment

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

return fast.
If indeterminate.. the rest of the computations can be skipped.

import { default as CircularProgressIndicator } from './Circular';

export const ProgressIndicator = Object.assign(
// @component ./Checkbox.tsx
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename

new Array(frames),
(_, frameIndex) => frameIndex / (frames - 1),
);
const outputRange = Array.from(new Array(frames), (_, frameIndex) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

needs to be broken down into a separate function and be memoized.
You are creating this range over and over again.. every time the component is rendered. or for example color changes..

Copy link
Contributor

Choose a reason for hiding this comment

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

same for input range

}

// Animate progress bar
if (indeterminate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could be broken down into a separate component

accessibilityValue: indeterminate ? {} : { min: 0, max: 100, now: progress * 100 },
containerStyle: container,
animatedContainerStyle: [animatedContainer, { opacity: fade }, restStyle],
progressBarStyle: [
Copy link
Contributor

Choose a reason for hiding this comment

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

can be abstracted into a separate useMemo

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.

3 participants