Skip to content

Commit ed9d2e8

Browse files
Cast ImageSource to ImageSourcePropType
1 parent 2d6e99b commit ed9d2e8

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

package/src/RNCSliderNativeComponent.web.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
GestureResponderEvent,
88
LayoutChangeEvent,
99
Image,
10+
ImageSourcePropType,
1011
} from 'react-native';
1112
//@ts-ignore
1213
import type {ImageSource} from 'react-native/Libraries/Image/ImageSource';
@@ -79,7 +80,7 @@ const RCTSliderWebComponent = React.forwardRef(
7980
const containerRef = forwardedRef || React.createRef();
8081
const containerPositionInvalidated = React.useRef(false);
8182
const [value, setValue] = React.useState(initialValue || minimumValue);
82-
const lastInitialValue = React.useRef<number>();
83+
const lastInitialValue = React.useRef<number>(0);
8384
const animationValues = React.useRef<AnimationValues>({
8485
val: new Animated.Value(value),
8586
min: new Animated.Value(minimumValue),
@@ -364,7 +365,7 @@ const RCTSliderWebComponent = React.forwardRef(
364365
<View pointerEvents="none" style={thumbViewStyle}>
365366
{thumbImage !== undefined ? (
366367
<Image
367-
source={thumbImage}
368+
source={thumbImage as ImageSourcePropType}
368369
style={{width: '100%', height: '100%'}}
369370
/>
370371
) : null}

package/src/Slider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
NativeSyntheticEvent,
1010
StyleProp,
1111
View,
12-
ImageSource
12+
ImageSource,
13+
ImageSourcePropType
1314
} from 'react-native';
1415
import RCTSliderNativeComponent from './index';
1516

@@ -318,7 +319,7 @@ const SliderComponent = (
318319
? props.thumbImage
319320
: props.StepMarker || !props.thumbImage
320321
? undefined
321-
: Image.resolveAssetSource(props.thumbImage)
322+
: Image.resolveAssetSource(props.thumbImage as ImageSourcePropType)
322323
}
323324
ref={forwardedRef}
324325
style={[

package/src/components/TrackMark.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {FC} from 'react';
2-
import {Image, ImageSource, View} from 'react-native';
2+
import {Image, ImageSource, ImageSourcePropType, View} from 'react-native';
33
import {styles} from '../utils/styles';
44

55
export type MarkerProps = {
@@ -42,7 +42,7 @@ export const SliderTrackMark = ({
4242
) : null}
4343
{thumbImage && isTrue ? (
4444
<View style={styles.thumbImageContainer}>
45-
<Image source={thumbImage} style={styles.thumbImage} />
45+
<Image source={thumbImage as ImageSourcePropType} style={styles.thumbImage} />
4646
</View>
4747
) : null}
4848
</View>

0 commit comments

Comments
 (0)