From 406dc5d5ac2a47696cf277a83b6269a64d588408 Mon Sep 17 00:00:00 2001 From: Paul Kim Date: Fri, 20 Feb 2026 10:30:39 +0100 Subject: [PATCH 1/2] add `notUndefined` attribute to `Style.size` type (#843) --- src/apis/Style.resi | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apis/Style.resi b/src/apis/Style.resi index d99893d9..d6e36f6e 100644 --- a/src/apis/Style.resi +++ b/src/apis/Style.resi @@ -6,6 +6,7 @@ external arrayOption: array> => t = "%identity" external unsafeAddStyle: (@as(json`{}`) _, t, {..}) => t = "Object.assign" external unsafeStyle: {..} => t = "%identity" +@notUndefined type size external dp: float => size = "%identity" From 73f76cd1e158a65d522d052584620584701c6554 Mon Sep 17 00:00:00 2001 From: Freddy Harris Date: Fri, 20 Feb 2026 10:57:29 +0100 Subject: [PATCH 2/2] Fixed #842 all components with record type props --- src/components/Button.res | 47 ++++++++++++++------------- src/components/Image.res | 8 +++-- src/components/ImageBackground.res | 38 +++++----------------- src/components/InputAccessoryView.res | 18 +++++----- src/components/Modal.res | 39 +++++++++++----------- src/components/StatusBar.res | 22 +++++++------ 6 files changed, 81 insertions(+), 91 deletions(-) diff --git a/src/components/Button.res b/src/components/Button.res index b6f2da8c..392b9fc1 100644 --- a/src/components/Button.res +++ b/src/components/Button.res @@ -1,25 +1,26 @@ include NativeElement -@react.component @module("react-native") -external make: ( - ~ref: ref=?, - // Button props - ~accessibilityActions: array=?, - ~accessibilityLabel: string=?, - ~accessibilityLanguage: string=?, - ~accessibilityState: Accessibility.state=?, - ~accessible: bool=?, - ~color: Color.t=?, - ~disabled: bool=?, - ~hasTVPreferredFocus: bool=?, - ~nextFocusDown: int=?, - ~nextFocusForward: int=?, - ~nextFocusLeft: int=?, - ~nextFocusRight: int=?, - ~nextFocusUp: int=?, - ~onAccessibilityAction: Accessibility.actionEvent => unit=?, - ~onPress: Event.pressEvent => unit, - ~testID: string=?, - ~title: string, - ~touchSoundDisabled: bool=?, -) => React.element = "Button" +type props = { + ref?: ref, + accessibilityActions?: array, + accessibilityLabel?: string, + accessibilityLanguage?: string, + accessibilityState?: Accessibility.state, + accessible?: bool, + color?: Color.t, + disabled?: bool, + hasTVPreferredFocus?: bool, + nextFocusDown?: int, + nextFocusForward?: int, + nextFocusLeft?: int, + nextFocusRight?: int, + nextFocusUp?: int, + onAccessibilityAction?: Accessibility.actionEvent => unit, + onPress: Event.pressEvent => unit, + testID?: string, + title?: string, + touchSoundDisabled?: bool, +} + +@module("react-native") +external make: React.component = "Button" diff --git a/src/components/Image.res b/src/components/Image.res index 7dac7777..c652d906 100644 --- a/src/components/Image.res +++ b/src/components/Image.res @@ -87,8 +87,7 @@ type crossOrigin = [ | #"use-credentials" ] -type props = { - ref?: ref, +type imageProps = { accessibilityLabel?: string, accessible?: bool, alt?: string, @@ -119,6 +118,11 @@ type props = { width?: float, } +type props = { + ref?: ref, + ...imageProps, +} + @module("react-native") external make: React.component = "Image" diff --git a/src/components/ImageBackground.res b/src/components/ImageBackground.res index 49727465..6d28a7ce 100644 --- a/src/components/ImageBackground.res +++ b/src/components/ImageBackground.res @@ -1,31 +1,11 @@ include NativeElement -@react.component @module("react-native") -external make: ( - ~ref: ref=?, - // ImageBackground props - ~imageRef: Image.ref=?, - ~imageStyle: Style.t=?, - // Image props - ~accessibilityLabel: string=?, - ~accessible: bool=?, - ~blurRadius: float=?, - ~capInsets: Rect.t=?, - ~defaultSource: Image.Source.t=?, - ~fadeDuration: float=?, - ~loadingIndicatorSource: array=?, - ~onError: Image.errorEvent => unit=?, - ~onLayout: Event.layoutEvent => unit=?, - ~onLoad: unit => unit=?, - ~onLoadEnd: unit => unit=?, - ~onLoadStart: unit => unit=?, - ~onPartialLoad: unit => unit=?, - ~onProgress: Image.progressEvent => unit=?, - ~progressiveRenderingEnabled: bool=?, - ~resizeMethod: Image.resizeMethod=?, - ~resizeMode: Style.resizeMode=?, - ~source: Image.Source.t, - ~style: Style.t=?, - ~testID: string=?, - ~children: React.element=?, -) => React.element = "ImageBackground" +type props = { + ref?: ref, + imageRef?: Image.ref, + imageStyle?: Style.t, + ...Image.imageProps, +} + +@module("react-native") +external make: React.component = "ImageBackground" diff --git a/src/components/InputAccessoryView.res b/src/components/InputAccessoryView.res index 69d69fc2..e3b96ce6 100644 --- a/src/components/InputAccessoryView.res +++ b/src/components/InputAccessoryView.res @@ -1,8 +1,10 @@ -@react.component @module("react-native") -external make: ( - ~backgroundColor: Color.t=?, - ~nativeID: string=?, - ~style: Style.t=?, - ~testID: string=?, - ~children: React.element=?, -) => React.element = "InputAccessoryView" +type props = { + backgroundColor?: Color.t, + nativeID?: string, + style?: Style.t, + testID?: string, + children?: React.element, +} + +@module("react-native") +external make: React.component = "InputAccessoryView" diff --git a/src/components/Modal.res b/src/components/Modal.res index 2f15b91a..37f20bbc 100644 --- a/src/components/Modal.res +++ b/src/components/Modal.res @@ -29,22 +29,23 @@ type presentationStyle = [ | #overFullScreen ] -@react.component @module("react-native") -external make: ( - ~ref: ref=?, - // Modal props - ~animationType: animationType=?, - ~backdropColor: Color.t=?, - ~hardwareAccelerated: bool=?, - ~navigationBarTranslucent: bool=?, - ~onDismiss: unit => unit=?, - ~onOrientationChange: orientationChangeEvent => unit=?, - ~onRequestClose: unit => unit=?, - ~onShow: unit => unit=?, - ~presentationStyle: presentationStyle=?, - ~statusBarTranslucent: bool=?, - ~supportedOrientations: array=?, - ~transparent: bool=?, - ~visible: bool=?, - ~children: React.element=?, -) => React.element = "Modal" +type props = { + ref?: ref, + animationType?: animationType, + backdropColor?: Color.t, + hardwareAccelerated?: bool, + navigationBarTranslucent?: bool, + onDismiss?: unit => unit, + onOrientationChange?: orientationChangeEvent => unit, + onRequestClose?: unit => unit, + onShow?: unit => unit, + presentationStyle?: presentationStyle, + statusBarTranslucent?: bool, + supportedOrientations?: array, + transparent?: bool, + visible?: bool, + children?: React.element, +} + +@module("react-native") +external make: React.component = "Modal" diff --git a/src/components/StatusBar.res b/src/components/StatusBar.res index bb1b8b58..67556669 100644 --- a/src/components/StatusBar.res +++ b/src/components/StatusBar.res @@ -6,16 +6,18 @@ type barStyle = [ type showHideTransition = [#fade | #none | #slide] -@react.component @module("react-native") -external make: ( - ~animated: bool=?, - ~barStyle: barStyle=?, - ~hidden: bool=?, - ~backgroundColor: string=?, - ~translucent: bool=?, - ~networkActivityIndicatorVisible: bool=?, - ~showHideTransition: showHideTransition=?, -) => React.element = "StatusBar" +type props = { + animated?: bool, + barStyle?: barStyle, + hidden?: bool, + backgroundColor?: string, + translucent?: bool, + networkActivityIndicatorVisible?: bool, + showHideTransition?: showHideTransition, +} + +@module("react-native") +external make: React.component = "StatusBar" @module("react-native") @scope("StatusBar") external setHidden: (bool, showHideTransition) => unit = "setHidden"