From 0c04180e96219a6a4e4453fbe440f4676926cc11 Mon Sep 17 00:00:00 2001 From: Matin Zadeh Dolatabad Date: Tue, 25 Jul 2023 01:05:04 +0200 Subject: [PATCH] fix: prevent jumping to end frame (#1061) No need to force the animation to be on end frame anymore. Fixes: https://github.com/lottie-react-native/lottie-react-native/issues/1049 --- apps/paper/src/FramesExample.tsx | 56 +++++++++++++++++++ .../ios/LottieReactNative/ContainerView.swift | 4 -- 2 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 apps/paper/src/FramesExample.tsx diff --git a/apps/paper/src/FramesExample.tsx b/apps/paper/src/FramesExample.tsx new file mode 100644 index 00000000..a4155618 --- /dev/null +++ b/apps/paper/src/FramesExample.tsx @@ -0,0 +1,56 @@ +import LottieView from 'lottie-react-native'; +import {useRef, useState} from 'react'; +import {Button, StyleSheet, TextInput, View} from 'react-native'; + +export const FramesExample = () => { + const [startFrame, setStartFrame] = useState(0); + const [endFrame, setEndFrame] = useState(15); + + const ref = useRef(null); + + const playFrames = () => { + ref.current?.play(startFrame, endFrame); + }; + + return ( + + + setStartFrame(parseInt(e ?? 0))} + /> + setEndFrame(parseInt(e ?? 0))} + /> +