Skip to content

Commit

Permalink
Mark string props as nullable in scrollview managers (#48520)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #48520

Both `ReactScrollViewHelper.parseSnapToAlignment` and `ReactScrollViewHelper.parseOverScrollMode` accept a nullable string. This is a precursor to migrating these files to Kotlin (since they're already marked as nullsafe). The prop itself is a nullable string so this should be reflected in the native types as well

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D67911553

fbshipit-source-id: aabe55c2dc65a933b170d76b89f62f25493ab0ee
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Jan 7, 2025
1 parent 8b0af45 commit ec72af4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void setSnapToInterval(ReactHorizontalScrollView view, float snapToInterv
}

@ReactProp(name = "snapToAlignment")
public void setSnapToAlignment(ReactHorizontalScrollView view, String alignment) {
public void setSnapToAlignment(ReactHorizontalScrollView view, @Nullable String alignment) {
view.setSnapToAlignment(ReactScrollViewHelper.parseSnapToAlignment(alignment));
}

Expand Down Expand Up @@ -166,7 +166,7 @@ public void setSendMomentumEvents(ReactHorizontalScrollView view, boolean sendMo
* @param scrollPerfTag
*/
@ReactProp(name = "scrollPerfTag")
public void setScrollPerfTag(ReactHorizontalScrollView view, String scrollPerfTag) {
public void setScrollPerfTag(ReactHorizontalScrollView view, @Nullable String scrollPerfTag) {
view.setScrollPerfTag(scrollPerfTag);
}

Expand All @@ -177,7 +177,7 @@ public void setPagingEnabled(ReactHorizontalScrollView view, boolean pagingEnabl

/** Controls overScroll behaviour */
@ReactProp(name = "overScrollMode")
public void setOverScrollMode(ReactHorizontalScrollView view, String value) {
public void setOverScrollMode(ReactHorizontalScrollView view, @Nullable String value) {
view.setOverScrollMode(ReactScrollViewHelper.parseOverScrollMode(value));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void setSnapToOffsets(ReactScrollView view, @Nullable ReadableArray snapT
}

@ReactProp(name = "snapToAlignment")
public void setSnapToAlignment(ReactScrollView view, String alignment) {
public void setSnapToAlignment(ReactScrollView view, @Nullable String alignment) {
view.setSnapToAlignment(ReactScrollViewHelper.parseSnapToAlignment(alignment));
}

Expand Down Expand Up @@ -186,7 +186,7 @@ public void setBottomFillColor(ReactScrollView view, int color) {

/** Controls overScroll behaviour */
@ReactProp(name = "overScrollMode")
public void setOverScrollMode(ReactScrollView view, String value) {
public void setOverScrollMode(ReactScrollView view, @Nullable String value) {
view.setOverScrollMode(ReactScrollViewHelper.parseOverScrollMode(value));
}

Expand Down

0 comments on commit ec72af4

Please sign in to comment.