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(ui): non full-windowed support #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ const MyComponent = () => (

## Props

| Name | Type | Description | Required | Default |
|------------------|------------------------|--------------------------------------------|----------|----------------|
| count | number | items count to display | required | |
| origin | {x: number, y: number} | animation position origin | required | |
| explosionSpeed | number | explosion duration (ms) from origin to top | | 350 |
| fallSpeed | number | fall duration (ms) from top to bottom | | 3000 |
| fadeOut | boolean | make the confettis disappear at the end | | false |
| colors | string[] | give your own colors to the confettis | | default colors |
| autoStart | boolean | auto start the animation | | true |
| autoStartDelay | number | delay to wait before triggering animation | | 0 |
| Name | Type | Description | Required | Default |
|------------------|---------------------------------|--------------------------------------------|----------|--------------------------|
| count | number | items count to display | required | |
| origin | {x: number, y: number} | animation position origin | required | |
| window | {width: number, height: number} | width and height of the animation "window" | | Dimensions.get('window') |
Copy link
Owner

@VincentCATILLON VincentCATILLON Sep 30, 2022

Choose a reason for hiding this comment

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

Suggested change
| window | {width: number, height: number} | width and height of the animation "window" | | Dimensions.get('window') |
| dimensions | {width: number, height: number} | width and height of the animation "window" | | Dimensions.get('window') |

looks more explicit than window

| explosionSpeed | number | explosion duration (ms) from origin to top | | 350 |
| fallSpeed | number | fall duration (ms) from top to bottom | | 3000 |
| fadeOut | boolean | make the confettis disappear at the end | | false |
| colors | string[] | give your own colors to the confettis | | default colors |
| autoStart | boolean | auto start the animation | | true |
| autoStartDelay | number | delay to wait before triggering animation | | 0 |

## Events

Expand Down
4 changes: 4 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export interface ExplosionProps {
x: number;
y: number
};
window?: {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
window?: {
dimensions?: {

width: number,
height: number,
},
explosionSpeed?: number;
fallSpeed?: number;
colors?: string[];
Expand Down
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ type Props = {|
x: number,
y: number
},
window?: {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
window?: {
dimensions?: {

width: number,
height: number,
},
explosionSpeed?: number,
fallSpeed?: number,
colors?: Array<string>,
Expand Down Expand Up @@ -178,9 +182,9 @@ class Explosion extends React.PureComponent<Props, State> {
};

render() {
const { origin, fadeOut } = this.props;
const { origin, fadeOut, window } = this.props;
Copy link
Owner

@VincentCATILLON VincentCATILLON Sep 30, 2022

Choose a reason for hiding this comment

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

Suggested change
const { origin, fadeOut, window } = this.props;
const { origin, fadeOut, dimensions = Dimensions.get('window') } = this.props;

const { items } = this.state;
const { height, width } = Dimensions.get('window');
const { height, width } = window ?? Dimensions.get('window');
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
const { height, width } = window ?? Dimensions.get('window');
const { height, width } = dimensions;


return (
<React.Fragment>
Expand Down