Skip to content

Commit 0385ab3

Browse files
committed
refactor: fix background color type
1 parent e64de2e commit 0385ab3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ class TrueSheetViewManager : ViewGroupManager<TrueSheetView>() {
108108
for (i in 0 until minOf(sizes.size(), 3)) {
109109
when (sizes.getType(i)) {
110110
ReadableType.Number -> result.add(sizes.getDouble(i))
111+
111112
// React Native < 0.77 used String for getString, but 0.77
112113
// changed it to String?. Suppress the error for older APIs.
113114
@Suppress("UNNECESSARY_SAFE_CALL")
114-
ReadableType.String -> sizes.getString(i)?.let { result.add(it) }
115+
ReadableType.String
116+
-> sizes.getString(i)?.let { result.add(it) }
117+
115118
else -> Log.d(TAG, "Invalid type")
116119
}
117120
}

src/TrueSheet.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
type ViewStyle,
99
type NativeSyntheticEvent,
1010
type LayoutChangeEvent,
11-
type ColorValue,
11+
type ProcessedColorValue,
1212
processColor,
1313
} from 'react-native'
1414

@@ -31,7 +31,7 @@ interface TrueSheetNativeViewProps
3131
extends Omit<TrueSheetProps, 'onPresent' | 'onSizeChange' | 'backgroundColor'> {
3232
contentHeight?: number
3333
footerHeight?: number
34-
background?: ColorValue
34+
background?: ProcessedColorValue | null
3535
scrollableHandle: number | null
3636
onPresent: (event: SizeChangeEvent) => void
3737
onSizeChange: (event: SizeChangeEvent) => void
@@ -251,7 +251,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
251251
scrollableHandle={this.state.scrollableHandle}
252252
sizes={sizes}
253253
blurTint={blurTint}
254-
background={(backgroundColor ? processColor(backgroundColor) : undefined) as any}
254+
background={processColor(backgroundColor)}
255255
cornerRadius={cornerRadius}
256256
contentHeight={this.state.contentHeight}
257257
footerHeight={this.state.footerHeight}

0 commit comments

Comments
 (0)