diff --git a/src/components/InvertedFlatList/BaseInvertedFlatList.js b/src/components/InvertedFlatList/BaseInvertedFlatList.js index e753ff4e9bd9..09f856f2aaf1 100644 --- a/src/components/InvertedFlatList/BaseInvertedFlatList.js +++ b/src/components/InvertedFlatList/BaseInvertedFlatList.js @@ -16,6 +16,12 @@ const propTypes = { // renderItem rows. Web will have issues with FlatList // if this is inaccurate. initialRowHeight: PropTypes.number.isRequired, + + // Passed via forwardRef so we can access the FlatList ref + innerRef: PropTypes.oneOfType([ + PropTypes.func, + PropTypes.shape({current: PropTypes.instanceOf(FlatList)}) + ]).isRequired, }; const defaultProps = { diff --git a/src/components/InvertedFlatList/index.js b/src/components/InvertedFlatList/index.js index 3ed2ca2f1534..c15ea3c6f6ea 100644 --- a/src/components/InvertedFlatList/index.js +++ b/src/components/InvertedFlatList/index.js @@ -4,8 +4,14 @@ import React, { useCallback, forwardRef } from 'react'; +import PropTypes from 'prop-types'; import BaseInvertedFlatList from './BaseInvertedFlatList'; +const propTypes = { + // Passed via forwardRef so we can access the FlatList ref + innerRef: PropTypes.func.isRequired, +}; + // This is copied from https://codesandbox.io/s/react-native-dsyse // It's a HACK alert since FlatList has inverted scrolling on web const InvertedFlatList = (props) => { @@ -17,7 +23,7 @@ const InvertedFlatList = (props) => { }, []); useEffect(() => { - props.forwardedRef(ref.current); + props.innerRef(ref.current); }, []); useEffect(() => { @@ -52,7 +58,9 @@ const InvertedFlatList = (props) => { ); }; +InvertedFlatList.propTypes = propTypes; + export default forwardRef((props, ref) => ( // eslint-disable-next-line react/jsx-props-no-spreading - + )); diff --git a/src/page/home/report/ReportActionsView.js b/src/page/home/report/ReportActionsView.js index 18b2ffead18d..f844e13816e1 100644 --- a/src/page/home/report/ReportActionsView.js +++ b/src/page/home/report/ReportActionsView.js @@ -24,10 +24,17 @@ const propTypes = { // Array of report actions for this report reportActions: PropTypes.objectOf(PropTypes.shape(ReportActionPropTypes)), + + // The session of the logged in person + session: PropTypes.shape({ + // Email of the logged in person + email: PropTypes.string, + }), }; const defaultProps = { reportActions: {}, + session: {}, }; class ReportActionsView extends React.Component {