Skip to content

Conversation

alpha0010
Copy link
Contributor

Overview

Updating to react native 0.71, TypeScript errors on this library. The utility type Constructor is private in latest typings. Using this export degrades to any type.

JSX element class does not support attributes because it does not have a 'props' property.

Test Plan

npx tsc runs clean after making this change on a RN 0.71 app.

@go-sean-go
Copy link

go-sean-go commented Feb 10, 2023

Just to point out, RN 0.71 is now TypeScript-by-default, so this library will fail for all new projects without this or some other fix.

(btw, I am using @alpha0010's fix and it works for me!)

@JoniVR
Copy link

JoniVR commented Feb 21, 2023

Aww shit, here I go patching again, a day in the life of a RN developer...
God bless patch-package

Anyone wanting the .patch file (or just append .diff/.patch behind the url of this PR):

diff --git a/node_modules/@react-native-segmented-control/segmented-control/index.d.ts b/node_modules/@react-native-segmented-control/segmented-control/index.d.ts index b914477..040f29c 100644 --- a/node_modules/@react-native-segmented-control/segmented-control/index.d.ts +++ b/node_modules/@react-native-segmented-control/segmented-control/index.d.ts @@ -6,11 +6,12 @@ import { ViewProps, NativeSyntheticEvent, NativeMethods, - Constructor, TargetedEvent, ViewStyle, } from 'react-native'; +type Constructor<T> = new (...args: any[]) => T; + export interface NativeSegmentedControlIOSChangeEvent extends TargetedEvent { value: string; selectedSegmentIndex: number;

Can a maintainer please merge this?

@narliecholler
Copy link

any timeframe on merging this?

@Naturalclar :D

Copy link
Member

@Naturalclar Naturalclar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Naturalclar Naturalclar merged commit 96923f7 into react-native-segmented-control:master Mar 15, 2023
github-actions bot pushed a commit that referenced this pull request Mar 15, 2023
## [2.4.1](v2.4.0...v2.4.1) (2023-03-15) ### Bug Fixes * **types:** utility type removed from RN 0.71 ([#667](#667)) ([96923f7](96923f7))
@Naturalclar
Copy link
Member

@narliecholler thanks for the ping! just released new version with the fix as 2.4.1

@narliecholler
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants