Skip to content

Commit

Permalink
feat: use forwardRef with DrawerContentScrollView (#9695)
Browse files Browse the repository at this point in the history
Closes #9350
  • Loading branch information
Kazuaki Horita committed Aug 7, 2021
1 parent 40dcbcf commit ebb5f24
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/drawer/src/views/DrawerContentScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ type Props = ScrollViewProps & {
children: React.ReactNode;
};

export default function DrawerContentScrollView({
contentContainerStyle,
style,
children,
...rest
}: Props) {
function DrawerContentScrollView(
{ contentContainerStyle, style, children, ...rest }: Props,
ref?: React.Ref<ScrollView>
) {
const drawerPosition = React.useContext(DrawerPositionContext);
const insets = useSafeAreaInsets();

Expand All @@ -29,6 +27,7 @@ export default function DrawerContentScrollView({
return (
<ScrollView
{...rest}
ref={ref}
contentContainerStyle={[
{
paddingTop: insets.top + 4,
Expand All @@ -44,6 +43,8 @@ export default function DrawerContentScrollView({
);
}

export default React.forwardRef(DrawerContentScrollView);

const styles = StyleSheet.create({
container: {
flex: 1,
Expand Down

0 comments on commit ebb5f24

Please sign in to comment.