@hero-design/rn 0.0.0-mainIsReactNative-20260826163045 → 0.0.0-mainIsReactNative-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
import RnSlider from '@react-native-community/slider';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { Platform, Text, View } from 'react-native';
|
|
4
4
|
import { useTheme } from '../../theme';
|
|
5
5
|
|
|
6
|
+
type RnSliderType = typeof import('@react-native-community/slider').default;
|
|
7
|
+
|
|
8
|
+
const LINKING_ERROR =
|
|
9
|
+
`The package '@react-native-community/slider' doesn't seem to be linked. Make sure: \n\n` +
|
|
10
|
+
Platform.select({ ios: `- You have run 'pod install'\n`, default: '' }) +
|
|
11
|
+
`- You rebuilt the app after installing the package\n`;
|
|
12
|
+
|
|
13
|
+
let RnSlider: RnSliderType | null = null;
|
|
14
|
+
try {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
16
|
+
RnSlider = require('@react-native-community/slider').default;
|
|
17
|
+
} catch {
|
|
18
|
+
// package not linked — SliderComponent will render the linking error
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const SliderComponent: React.ComponentType<React.ComponentProps<RnSliderType>> =
|
|
22
|
+
RnSlider ??
|
|
23
|
+
(() => (
|
|
24
|
+
<View>
|
|
25
|
+
<Text>{LINKING_ERROR}</Text>
|
|
26
|
+
</View>
|
|
27
|
+
));
|
|
28
|
+
|
|
6
29
|
export interface SingleSliderProps {
|
|
7
30
|
/**
|
|
8
31
|
* Minimum value of the slider.
|
|
@@ -70,7 +93,7 @@ const Slider = ({
|
|
|
70
93
|
const { selectedTrack, thumb, unselectedTrack } = theme.__hd__.slider.colors;
|
|
71
94
|
|
|
72
95
|
return (
|
|
73
|
-
<
|
|
96
|
+
<SliderComponent
|
|
74
97
|
minimumValue={minimumValue}
|
|
75
98
|
maximumValue={maximumValue}
|
|
76
99
|
step={step}
|