react-native-reanimated
react-native-reanimated copied to clipboard
Added FrameTimings to the useFrameCallback hook
Description
This PR adds timing info to callback passed to useFrameCallback.
Changes
New type:
type FrameTimings = {
timestamp: number;
frameTime: number | null;
elapsedTime: number;
};
Before
function useFrameCallback(
callback: () => void,
autostart = true
): FrameCallback
After
function useFrameCallback(
callback: (frameInfo: FrameTimings) => void,
autostart = true
): FrameCallback
Checklist
- [x] Included code example that can be used to test this change
- [x] Updated TS types
- [ ] Added TS types tests
- [ ] Added unit / integration tests
- [x] Updated documentation
- [x] Ensured that CI passes