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
30 changes: 29 additions & 1 deletion src/apis/AccessibilityInfo.res
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ external addEventListener: @string
| #reduceMotionChanged(bool => unit)
| #screenReaderChanged(bool => unit)
| #reduceTransparencyChanged(bool => unit)
| #highTextContrastChanged(bool => unit)
| #darkerSystemColorsChanged(bool => unit)
| #accessibilityServiceChanged(bool => unit)
| #announcementFinished(announcementResult => unit)
] => EventSubscription.t = "addEventListener"

@scope("AccessibilityInfo") @module("react-native")
external announceForAccessibility: string => unit = "announceForAccessibility"

type announceForAccessibilityOptions = {queue?: bool}

@scope("AccessibilityInfo") @module("react-native")
external announceForAccessibilityWithOptions: (string, announceForAccessibilityOptions) => unit =
"announceForAccessibilityWithOptions"

@scope("AccessibilityInfo") @module("react-native")
external getRecommendedTimeoutMillis: float => promise<float> = "getRecommendedTimeoutMillis"

Expand All @@ -37,10 +46,29 @@ external isReduceTransparencyEnabled: unit => promise<bool> = "isReduceTranspare
external isScreenReaderEnabled: unit => promise<bool> = "isScreenReaderEnabled"

@scope("AccessibilityInfo") @module("react-native")
external isAccessibilityServiceEnabled: unit => promise<bool> = "isAccessibilityServiceEnabled"
external isHighTextContrastEnabled: unit => promise<bool> = "isHighTextContrastEnabled"

@scope("AccessibilityInfo") @module("react-native")
external isDarkerSystemColorsEnabled: unit => promise<bool> = "isDarkerSystemColorsEnabled"

@scope("AccessibilityInfo") @module("react-native")
external isAccessibilityServiceEnabled: unit => promise<bool> = "isAccessibilityServiceEnabled"

@deprecated("Prefer using sendAccessibilityEvent with eventType focus instead.")
@scope("AccessibilityInfo")
@module("react-native")
external setAccessibilityFocus: NativeTypes.nodeHandle => unit = "setAccessibilityFocus"

type accessibilityEventTypes = [
| #click
| #focus
| #viewHoverEnter
| #windowStateChange
]

@scope("AccessibilityInfo") @module("react-native")
external sendAccessibilityEvent: (NativeElement.ref, accessibilityEventTypes) => unit =
"sendAccessibilityEvent"

@scope("AccessibilityInfo") @module("react-native")
external prefersCrossFadeTransitions: unit => promise<bool> = "prefersCrossFadeTransitions"
5 changes: 4 additions & 1 deletion src/apis/ActionSheetIOS.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ type options = {
options: array<string>,
cancelButtonIndex?: int,
destructiveButtonIndex?: array<int>,
disabledButtonIndices?: int,
disabledButtonIndices?: array<int>,
title?: string,
message?: string,
anchor?: int,
tintColor?: Color.t,
cancelButtonTintColor?: Color.t,
userInterfaceStyle?: Appearance.t,
disabledButtonTintColor?: Color.t,
}

@module("react-native") @scope("ActionSheetIOS")
Expand Down
1 change: 1 addition & 0 deletions src/apis/Alert.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
type options = {
cancelable?: bool,
userInterfaceStyle?: Appearance.t,
onDismiss?: unit => unit,
}

Expand Down
4 changes: 2 additions & 2 deletions src/apis/AppRegistry.res
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ external getSections: unit => dict<runnable<'a>> = "getSections"

// multiple externals
@module("react-native") @scope("AppRegistry")
external registerComponent: (appKey, componentProvider<'a>) => unit = "registerComponent"
external registerComponent: (appKey, componentProvider<'a>) => string = "registerComponent"

// multiple externals
@module("react-native") @scope("AppRegistry")
Expand All @@ -74,7 +74,7 @@ external setWrapperComponentProvider: wrapperComponentProvider<'a, 'b> => unit =
"setWrapperComponentProvider"

@module("react-native") @scope("AppRegistry")
external unmountApplicationComponentAtRootTag: string => unit =
external unmountApplicationComponentAtRootTag: float => unit =
"unmountApplicationComponentAtRootTag"

// Android only
Expand Down
3 changes: 3 additions & 0 deletions src/apis/AppState.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ type t = [#active | #background | #inactive | #unknown | #extension]
@scope("AppState") @module("react-native")
external currentState: t = "currentState"

@scope("AppState") @module("react-native")
external isAvailable: bool = "isAvailable"

@scope("AppState") @module("react-native")
external addEventListener: @string
[
Expand Down
7 changes: 2 additions & 5 deletions src/apis/BackHandler.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ type remove = {@meth "remove": unit => unit}
@scope("BackHandler") @module("react-native")
external exitApp: unit => unit = "exitApp"

type eventType = [#backPress | #hardwareBackPress]
type eventType = [#hardwareBackPress]

@scope("BackHandler") @module("react-native")
external addEventListener: (eventType, unit => bool) => remove = "addEventListener"

@scope("BackHandler") @module("react-native")
external removeEventListener: (eventType, unit => bool) => unit = "removeEventListener"
external addEventListener: (eventType, unit => Js.Nullable.t<bool>) => remove = "addEventListener"
12 changes: 9 additions & 3 deletions src/apis/Keyboard.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type screenRect = {
type keyboardMetrics = {
screenX: float,
screenY: float,
width: float,
Expand All @@ -17,8 +17,8 @@ type eventType = [
type keyboardEvent = {
duration: float,
easing: LayoutAnimation.animationType,
endCoordinates: screenRect,
startCoordinates: screenRect,
endCoordinates: keyboardMetrics,
startCoordinates: keyboardMetrics,
isEventFromThisApp: bool,
}

Expand All @@ -35,3 +35,9 @@ external dismiss: unit => unit = "dismiss"

@module("react-native") @scope("Keyboard")
external isVisible: unit => bool = "isVisible"

@module("react-native") @scope("Keyboard")
external scheduleLayoutAnimation: keyboardEvent => unit = "scheduleLayoutAnimation"

@module("react-native") @scope("Keyboard") @return(nullable)
external metrics: unit => option<keyboardMetrics> = "metrics"
6 changes: 3 additions & 3 deletions src/apis/Linking.res
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ external canOpenURL: string => promise<bool> = "canOpenURL"
external getInitialURL: unit => promise<Js.Null.t<string>> = "getInitialURL"

@scope("Linking") @module("react-native")
external openSettings: unit => promise<'a> = "openSettings"
external openSettings: unit => promise<unit> = "openSettings"

// multiple externals
@scope("Linking") @module("react-native")
external sendIntent: string => unit = "sendIntent"
external sendIntent: string => promise<unit> = "sendIntent"

// multiple externals
@scope("Linking") @module("react-native")
external sendIntentWithExtras: (string, array<extra>) => unit = "sendIntent"
external sendIntentWithExtras: (string, array<extra>) => promise<unit> = "sendIntent"

type url = {url: string}

Expand Down
11 changes: 10 additions & 1 deletion src/apis/LogBox.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@
external ignoreLogs: array<string> => unit = "ignoreLogs"

@module("react-native") @scope("LogBox")
external ignoreAllLogs: unit => unit = "ignoreAllLogs"
external ignoreLogsRegex: array<Js.Re.t> => unit = "ignoreLogs"

@module("react-native") @scope("LogBox")
external ignoreAllLogs: (~ignore: bool=?) => unit = "ignoreAllLogs"

@module("react-native") @scope("LogBox")
external install: unit => unit = "install"

@module("react-native") @scope("LogBox")
external uninstall: unit => unit = "uninstall"
5 changes: 3 additions & 2 deletions src/apis/NativeEventEmitter.res
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ type t
external make: 'nativeModule => t = "NativeEventEmitter"

@send
external addListener: (t, string, 'a => unit) => EventSubscription.t = "addListener"
external addListener: (t, string, 'a => unit, ~context: 'context=?) => EventSubscription.t =
"addListener"

@send
external removeAllListeners: (t, string) => unit = "removeAllListeners"

@send external listenerCount: (t, string) => unit = "listenerCount"
@send external listenerCount: (t, string) => int = "listenerCount"
3 changes: 3 additions & 0 deletions src/apis/PermissionsAndroid.res
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ module Permission = {
@module("react-native") @scope(("PermissionsAndroid", "PERMISSIONS"))
external readMediaVideo: t = "READ_MEDIA_VIDEO"

@module("react-native") @scope(("PermissionsAndroid", "PERMISSIONS"))
external readMediaVisualUserSelected: t = "READ_MEDIA_VISUAL_USER_SELECTED"

@module("react-native") @scope(("PermissionsAndroid", "PERMISSIONS"))
external readPhoneNumbers: t = "READ_PHONE_NUMBERS"

Expand Down
3 changes: 3 additions & 0 deletions src/apis/PermissionsAndroid.resi
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ module Permission: {
@module("react-native") @scope(("PermissionsAndroid", "PERMISSIONS"))
external readMediaVideo: t = "READ_MEDIA_VIDEO"

@module("react-native") @scope(("PermissionsAndroid", "PERMISSIONS"))
external readMediaVisualUserSelected: t = "READ_MEDIA_VISUAL_USER_SELECTED"

@module("react-native") @scope(("PermissionsAndroid", "PERMISSIONS"))
external readPhoneNumbers: t = "READ_PHONE_NUMBERS"

Expand Down
12 changes: 12 additions & 0 deletions src/apis/Platform.res
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ Platform.os === #ios
@module("react-native")
@scope("Platform")
external os: os = "OS"

@module("react-native") @scope("Platform")
external isPad: bool = "isPad"

@module("react-native") @scope("Platform")
external isTV: bool = "isTV"

@module("react-native") @scope("Platform")
external isVision: bool = "isVision"

@module("react-native") @scope("Platform")
external isTesting: bool = "isTesting"
2 changes: 1 addition & 1 deletion src/apis/Share.res
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ external share: content => promise<shareResult> = "share"

// multiple externals
@module("react-native") @scope("Share")
external shareWithOptions: (content, options) => promise<bool> = "share"
external shareWithOptions: (content, options) => promise<shareResult> = "share"
1 change: 0 additions & 1 deletion src/apis/SoundManager.bs.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/apis/SoundManager.res

This file was deleted.

1 change: 0 additions & 1 deletion src/apis/YellowBox.bs.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/apis/YellowBox.res

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Button.res
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type props = {
onAccessibilityAction?: Accessibility.actionEvent => unit,
onPress: Event.pressEvent => unit,
testID?: string,
title?: string,
title: string,
touchSoundDisabled?: bool,
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/DrawerLayoutAndroid.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type drawerSlideEvent = DrawerSlideEvent.t

type t

type androidInteractionState = [#idle | #dragging | #settling]
type androidInteractionState = [#Idle | #Dragging | #Settling]

type drawerLockMode = [
| #unlocked
Expand All @@ -27,7 +27,7 @@ type keyboardDismissMode = [#none | #"on-drag"]
type props = {
ref?: ref,
...View.viewProps,
renderNavigationView?: unit => React.element,
renderNavigationView: unit => React.element,
onDrawerClose?: unit => unit,
drawerLockMode?: drawerLockMode,
drawerPosition?: drawerPosition,
Expand Down
28 changes: 24 additions & 4 deletions src/components/Image.res
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module ProgressEvent = {

type progressEvent = ProgressEvent.t

type resizeMethod = [#auto | #resize | #scale]
type resizeMethod = [#auto | #resize | #scale | #none]

type referrerPolicy = [
| #"no-referrer"
Expand Down Expand Up @@ -97,7 +97,7 @@ type imageProps = {
defaultSource?: Source.t,
fadeDuration?: float,
height?: float,
loadingIndicatorSource?: array<Source.t>,
loadingIndicatorSource?: Source.t,
onError?: errorEvent => unit,
onLayout?: Event.layoutEvent => unit,
onLoad?: imageLoadEvent => unit,
Expand Down Expand Up @@ -128,17 +128,37 @@ external make: React.component<props> = "Image"

type sizeError

type imageSize = {
height: float,
width: float,
}

@module("react-native") @scope("Image")
external getSize: (
external getSize_legacy: (
~uri: string,
~success: (~width: float, ~height: float) => unit,
~failure: sizeError => unit=?,
) => unit = "getSize"

@module("react-native") @scope("Image")
external getSize: (~uri: string) => promise<imageSize> = "getSize"

@module("react-native") @scope("Image")
external getSizeWithHeaders: (~uri: string, ~header: dict<string>) => promise<imageSize> =
"getSizeWithHeaders"

type requestId

@module("react-native") @scope("Image")
external prefetch: (~uri: string) => requestId = "prefetch"
external prefetch: (~uri: string, ~callback: requestId => unit=?) => promise<bool> = "prefetch"

@module("react-native") @scope("Image")
external prefetchWithMetadata: (
~uri: string,
~queryRootName: string,
~rootTag: float=?,
~callback: requestId => unit=?,
) => promise<bool> = "prefetchWithMetadata"

@module("react-native") @scope("Image")
external abortPrefetch: requestId => unit = "abortPrefetch"
Expand Down
3 changes: 2 additions & 1 deletion src/components/Modal.res
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,21 @@ type presentationStyle = [

type props = {
ref?: ref,
...View.viewProps,
animationType?: animationType,
backdropColor?: Color.t,
hardwareAccelerated?: bool,
navigationBarTranslucent?: bool,
onDismiss?: unit => unit,
onOrientationChange?: orientationChangeEvent => unit,
allowSwipeDismissal?: bool,
onRequestClose?: unit => unit,
onShow?: unit => unit,
presentationStyle?: presentationStyle,
statusBarTranslucent?: bool,
supportedOrientations?: array<orientation>,
transparent?: bool,
visible?: bool,
children?: React.element,
}

@module("react-native")
Expand Down
1 change: 1 addition & 0 deletions src/components/Switch.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type props = {
disabled?: bool,
trackColor?: trackColor,
ios_backgroundColor?: Color.t,
onChange?: Event.switchChangeEvent => unit,
onValueChange?: bool => unit,
thumbColor?: Color.t,
value?: bool,
Expand Down
Loading
Loading