🎥 Make videos programmatically with React
Expose `style` in `Loop`
Afzal Sayed0e32f3184ada
diff --git a/packages/core/src/loop/index.tsx b/packages/core/src/loop/index.tsxindex 1d2bf7d401..6c364603cd 100644--- a/packages/core/src/loop/index.tsx+++ b/packages/core/src/loop/index.tsx@@ -1,5 +1,6 @@import React from 'react';import {Sequence} from '../Sequence';+import type {LayoutAndStyle} from '../Sequence';import {useVideoConfig} from '../use-video-config';import {validateDurationInFrames} from '../validation/validate-duration-in-frames';@@ -8,17 +9,16 @@ export type LoopProps = {durationInFrames: number;// How many times to loop (optional, default Infinity)times?: number;- layout?: 'absolute-fill' | 'none';name?: string;children: React.ReactNode;-};+} & LayoutAndStyle;export const Loop: React.FC<LoopProps> = ({durationInFrames,times = Infinity,children,- layout,name,+ ...props}) => {const {durationInFrames: compDuration} = useVideoConfig();validateDurationInFrames(durationInFrames, 'of the <Loop /> component');@@ -53,10 +53,11 @@ export const Loop: React.FC<LoopProps> = ({key={`loop-${i}`}durationInFrames={durationInFrames}from={i * durationInFrames}- layout={layout}name={name}showLoopTimesInTimeline={actualTimes}showInTimeline={i === 0}+ layout={props.layout}+ {...(props.layout==='absolute-fill' && {style: props.style})}>{children}</Sequence>diff --git a/packages/docs/docs/loop.md b/packages/docs/docs/loop.mdindex 05417f519d..de548b12eb 100644--- a/packages/docs/docs/loop.md+++ b/packages/docs/docs/loop.md@@ -24,6 +24,8 @@ The Loop component is a high order component and accepts, besides it's children,- `layout`: _(optional)_: Either `"absolute-fill"` _(default)_ or `"none"` By default, your content will be absolutely positioned. If you would like to disable layout side effects, pass `layout="none"`.+- `style`: _(optional)_: CSS styles to be applied to the container. If `layout` is set to `none`, there is no container and setting this style is not allowed.+:::infoGood to know: You can nest loops within each other and they will cascade. For example, a loop that has a duration of 30 frames which is inside a loop that has a duration of 75 will play 2 times. However, nested loops are not currently displayed in the timeline.:::