Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/core/src/components/DeckSwiper/DeckSwiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface DeckSwiperProps<T> {
keyExtractor?: (item: T) => string;
renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
style?: StyleProp<ViewStyle>;
className?: string;
}

const DeckSwiper = React.forwardRef<DeckSwiperRef, DeckSwiperProps<any>>(
Expand All @@ -48,6 +49,7 @@ const DeckSwiper = React.forwardRef<DeckSwiperRef, DeckSwiperProps<any>>(
keyExtractor,
renderItem,
style,
className,
children,
}: React.PropsWithChildren<DeckSwiperProps<T>>,
ref: React.Ref<DeckSwiperRef>
Expand Down Expand Up @@ -146,7 +148,9 @@ const DeckSwiper = React.forwardRef<DeckSwiperRef, DeckSwiperProps<any>>(
*/

return (
<View>
<View // @ts-ignore
className={className}
>
<View style={styles.containerHeightFiller}>{renderFirstCard()}</View>
<DeckSwiperComponent
ref={deckSwiperRef}
Expand Down
14 changes: 11 additions & 3 deletions packages/core/src/components/DeckSwiper/DeckSwiperCard.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import React from "react";
import { View, StyleSheet, StyleProp, ViewStyle } from "react-native";
import {
View,
ViewProps,
StyleSheet,
StyleProp,
ViewStyle,
} from "react-native";
import type { ReadTheme } from "@draftbit/theme";
import { withTheme } from "@draftbit/theme";

export interface DeckSwiperCardProps {
export interface DeckSwiperCardProps
extends Omit<ViewProps, "style" | "children"> {
style?: StyleProp<ViewStyle>;
theme: ReadTheme;
}

const DeckSwiperCard: React.FC<
React.PropsWithChildren<DeckSwiperCardProps>
> = ({ style, children, theme }) => (
> = ({ style, children, theme, ...rest }) => (
<View
style={[
styles.card,
Expand All @@ -20,6 +27,7 @@ const DeckSwiperCard: React.FC<
},
style,
]}
{...rest}
>
{children}
</View>
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/components/Layout/Spacer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { View, StyleProp, ViewStyle } from "react-native";
import { View, ViewProps, StyleProp, ViewStyle } from "react-native";

interface SpacerProps {
interface SpacerProps extends Omit<ViewProps, "style"> {
top?: number;
right?: number;
left?: number;
Expand All @@ -15,6 +15,7 @@ const Spacer: React.FC<SpacerProps> = ({
bottom = 8,
left = 8,
style,
...rest
}) => {
return (
<View
Expand All @@ -27,6 +28,7 @@ const Spacer: React.FC<SpacerProps> = ({
paddingBottom: bottom,
},
]}
{...rest}
/>
);
};
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/LottieAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const LottieAnimation = forwardRef<LottieView, Props>(
ref
) => {
return (
<View style={style}>
<View style={style} {...rest}>
<LottieView
ref={ref}
source={source}
Expand All @@ -36,7 +36,6 @@ const LottieAnimation = forwardRef<LottieView, Props>(
// A specific size is required on mobile, but not on web.
// This ensures consistent behavior across platforms during preview.
style={{ width: "100%", height: "100%" }}
{...rest}
/>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface HeadlessAudioPlayerProps extends MediaPlayerProps {
}

export interface AudioPlayerInterfaceProps {
className?: string;
style?: StyleProp<ViewStyle & TextStyle>;
thumbColor?: string;
completedTrackColor?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const AudioPlayerWithInterface = React.forwardRef<
(
{
style,
className,
thumbColor,
completedTrackColor,
remainingTrackColor,
Expand Down Expand Up @@ -127,6 +128,8 @@ const AudioPlayerWithInterface = React.forwardRef<
/>
<View
testID="audio-player-interface"
// @ts-ignore
className={className}
style={[
{
backgroundColor: theme.colors.background.base,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
},
ref
) => {
// @ts-ignore
const { className, ...videoPlayerProps } = rest;

const stableSource = useSourceDeepCompareMemoize(
normalizeBase64Source(source, "video")
);
Expand Down Expand Up @@ -168,7 +171,7 @@
playToEndSub.remove();
statusChangeSub.remove();
};
}, []);

Check warning on line 174 in packages/core/src/components/MediaPlayer/VideoPlayer/VideoPlayer.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook React.useEffect has missing dependencies: 'onPlaybackFinish', 'onPlaybackStatusUpdateProp', and 'player'. Either include them or remove the dependency array. If 'onPlaybackStatusUpdateProp' changes too often, find the parent component that defines it and wrap that definition in useCallback

// Replace video source when it changes (deep comparison on URI to avoid unnecessary reloads)
const isFirstSourceRender = React.useRef(true);
Expand Down Expand Up @@ -248,7 +251,11 @@
ref={mediaPlaybackWrapperRef}
onTogglePlayback={updateAudioMode}
>
<View style={[style, styles.container]}>
<View
style={[style, styles.container]}
// @ts-ignore
className={className}
>
<VideoPlayerComponent
ref={videoPlayerRef}
player={player}
Expand All @@ -258,7 +265,7 @@
onFullscreenEnter={() => onFullscreenUpdate("entered")}
onFullscreenExit={() => onFullscreenUpdate("exited")}
allowsFullscreen={allowsFullscreen}
{...rest}
{...videoPlayerProps}
/>
{showPoster && posterSource && (
<View style={StyleSheet.absoluteFill} pointerEvents="none">
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/Picker/PickerCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface PickerOption {
}

export interface PickerInputContainerProps extends IconSlot {
className?: string;
error?: boolean;
placeholder?: string;
disabled?: boolean;
Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/components/Picker/PickerInputContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const PickerInputContainer: React.FC<
options = [],
onPress,
Icon,
className,
style,
selectedValue,
disabled = false,
Expand Down Expand Up @@ -70,7 +71,12 @@ const PickerInputContainer: React.FC<
}

return (
<View testID={testID} style={[containerStyle, { zIndex }]}>
<View
testID={testID}
style={[containerStyle, { zIndex }]}
// @ts-ignore
className={className}
>
<TextField
Icon={Icon}
numberOfLines={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const CircularProgress: React.FC<
trackCustomDashArray,
onFullPathWidth,
startPosition = "top",
className,
style,
testID,
}) => {
Expand Down Expand Up @@ -128,6 +129,8 @@ export const CircularProgress: React.FC<
},
style,
]}
// @ts-ignore
className={className}
>
<Svg testID={testID ?? "circular-progress-component"} style={{ flex: 1 }}>
{showTrack && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const LinearProgress: React.FC<ValueProgressProps> = ({
customDashArray,
trackCustomDashArray,
onFullPathWidth,
className,
style,
testID,
}) => {
Expand Down Expand Up @@ -101,6 +102,8 @@ export const LinearProgress: React.FC<ValueProgressProps> = ({
},
style,
]}
// @ts-ignore
className={className}
>
<Svg testID={testID ?? "linear-progress-component"} style={{ flex: 1 }}>
{showTrack && (
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/Progress/ProgressCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface BaseProgressProps {
customDashArray?: string;
trackCustomDashArray?: string;
onFullPathWidth?: (width: number) => void;
className?: string;
style?: StyleProp<ViewStyle>;
theme: ReadTheme;
testID?: string;
Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/components/SVG.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ import Config from "./Config";
type SVGComponentProps = {
source: string;
style?: StyleProp<ImageStyle>;
className?: string;
};

const SVG: React.FC<React.PropsWithChildren<SVGComponentProps>> = ({
source = Config.placeholderSvgURL,
style,
className,
}) => {
return (
<View style={style as StyleProp<ViewStyle>}>
<View
style={style as StyleProp<ViewStyle>}
// @ts-ignore
className={className}
>
<SvgUri width="100%" height="100%" uri={source} />
</View>
);
Expand Down
11 changes: 10 additions & 1 deletion packages/core/src/components/SVG.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ import Config from "./Config";
type SVGComponentProps = {
source: string;
style?: StyleProp<ImageStyle>;
className?: string;
};

const SVG: React.FC<React.PropsWithChildren<SVGComponentProps>> = ({
source = Config.placeholderSvgURL,
style,
className,
}) => {
return <Image style={style} source={{ uri: source }} />;
return (
<Image
style={style}
source={{ uri: source }}
// @ts-ignore
className={className}
/>
);
};

export default SVG;
11 changes: 8 additions & 3 deletions packages/core/src/components/SectionList/SectionHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import React from "react";
import { View, StyleProp, ViewStyle, Text } from "react-native";
import { View, ViewProps, StyleProp, ViewStyle, Text } from "react-native";
import { withTheme } from "@draftbit/theme";
import type { ReadTheme } from "@draftbit/theme";

interface SectionHeaderProps {
interface SectionHeaderProps extends Omit<ViewProps, "style" | "children"> {
style?: StyleProp<ViewStyle>;
}

const SectionHeader: React.FC<React.PropsWithChildren<SectionHeaderProps>> = ({
style,
children,
}) => <View style={style}>{children}</View>;
...rest
}) => (
<View style={style} {...rest}>
{children}
</View>
);

interface DefaultSectionHeaderProps {
title: string;
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/components/SwipeableItem/SwipeableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
*/

export interface SwipeableItemProps extends IconSlot {
className?: string;
closeOnPress?: boolean;
leftOpenValue?: number;
rightOpenValue?: number;
Expand All @@ -74,6 +75,7 @@ type Props = SwipeableItemProps & RightSwipeProps & LeftSwipeProps;

const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
theme,
className,
style,
children: childrenProp,
Icon,
Expand Down Expand Up @@ -232,6 +234,8 @@ const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
setComponentWidth(event.nativeEvent.layout.width);
}}
style={[styles.parentContainer, parentContainerStyles]}
// @ts-ignore
className={className}
>
{/*@ts-ignore*/}
<SwipeRow
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/components/Swiper/Swiper.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReadTheme, withTheme } from "@draftbit/theme";
import React, { forwardRef, useImperativeHandle } from "react";
import { View, StyleProp, ViewStyle } from "react-native";
import { View, StyleProp, ViewStyle, ViewProps } from "react-native";
import SwiperComponent from "react-native-web-swiper";

export interface SwiperRef {
Expand All @@ -9,7 +9,7 @@ export interface SwiperRef {
swipePrev: () => void;
}

export interface SwiperProps<T> {
export interface SwiperProps<T> extends Omit<ViewProps, "style" | "children"> {
onSwipe?: (index: number) => void;
onSwipedNext?: (index: number) => void;
onSwipedPrevious?: (index: number) => void;
Expand Down Expand Up @@ -63,6 +63,7 @@ const Swiper = forwardRef<SwiperRef, SwiperProps<any>>(
minDistanceToCapture,
style,
hideDots = false,
...rest
}: SwiperProps<any>,
ref
) => {
Expand Down Expand Up @@ -141,7 +142,7 @@ const Swiper = forwardRef<SwiperRef, SwiperProps<any>>(
}));

return (
<View style={style}>
<View style={style} {...rest}>
{/* @ts-ignore */}
<SwiperComponent
ref={swiperRef}
Expand Down
16 changes: 12 additions & 4 deletions packages/core/src/components/Swiper/SwiperItem.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import React from "react";
import { View, StyleSheet, StyleProp, ViewStyle } from "react-native";
import {
View,
StyleSheet,
StyleProp,
ViewStyle,
ViewProps,
} from "react-native";

const styles = StyleSheet.create({
wrapper: {
flex: 1,
},
});

export interface SwiperProps {
export interface SwiperProps extends Omit<ViewProps, "style" | "children"> {
children: React.ReactNode;
style?: StyleProp<ViewStyle>;
}

const SwiperItem = ({ children, style }: SwiperProps) => (
<View style={[styles.wrapper, style]}>{children}</View>
const SwiperItem = ({ children, style, ...rest }: SwiperProps) => (
<View style={[styles.wrapper, style]} {...rest}>
{children}
</View>
);

export default SwiperItem;
Loading
Loading