Skip to content

Commit

Permalink
refactor: fix background color type
Browse files Browse the repository at this point in the history
  • Loading branch information
lodev09 committed Feb 1, 2025
1 parent e64de2e commit 0385ab3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ class TrueSheetViewManager : ViewGroupManager<TrueSheetView>() {
for (i in 0 until minOf(sizes.size(), 3)) {
when (sizes.getType(i)) {
ReadableType.Number -> result.add(sizes.getDouble(i))

// React Native < 0.77 used String for getString, but 0.77
// changed it to String?. Suppress the error for older APIs.
@Suppress("UNNECESSARY_SAFE_CALL")
ReadableType.String -> sizes.getString(i)?.let { result.add(it) }
ReadableType.String
-> sizes.getString(i)?.let { result.add(it) }

else -> Log.d(TAG, "Invalid type")
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/TrueSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
type ViewStyle,
type NativeSyntheticEvent,
type LayoutChangeEvent,
type ColorValue,
type ProcessedColorValue,
processColor,
} from 'react-native'

Expand All @@ -31,7 +31,7 @@ interface TrueSheetNativeViewProps
extends Omit<TrueSheetProps, 'onPresent' | 'onSizeChange' | 'backgroundColor'> {
contentHeight?: number
footerHeight?: number
background?: ColorValue
background?: ProcessedColorValue | null
scrollableHandle: number | null
onPresent: (event: SizeChangeEvent) => void
onSizeChange: (event: SizeChangeEvent) => void
Expand Down Expand Up @@ -251,7 +251,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
scrollableHandle={this.state.scrollableHandle}
sizes={sizes}
blurTint={blurTint}
background={(backgroundColor ? processColor(backgroundColor) : undefined) as any}
background={processColor(backgroundColor)}
cornerRadius={cornerRadius}
contentHeight={this.state.contentHeight}
footerHeight={this.state.footerHeight}
Expand Down

0 comments on commit 0385ab3

Please sign in to comment.