Skip to content

Commit f3fac66

Browse files
committed
Add ScrollView/FlatList contentInsetAdjustmentBehavior
1 parent 5f4f54c commit f3fac66

6 files changed

Lines changed: 94 additions & 6 deletions

File tree

‎lib/js/src/components/flatList.js‎

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/js/src/components/scrollView.js‎

Lines changed: 28 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/components/flatList.re‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ module type FlatListComponent = {
116116
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
117117
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
118118
~style: Style.t=?,
119+
~contentInsetAdjustmentBehavior: [
120+
| `automatic
121+
| `scrollableAxes
122+
| `never
123+
| `always
124+
]
125+
=?,
119126
array(ReasonReact.reactElement)
120127
) =>
121128
ReasonReact.component(
@@ -293,6 +300,7 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
293300
~onMomentumScrollBegin=?,
294301
~onMomentumScrollEnd=?,
295302
~style=?,
303+
~contentInsetAdjustmentBehavior=?,
296304
) =>
297305
ReasonReact.wrapJsForReason(
298306
~reactClass=Impl.view,
@@ -347,6 +355,7 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
347355
"onMomentumScrollBegin": onMomentumScrollBegin,
348356
"onMomentumScrollEnd": onMomentumScrollEnd,
349357
"style": style,
358+
"contentInsetAdjustmentBehavior": contentInsetAdjustmentBehavior,
350359
},
351360
);
352361
};

‎src/components/flatList.rei‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ module type FlatListComponent = {
238238
{[
239239
style: Style.t=?
240240
]}
241+
{4 contentInsetAdjustmentBehavior}
242+
{[
243+
~contentInsetAdjustmentBehavior: [
244+
| `automatic
245+
| `scrollableAxes
246+
| `never
247+
| `always
248+
]=?,
249+
]}
250+
241251
*/
242252
/**
243253
{3 methods }
@@ -376,6 +386,13 @@ module type FlatListComponent = {
376386
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
377387
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
378388
~style: Style.t=?,
389+
~contentInsetAdjustmentBehavior: [
390+
| `automatic
391+
| `scrollableAxes
392+
| `never
393+
| `always
394+
]
395+
=?,
379396
array(ReasonReact.reactElement)
380397
) =>
381398
ReasonReact.component(

‎src/components/scrollView.re‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ module type ScrollViewComponent = {
1010
(
1111
~accessibilityLabel: ReasonReact.reactElement=?,
1212
~accessible: bool=?,
13+
~contentInsetAdjustmentBehavior: [
14+
| `automatic
15+
| `scrollableAxes
16+
| `never
17+
| `always
18+
]
19+
=?,
1320
~hitSlop: Types.insets=?,
1421
~onAccessibilityTap: unit => unit=?,
1522
~onLayout: RNEvent.NativeLayoutEvent.t => unit=?,
@@ -103,6 +110,7 @@ module CreateComponent = (Impl: View.Impl) : ScrollViewComponent => {
103110
(
104111
~accessibilityLabel=?,
105112
~accessible=?,
113+
~contentInsetAdjustmentBehavior=?,
106114
~hitSlop=?,
107115
~onAccessibilityTap=?,
108116
~onLayout=?,
@@ -165,6 +173,15 @@ module CreateComponent = (Impl: View.Impl) : ScrollViewComponent => {
165173
Props.extendView(
166174
{
167175
"contentContainerStyle": contentContainerStyle,
176+
"contentInsetAdjustmentBehavior":
177+
contentInsetAdjustmentBehavior
178+
->Belt.Option.map(
179+
fun
180+
| `automatic => "automatic"
181+
| `scrollableAxes => "scrollableAxes"
182+
| `never => "never"
183+
| `always => "always",
184+
),
168185
"horizontal": horizontal,
169186
"keyboardDismissMode":
170187
keyboardDismissMode

‎src/components/scrollView.rei‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ module type ScrollViewComponent = {
1313
~contentContainerStyle: Style.t=?
1414
]}
1515
16+
{4 contentInsetAdjustmentBehavior}
17+
{[
18+
~contentInsetAdjustmentBehavior: [
19+
| `automatic
20+
| `scrollableAxes
21+
| `never
22+
| `always
23+
]=?,
24+
]}
25+
1626
{4 horizontal}
1727
{[
1828
~horizontal: bool=?,
@@ -227,6 +237,13 @@ module type ScrollViewComponent = {
227237
(
228238
~accessibilityLabel: ReasonReact.reactElement=?,
229239
~accessible: bool=?,
240+
~contentInsetAdjustmentBehavior: [
241+
| `automatic
242+
| `scrollableAxes
243+
| `never
244+
| `always
245+
]
246+
=?,
230247
~hitSlop: Types.insets=?,
231248
~onAccessibilityTap: unit => unit=?,
232249
~onLayout: RNEvent.NativeLayoutEvent.t => unit=?,

0 commit comments

Comments
 (0)