Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions LabelContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import React, { PureComponent } from 'react';
import { View } from 'react-native';

class LabelContainer extends PureComponent {
import type { ViewProps } from 'react-native';

class LabelContainer extends PureComponent<
{ renderContent: (value: number) => React.ReactNode } & ViewProps
> {

state = {
value: Number.NaN,
};
setValue = value => {

setValue = (value: number) => {
this.setState({ value });
}

Expand Down
9 changes: 6 additions & 3 deletions hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,18 @@ export const useThumbFollower = (
renderContent: undefined | ((value: number) => ReactNode),
isPressed: boolean,
allowOverflow: boolean,
) => {
): [
JSX.Element,
(thumbPositionInView: number, value: number) => void
]|[] => {
const xRef = useRef(new Animated.Value(0));
const widthRef = useRef(0);
const contentContainerRef = useRef<FollowerContainer | null>(null);

const {current: x} = xRef;

const update = useCallback(
(thumbPositionInView, value) => {
(thumbPositionInView: number, value: number) => {
const {current: width} = widthRef;
const {current: containerWidth} = containerWidthRef;
const position = thumbPositionInView - width / 2;
Expand Down Expand Up @@ -160,7 +163,7 @@ export const useSelectedRail = (
containerWidthRef: MutableRefObject<number>,
thumbWidth: number,
disableRange: boolean,
) => {
): [Record<string, any>, () => void] => {
const {current: left} = useRef(new Animated.Value(0));
const {current: right} = useRef(new Animated.Value(0));
const update = useCallback(() => {
Expand Down