-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22227 from robertKozik/8k
#10148 — The message got sent but it also stayed in the compose box
- Loading branch information
Showing
6 changed files
with
97 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import {useAnimatedRef} from 'react-native-reanimated'; | ||
import PropTypes from 'prop-types'; | ||
import getComponentDisplayName from '../libs/getComponentDisplayName'; | ||
|
||
export default function withAnimatedRef(WrappedComponent) { | ||
function WithAnimatedRef(props) { | ||
const animatedRef = useAnimatedRef(); | ||
return ( | ||
<WrappedComponent | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
ref={props.forwardedRef} | ||
animatedRef={animatedRef} | ||
/> | ||
); | ||
} | ||
WithAnimatedRef.displayName = `withAnimatedRef(${getComponentDisplayName(WrappedComponent)})`; | ||
WithAnimatedRef.propTypes = { | ||
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]), | ||
}; | ||
WithAnimatedRef.defaultProps = { | ||
forwardedRef: undefined, | ||
}; | ||
|
||
return React.forwardRef((props, ref) => ( | ||
<WithAnimatedRef | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
forwardedRef={ref} | ||
/> | ||
)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function () { | ||
'worklet'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function (viewTag, viewName, updates) { | ||
'worklet'; | ||
|
||
// _updatePropsPaper is a function that is worklet function from react-native-reanimated which is not available on web | ||
// eslint-disable-next-line no-undef | ||
_updatePropsPaper(viewTag, viewName, updates); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters