feat: support alternative container via as prop#112
Open
amoshydra wants to merge 1 commit intoGamote:mainfrom
Open
feat: support alternative container via as prop#112amoshydra wants to merge 1 commit intoGamote:mainfrom
amoshydra wants to merge 1 commit intoGamote:mainfrom
Conversation
|
i love this addition but i have encountered a type problem with it everything else WORKS absolutely awesome!!! my example involves imbeding it into an existing svg... therefore i also want to set svg props. If i do this i get the error that y does not exist even tho everything works perfectly fine i tried to fix it but didn't quite get it right export type LottieOptions<CT extends (ElementType | ComponentType) = "div",T extends RendererType = "svg"> = Omit<
AnimationConfigWithData<T>,
"container" | "animationData"
> & {
animationData: unknown;
lottieRef?: LottieRef;
onComplete?: AnimationEventHandler | null;
onLoopComplete?: AnimationEventHandler | null;
onEnterFrame?: AnimationEventHandler | null;
onSegmentStart?: AnimationEventHandler | null;
onConfigReady?: AnimationEventHandler | null;
onDataReady?: AnimationEventHandler | null;
onDataFailed?: AnimationEventHandler | null;
onLoadedImages?: AnimationEventHandler | null;
onDOMLoaded?: AnimationEventHandler | null;
onDestroy?: AnimationEventHandler | null;
as?: CT;
} & Omit<ComponentPropsWithRef<CT>, "loop" | "as">;i redefined the LottieOptions to this so you are also able to pass these props but then i got errors in the useLottie hook: the problem is that the props of the wrapper get now passed to the config aswell... Maybe you have a solution to this problem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Provide a new prop
asallowing container to be switched out to a user providedReact.ElementTypeorReact.ComponentTypeRelated to
Related to #110
How is this tested?
Tested with the following code snippet (This is not included in this PR / documentation change)