Skip to content

Commit 5f26ca9

Browse files
committed
(react-native-lightning) Update some component prop typings
1 parent c86498e commit 5f26ca9

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

.changeset/four-comics-agree.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@plexinc/react-native-lightning": patch
3+
---
4+
5+
Update some component typings

packages/react-native-lightning/src/exports/Image.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@ import type {
55
ImageLoadEventData,
66
ImageSourcePropType,
77
ImageURISource,
8+
Image as RNImage,
89
ImageProps as RNImageProps,
910
} from 'react-native';
1011
import { createLayoutEvent } from '../utils/createLayoutEvent';
1112
import { createNativeSyntheticEvent } from '../utils/createNativeSyntheticEvent';
1213
import type { ViewProps } from './View';
1314

14-
export interface ImageProps extends RNImageProps, Omit<ViewProps, 'style'> {
15-
onImageLoaded?: (dimensions: { width: number; height: number }) => void;
16-
}
15+
export type ImageProps = RNImageProps &
16+
Omit<ViewProps, 'style'> & {
17+
onImageLoaded?: (dimensions: { width: number; height: number }) => void;
18+
};
1719

1820
function isImageURISource(
1921
source: ImageSourcePropType,
2022
): source is ImageURISource {
2123
return !Array.isArray(source);
2224
}
2325

26+
export type Image = RNImage & LightningImageElement;
27+
2428
export const Image = forwardRef<LightningImageElement, ImageProps>(
2529
(
2630
{

packages/react-native-lightning/src/exports/Text.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
Rect,
66
} from '@plexinc/react-lightning';
77
import { forwardRef, useCallback, useMemo } from 'react';
8-
import type { TextProps as RNTextProps } from 'react-native';
8+
import type { Text as RNText, TextProps as RNTextProps } from 'react-native';
99
import { createLayoutEvent } from '../utils/createLayoutEvent';
1010
import type { ViewProps } from './View';
1111

@@ -18,6 +18,8 @@ const defaultTextStyle: Partial<LightningTextElementStyle> = {
1818
fontWeight: 'normal',
1919
};
2020

21+
export type Text = RNText & LightningTextElement;
22+
2123
export const Text = forwardRef<LightningTextElement, TextProps>(
2224
(
2325
{

packages/react-native-lightning/src/exports/View.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type {
22
FocusableProps,
3+
LightningElement,
34
LightningViewElementProps,
45
Rect,
56
} from '@plexinc/react-lightning';
@@ -8,7 +9,7 @@ import type { LightningViewElement } from '@plexinc/react-lightning';
89
import type { AllStyleProps } from '@plexinc/react-lightning-plugin-css-transform';
910
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1011
import { forwardRef, useCallback } from 'react';
11-
import type { ViewProps as RNViewProps } from 'react-native';
12+
import type { View as RNView, ViewProps as RNViewProps } from 'react-native';
1213
import { createLayoutEvent } from '../utils/createLayoutEvent';
1314

1415
type CombinedProps = RNViewProps &
@@ -32,6 +33,8 @@ export const defaultViewStyle = {
3233
zIndex: 0,
3334
};
3435

36+
export type View = RNView & LightningElement;
37+
3538
export const View: ForwardRefExoticComponent<ViewProps> = forwardRef<
3639
LightningViewElement,
3740
ViewProps

0 commit comments

Comments
 (0)