From 0dadb6be79e480a2c59b289527c12a343a6f055a Mon Sep 17 00:00:00 2001 From: Marcus Engebretsen Date: Mon, 19 Sep 2022 22:28:54 +0200 Subject: [PATCH 1/2] Fix tsx errors when using typescript 4.8.3. Including noImplicitAny and interface specification for LabelContainer --- LabelContainer.tsx | 32 ++++++++++++-------------------- hooks.tsx | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/LabelContainer.tsx b/LabelContainer.tsx index 1e36836..4a0c7b2 100644 --- a/LabelContainer.tsx +++ b/LabelContainer.tsx @@ -1,25 +1,17 @@ -import React, { PureComponent } from 'react'; -import { View } from 'react-native'; +import React, { useState, ReactNode } from 'react'; +import { StyleProp, View, ViewProps } from 'react-native'; -class LabelContainer extends PureComponent { +export interface Props { + renderContent: (value: T) => ReactNode; +} - state = { - value: Number.NaN, - }; - - setValue = value => { - this.setState({ value }); - } +const LabelContainer = ({ + renderContent, + ...restProps +}: Props & StyleProp) => { + const [value, setValue] = useState(Number.NaN); - render() { - const { renderContent, ...restProps } = this.props; - const { value } = this.state; - return ( - - {renderContent(value)} - - ); - } -} + return {renderContent(value)}; +}; export default LabelContainer; diff --git a/hooks.tsx b/hooks.tsx index 85214b2..b6c9c6f 100644 --- a/hooks.tsx +++ b/hooks.tsx @@ -106,7 +106,7 @@ export const useThumbFollower = ( ) => { const xRef = useRef(new Animated.Value(0)); const widthRef = useRef(0); - const contentContainerRef = useRef(null); + const contentContainerRef = useRef(); const {current: x} = xRef; From 539832fe62a97dfc997ef94d75671cb401f78d33 Mon Sep 17 00:00:00 2001 From: Marcus Engebretsen Date: Mon, 19 Sep 2022 22:30:10 +0200 Subject: [PATCH 2/2] Bump version numbers --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d4918c1..86013f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rn-range-slider", - "version": "2.2.2", + "version": "2.2.3", "author": "Tigran Sahakyan ", "description": "A highly optimized pure JS implementation of Range Slider for React Native", "homepage": "https://github.com/githuboftigran/rn-range-slider",