-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch react-native-ticker@5.1.0 for the project I'm working on.
This fixes these two issues we've encountered in our project using your package and improves typing in the measureStrings-array 😄
node_modules/react-native-ticker/index.tsx(161,14): error TS7006: Parameter 'acc' implicitly has an 'any' type.
node_modules/react-native-ticker/index.tsx(161,19): error TS7006: Parameter 'val' implicitly has an 'any' type.
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-ticker/index.tsx b/node_modules/react-native-ticker/index.tsx
index 1eb0eda..4737848 100644
--- a/node_modules/react-native-ticker/index.tsx
+++ b/node_modules/react-native-ticker/index.tsx
@@ -152,13 +152,13 @@ const Ticker = ({ duration = 250, containerStyle, textStyle, textProps, children
const [measured, setMeasured] = useState<boolean>(false);
const measureMap = useRef<MeasureMap>({});
- const measureStrings: string[] = Children.map(children as any, (child) => {
+ const measureStrings = Children.map(children, (child) => {
if (typeof child === "string" || typeof child === "number") {
return splitText(`${child}`);
- } else if (child) {
- return child?.props && child?.props?.rotateItems;
+ } else if (React.isValidElement(child)) {
+ return child.props && child.props.rotateItems;
}
- }).reduce((acc, val) => acc.concat(val), []);
+ })?.reduce<string[]>((acc, val) => acc.concat(val), []) || [];
const hasNumbers = measureStrings.find((v) => isNumber(v)) !== undefined;
const rotateItems = uniq([This issue body was partially generated by patch-package.
Metadata
Metadata
Assignees
Labels
No labels