Skip to content
Merged
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
6 changes: 4 additions & 2 deletions src/apis/AccessibilityInfo.res
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ type accessibilityEventTypes = [
]

@scope("AccessibilityInfo") @module("react-native")
external sendAccessibilityEvent: (NativeElement.ref, accessibilityEventTypes) => unit =
"sendAccessibilityEvent"
external sendAccessibilityEvent: (
Ref.t<DOMAPI.element<'nativeElement>>,
accessibilityEventTypes,
) => unit = "sendAccessibilityEvent"

@scope("AccessibilityInfo") @module("react-native")
external prefersCrossFadeTransitions: unit => promise<bool> = "prefersCrossFadeTransitions"
3 changes: 2 additions & 1 deletion src/components/ActivityIndicator.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/ActivityIndicator.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

@unboxed
type size = | @as("small") Small | @as("large") Large | Number(float)
Expand Down
3 changes: 2 additions & 1 deletion src/components/Button.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/Button.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type props = {
ref?: ref,
Expand Down
2 changes: 2 additions & 0 deletions src/components/Image.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
var Event$ReactNative = require("../apis/Event.bs.js");
var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

var Source = {};

Event$ReactNative.SyntheticEvent({});
Expand Down
6 changes: 5 additions & 1 deletion src/components/Image.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type cache = [
| #default
Expand Down
3 changes: 2 additions & 1 deletion src/components/ImageBackground.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/ImageBackground.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type props = {
ref?: ref,
Expand Down
3 changes: 2 additions & 1 deletion src/components/KeyboardAvoidingView.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/KeyboardAvoidingView.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type behavior = [#height | #position | #padding]

Expand Down
2 changes: 2 additions & 0 deletions src/components/Modal.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
var Event$ReactNative = require("../apis/Event.bs.js");
var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

Event$ReactNative.SyntheticEvent({});

var OrientationChangeEvent = {};
Expand Down
6 changes: 5 additions & 1 deletion src/components/Modal.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type orientation = [
| #landscape
Expand Down
3 changes: 2 additions & 1 deletion src/components/Pressable.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/Pressable.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type rippleConfig = {
borderless?: bool,
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProgressBarAndroid.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/ProgressBarAndroid.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type styleAttr = [
| #Horizontal
Expand Down
3 changes: 2 additions & 1 deletion src/components/RefreshControl.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/RefreshControl.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type props = {
ref?: ref,
Expand Down
3 changes: 2 additions & 1 deletion src/components/SafeAreaView.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/SafeAreaView.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type props = {
ref?: ref,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Switch.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/Switch.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type trackColor = {
\"true"?: Color.t,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Text.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/Text.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type android_hyphenationFrequency = [
| #normal
Expand Down
3 changes: 2 additions & 1 deletion src/components/TouchableHighlight.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/TouchableHighlight.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type props = {
ref?: ref,
Expand Down
4 changes: 3 additions & 1 deletion src/components/TouchableNativeFeedback.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

var Background = {};

exports.Background = Background;
/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/TouchableNativeFeedback.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

module Background = {
type t
Expand Down
3 changes: 2 additions & 1 deletion src/components/TouchableWithoutFeedback.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/TouchableWithoutFeedback.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

type coreProps = {
accessible?: bool,
Expand Down
3 changes: 2 additions & 1 deletion src/components/View.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

var NativeElement$ReactNative = require("../elements/NativeElement.bs.js");

NativeElement$ReactNative.Impl({});

/* NativeElement-ReactNative Not a pure module */
/* Not a pure module */
6 changes: 5 additions & 1 deletion src/components/View.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include NativeElement
type nativeElement

include NativeElement.Impl({
type t = nativeElement
})

// @todo in 0.71.0
// after adding `aria-*` props, make sure `aria-checked` can be true, false or "mixed"
Expand Down
6 changes: 3 additions & 3 deletions src/elements/DrawerLayoutAndroidElement.bs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var NativeMethods$ReactNative = require("./NativeMethods.bs.js");
var NativeElement$ReactNative = require("./NativeElement.bs.js");
var DrawerLayoutAndroidMethods$ReactNative = require("./DrawerLayoutAndroidMethods.bs.js");

DrawerLayoutAndroidMethods$ReactNative.Make({});
NativeElement$ReactNative.Impl({});

NativeMethods$ReactNative.Make({});
DrawerLayoutAndroidMethods$ReactNative.Make({});

/* Not a pure module */
9 changes: 4 additions & 5 deletions src/elements/DrawerLayoutAndroidElement.res
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
type element
type ref = Ref.t<element>
type nativeElement

include DrawerLayoutAndroidMethods.Make({
type t = element
include NativeElement.Impl({
type t = nativeElement
})

include NativeMethods.Make({
include DrawerLayoutAndroidMethods.Make({
type t = element
})
8 changes: 8 additions & 0 deletions src/elements/NativeElement.bs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
'use strict';

var DOMAPI$ReactNative = require("../types/DOMAPI.bs.js");
var NativeMethods$ReactNative = require("./NativeMethods.bs.js");

function Impl(T) {
NativeMethods$ReactNative.Make({});
DOMAPI$ReactNative.$$Element.Impl({});
return {};
}

NativeMethods$ReactNative.Make({});

exports.Impl = Impl;
/* Not a pure module */
23 changes: 23 additions & 0 deletions src/elements/NativeElement.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
module Impl = (
T: {
type t
},
) => {
type element = DOMAPI.element<T.t>
type ref = Ref.t<element>

external unsafeFromAnyElement: DOMAPI.anyElement => element = "%identity"
Comment thread
cknitt marked this conversation as resolved.

include NativeMethods.Make({
type t = element
})

include DOMAPI.Element.Impl({
type t = element
Comment on lines +15 to +16
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate DOM node APIs to React Native 0.82+

NativeElement.Impl now mixes in DOMAPI.Element.Impl for every native ref, which makes DOM node fields/methods available in all consuming apps even though this package still declares support for React Native >=0.81. The DOM node API was introduced in 0.82, so 0.81 consumers can compile calls like nodeType/childNodes from these bindings and then hit undefined at runtime. Please either raise the minimum supported RN version in this change set or expose these bindings behind a 0.82-specific surface.

Useful? React with 👍 / 👎.

})
}

@deprecated("Use NativeElement.Impl instead of accessing element type directly.")
type element

@warning("-3")
type ref = Ref.t<element>

@warning("-3")
include NativeMethods.Make({
type t = element
})
3 changes: 3 additions & 0 deletions src/elements/ScrollViewElement.bs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use strict';

var NativeElement$ReactNative = require("./NativeElement.bs.js");
var ScrollViewMethods$ReactNative = require("./ScrollViewMethods.bs.js");

NativeElement$ReactNative.Impl({});

ScrollViewMethods$ReactNative.Make({});

/* Not a pure module */
Loading
Loading