Skip to content

Commit

Permalink
🐞 Fix: RNIComputableSize
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Apr 28, 2023
1 parent 7a59350 commit 0872abb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ public class RNIComputableSizeEvaluator {
let computedSize: CGSize? = {
switch self.computableSize.mode {
case .current:
guard let targetSize = targetSize else { return nil };
return targetSize;
return currentSize;

case .stretch:
guard let currentSize = targetSize else { return nil };
return currentSize;
return targetSize;

case let .constant(constantWidth, constantHeight):
return CGSize(
Expand Down
6 changes: 3 additions & 3 deletions src/types/RNIComputable/RNIComputableSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export type RNIComputableSizeNative =
& RNIComputableSizeShared;

export function parseRNIComputableSize(
value: RNIComputableSize
): RNIComputableSizeNative {
value?: RNIComputableSize
): RNIComputableSizeNative | undefined {

if (value.mode === 'function'){
if (value?.mode === 'function'){
return {
...value,
valueFunction: value.valueFunction?.toString(),
Expand Down
2 changes: 1 addition & 1 deletion src/types/RNIModalTypes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable prettier/prettier */

import type { RNIComputableOffset } from "./RNIComputable";
import type { RNIComputableOffset } from './RNIComputable';

/** Maps to `RNIModalCustomSheetDetent` */
export type RNIModalCustomSheetDetent = Partial<RNIComputableOffset> & {
Expand Down

0 comments on commit 0872abb

Please sign in to comment.