Skip to content

Commit 5343b0a

Browse files
cknittMoOx
authored andcommitted
Add ref types. (#365)
Closes #363
1 parent 5999c90 commit 5343b0a

6 files changed

Lines changed: 51 additions & 22 deletions

File tree

‎bs-react-native-next/src/components/FlatList.re‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
14
type separatorComponentProps('item) = {
25
.
36
"highlighted": bool,
@@ -7,6 +10,8 @@ type separatorComponentProps('item) = {
710
[@react.component] [@bs.module "react-native"]
811
external make:
912
(
13+
~ref: ref=?,
14+
// FlatList props
1015
~_ItemSeparatorComponent: React.component(separatorComponentProps('item))
1116
=?,
1217
~columnWrapperStyle: Style.t=?,
@@ -177,9 +182,9 @@ type scrollToEndOptions;
177182
[@bs.obj]
178183
external scrollToEndOptions: (~animated: bool=?, unit) => scrollToEndOptions =
179184
"";
180-
[@bs.send] external scrollToEnd: ReactDOMRe.Ref.t => unit = "scrollToEnd";
185+
[@bs.send] external scrollToEnd: ref => unit = "scrollToEnd";
181186
[@bs.send]
182-
external scrollToEndWithOptions: (ReactDOMRe.Ref.t, scrollToEndOptions) => unit =
187+
external scrollToEndWithOptions: (ref, scrollToEndOptions) => unit =
183188
"scrollToEnd";
184189

185190
type scrollToIndexParams;
@@ -214,6 +219,6 @@ external scrollToOffsetParams:
214219
[@bs.send]
215220
external scrollToOffset: scrollToOffsetParams => unit = "scrollToOffset";
216221

217-
[@bs.send] external recordInteraction: ReactDOMRe.Ref.t => unit = "";
222+
[@bs.send] external recordInteraction: ref => unit = "";
218223

219-
[@bs.send] external flashScrollIndicators: ReactDOMRe.Ref.t => unit = "";
224+
[@bs.send] external flashScrollIndicators: ref => unit = "";

‎bs-react-native-next/src/components/ScrollView.re‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
14
[@react.component] [@bs.module "react-native"]
25
external make:
36
(
7+
~ref: ref=?,
8+
// ScrollView props
49
~alwaysBounceHorizontal: bool=?,
510
~alwaysBounceVertical: bool=?,
611
~automaticallyAdjustContentInsets: bool=?,
@@ -137,9 +142,9 @@ type scrollToEndOptions;
137142
external scrollToEndOptions:
138143
(~animated: bool=?, ~duration: float=?, unit) => scrollToEndOptions =
139144
"";
140-
[@bs.send] external scrollToEnd: ReactDOMRe.Ref.t => unit = "scrollToEnd";
145+
[@bs.send] external scrollToEnd: ref => unit = "scrollToEnd";
141146
[@bs.send]
142-
external scrollToEndWithOptions: (ReactDOMRe.Ref.t, scrollToEndOptions) => unit =
147+
external scrollToEndWithOptions: (ref, scrollToEndOptions) => unit =
143148
"scrollToEnd";
144149

145-
[@bs.send] external flashScrollIndicators: ReactDOMRe.Ref.t => unit = "";
150+
[@bs.send] external flashScrollIndicators: ref => unit = "";

‎bs-react-native-next/src/components/SectionList.re‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
14
[@react.component] [@bs.module "react-native"]
2-
// VirtualizedSectionList props
35
external make:
46
(
7+
~ref: ref=?,
8+
// SectionList props
59
~sections: array(VirtualizedSectionList.section('item)),
610
~renderItem: VirtualizedSectionList.renderItemCallback('item),
711
~renderSectionHeader: VirtualizedSectionList.renderSectionHeaderCallback(
@@ -180,9 +184,9 @@ type scrollToEndOptions;
180184
[@bs.obj]
181185
external scrollToEndOptions: (~animated: bool=?, unit) => scrollToEndOptions =
182186
"";
183-
[@bs.send] external scrollToEnd: ReactDOMRe.Ref.t => unit = "scrollToEnd";
187+
[@bs.send] external scrollToEnd: ref => unit = "scrollToEnd";
184188
[@bs.send]
185-
external scrollToEndWithOptions: (ReactDOMRe.Ref.t, scrollToEndOptions) => unit =
189+
external scrollToEndWithOptions: (ref, scrollToEndOptions) => unit =
186190
"scrollToEnd";
187191

188192
type scrollToIndexParams;
@@ -217,6 +221,6 @@ external scrollToOffsetParams:
217221
[@bs.send]
218222
external scrollToOffset: scrollToOffsetParams => unit = "scrollToOffset";
219223

220-
[@bs.send] external recordInteraction: ReactDOMRe.Ref.t => unit = "";
224+
[@bs.send] external recordInteraction: ref => unit = "";
221225

222-
[@bs.send] external flashScrollIndicators: ReactDOMRe.Ref.t => unit = "";
226+
[@bs.send] external flashScrollIndicators: ref => unit = "";

‎bs-react-native-next/src/components/TouchableOpacity.re‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
14
[@react.component] [@bs.module "react-native"]
25
external make:
36
(
7+
~ref: ref=?,
8+
// TouchableOpacity props
49
~accessible: bool=?,
510
~accessibilityLabel: string=?,
611
~accessibilityComponentType: [@bs.string] [
@@ -48,5 +53,5 @@ external make:
4853
"TouchableOpacity";
4954

5055
[@bs.send]
51-
external setOpacityTo: (ReactDOMRe.Ref.t, float, float) => unit =
52-
"setOpacityTo";
56+
external setOpacityTo: (ref, ~value: float, ~duration: float) => unit =
57+
"setOpacityTo";

‎bs-react-native-next/src/components/VirtualizedList.re‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
14
type renderItemProps('item) = {
25
.
36
"item": 'item,
@@ -74,6 +77,8 @@ type viewabilityConfigCallbackPairs('item) =
7477
[@react.component] [@bs.module "react-native"]
7578
external make:
7679
(
80+
~ref: ref=?,
81+
// VirtualizedList props
7782
~_CellRendererComponent: cellRendererComponent('item)=?,
7883
~_ListEmptyComponent: React.element=?,
7984
~_ListFooterComponent: React.element=?,
@@ -230,9 +235,9 @@ type scrollToEndOptions;
230235
[@bs.obj]
231236
external scrollToEndOptions: (~animated: bool=?, unit) => scrollToEndOptions =
232237
"";
233-
[@bs.send] external scrollToEnd: ReactDOMRe.Ref.t => unit = "scrollToEnd";
238+
[@bs.send] external scrollToEnd: ref => unit = "scrollToEnd";
234239
[@bs.send]
235-
external scrollToEndWithOptions: (ReactDOMRe.Ref.t, scrollToEndOptions) => unit =
240+
external scrollToEndWithOptions: (ref, scrollToEndOptions) => unit =
236241
"scrollToEnd";
237242

238243
type scrollToIndexParams;
@@ -267,6 +272,6 @@ external scrollToOffsetParams:
267272
[@bs.send]
268273
external scrollToOffset: scrollToOffsetParams => unit = "scrollToOffset";
269274

270-
[@bs.send] external recordInteraction: ReactDOMRe.Ref.t => unit = "";
275+
[@bs.send] external recordInteraction: ref => unit = "";
271276

272-
[@bs.send] external flashScrollIndicators: ReactDOMRe.Ref.t => unit = "";
277+
[@bs.send] external flashScrollIndicators: ref => unit = "";

‎bs-react-native-next/src/components/VirtualizedSectionList.re‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
14
type renderItemProps('item) = {
25
.
36
"item": 'item,
@@ -21,6 +24,8 @@ and renderSectionHeaderCallback('item) =
2124
[@react.component] [@bs.module "react-native"]
2225
external make:
2326
(
27+
~ref: ref=?,
28+
// VirtualizedSectionList props
2429
~sections: array(section('item)),
2530
~renderItem: renderItemCallback('item),
2631
~renderSectionHeader: renderSectionHeaderCallback('item)=?,
@@ -193,9 +198,9 @@ type scrollToEndOptions;
193198
[@bs.obj]
194199
external scrollToEndOptions: (~animated: bool=?, unit) => scrollToEndOptions =
195200
"";
196-
[@bs.send] external scrollToEnd: ReactDOMRe.Ref.t => unit = "scrollToEnd";
201+
[@bs.send] external scrollToEnd: ref => unit = "scrollToEnd";
197202
[@bs.send]
198-
external scrollToEndWithOptions: (ReactDOMRe.Ref.t, scrollToEndOptions) => unit =
203+
external scrollToEndWithOptions: (ref, scrollToEndOptions) => unit =
199204
"scrollToEnd";
200205

201206
type scrollToIndexParams;
@@ -230,6 +235,6 @@ external scrollToOffsetParams:
230235
[@bs.send]
231236
external scrollToOffset: scrollToOffsetParams => unit = "scrollToOffset";
232237

233-
[@bs.send] external recordInteraction: ReactDOMRe.Ref.t => unit = "";
238+
[@bs.send] external recordInteraction: ref => unit = "";
234239

235-
[@bs.send] external flashScrollIndicators: ReactDOMRe.Ref.t => unit = "";
240+
[@bs.send] external flashScrollIndicators: ref => unit = "";

0 commit comments

Comments
 (0)