Skip to content

🎥 Make videos programmatically with React

alright

Jonny Burger95ef4876068f
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
index 6a572de7bb..380baa7a92 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
@@ -295,6 +295,7 @@ export const RenderModalData: React.FC<{
canSaveDefaultProps,
cliProps,
isCustomDateUsed: serializedJSON ? serializedJSON.customDateUsed : false,
+ customFileUsed: serializedJSON ? serializedJSON.customFileUsed : false,
inJSONEditor,
propsEditType,
});
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx
index 1f0e43d1b5..b9fc986075 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx
@@ -10,6 +10,7 @@ import {Spacing} from '../../layout';
import {createZodValues} from './create-zod-values';
import {SchemaLabel} from './SchemaLabel';
import type {JSONPath} from './zod-types';
+import type {UpdaterFunction} from './ZodSwitch';
import {ZodSwitch} from './ZodSwitch';
const fullWidth: React.CSSProperties = {
@@ -64,9 +65,9 @@ export const ZodOrNullishEditor: React.FC<{
const isChecked = value === nullishValue;
- const onValueChange = useCallback(
- (newValue: unknown) => {
- setValue(() => newValue);
+ const onValueChange: UpdaterFunction<unknown> = useCallback(
+ (updater) => {
+ setValue(updater);
},
[setValue]
);
@@ -77,13 +78,13 @@ export const ZodOrNullishEditor: React.FC<{
const val = e.target.checked
? nullishValue
: createZodValues(schema, z, zodTypes);
- onValueChange(val);
+ onValueChange(() => val);
},
[nullishValue, onValueChange, schema, z, zodTypes]
);
const reset = useCallback(() => {
- onValueChange(defaultValue);
+ onValueChange(() => defaultValue);
}, [defaultValue, onValueChange]);
const save = useCallback(() => {
diff --git a/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts b/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts
index 6481615f22..8e977f7458 100644
--- a/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts
+++ b/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts
@@ -42,7 +42,15 @@ const getCannotSaveDefaultProps = (canSaveDefaultProps: TypeCanSaveState) => {
const customDateUsed = (used: boolean | undefined, inJSONEditor: boolean) => {
if (used && inJSONEditor) {
- return "There is a Date in the schema which can't be serialized. It has been converted into a string.";
+ return 'There is a Date in the schema which was serialized. Note the custom syntax.';
+ }
+
+ return null;
+};
+
+const staticFileUsed = (used: boolean | undefined, inJSONEditor: boolean) => {
+ if (used && inJSONEditor) {
+ return 'There is a staticFile() in the schema which was serialized. Note the custom syntax.';
}
return null;
@@ -52,12 +60,14 @@ export const getRenderModalWarnings = ({
cliProps,
canSaveDefaultProps,
isCustomDateUsed,
+ customFileUsed,
inJSONEditor,
propsEditType,
}: {
cliProps: unknown;
canSaveDefaultProps: TypeCanSaveState;
- isCustomDateUsed: boolean | undefined;
+ isCustomDateUsed: boolean;
+ customFileUsed: boolean;
inJSONEditor: boolean;
propsEditType: PropsEditType;
}) => {
@@ -65,5 +75,6 @@ export const getRenderModalWarnings = ({
getInputPropsWarning({cliProps, propsEditType}),
getCannotSaveDefaultProps(canSaveDefaultProps),
customDateUsed(isCustomDateUsed, inJSONEditor),
+ staticFileUsed(customFileUsed, inJSONEditor),
].filter(truthy);
};
diff --git a/packages/example/src/Video.tsx b/packages/example/src/Video.tsx
index 5cc590d525..098715b2fa 100644
--- a/packages/example/src/Video.tsx
+++ b/packages/example/src/Video.tsx
@@ -783,8 +783,10 @@ export const Index: React.FC = () => {
longEnum: 'k' as const,
color: '#eb3a60',
nullable: null,
- optional: 'hihi',
- filePath: staticFile('remotion-file:nested/mp3.png'),
+ optional: '5645656',
+ filePath: staticFile(
+ 'remotion-file:remotion-file%3Aremotion-file%253Anested%252Fmp3.png'
+ ),
}}
durationInFrames={150}
/>