-
Notifications
You must be signed in to change notification settings - Fork 734
ScrollBar - TS migration #1078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScrollBar - TS migration #1078
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to export it also in src/index.ts and in generateTypes/index.d.ts
It's not exported as a stub
@Inbal-Tish |
@ethanshar I know. I have an error on 'forwardedRef.current'... |
src/components/scrollBar/index.tsx
Outdated
interface Props extends FlatListProps<any> { | ||
interface Props extends FlatListProps<any>, ForwardRefInjectedProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The props you're using for export should not include internal typings like ForwardRefInjectedProps
.
ForwardRefInjectedProps
typings are internal, we use them because we wrap our component with the forwardRef
HOC.
The way we do that is like this:
interface Props {}
type InternalProps = Props & ForwardRefInjectedProps;
// Here you use "InternalProps" cause you also expecting to get internal props like "forwardedRed", etc..
class YourComponent extends Component<InternalProps, State> {}
// Here you use "Props" - this is the API we expose for our users.
export default asBaseComponent<Props, typeof YourComponent>(forwardRef<Props>(YourComponent));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what do I export? If I do this export type ScrollBarProps = Props & ForwardRefInjectedProps;
I also export the internal prop, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,
See my code snippet.
I break the typings into two Props
& InternalProps
. Eventually I export Props
only
You can also find examples in other components (View
, Text
, etc..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…-component-2 * master: export Button enums fix typings Fix lint issues Fix Switch color based props to use ColorValue typing Fix manual placeholderTextColor typing for ChipsInput Fix manualy typing of ChipsInput for selectionColor prop fix @types/react-native version to 0.63.4 Fix rn63 typings (#1100) Revert "fix for tabbar types for scrollbar" fix for tabbar types for scrollbar ScrollBar - TS migration (#1078) TabBar refactor (#1076) Update reanimated and gesture-handler to their latest version cleanup Cards example screen upgraded expo demo app to expo v40 (#1096) Update RNN version # Conflicts: # src/components/tabController/TabBar.tsx
Description
ScrollBar - migrate to TS.
Changelog
ScrollBar - migrate to TS.