mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Fix more forwardRef displayNames
Reviewed By: TheSavior Differential Revision: D8342904 fbshipit-source-id: b6e53da7305d71635528a42e80910f4a9db0455c
This commit is contained in:
committed by
Facebook Github Bot
parent
ddf2c2ffd6
commit
d1336ab16e
@@ -70,12 +70,10 @@ type Props = $ReadOnly<{|
|
||||
* See http://facebook.github.io/react-native/docs/activityindicator.html
|
||||
*/
|
||||
const ActivityIndicator = (
|
||||
props: $ReadOnly<{|
|
||||
...Props,
|
||||
forwardedRef?: ?React.Ref<'RCTActivityIndicatorView'>,
|
||||
|}>,
|
||||
props: Props,
|
||||
forwardedRef: ?React.Ref<'RCTActivityIndicatorView'>,
|
||||
) => {
|
||||
const {onLayout, style, forwardedRef, ...restProps} = props;
|
||||
const {onLayout, style, ...restProps} = props;
|
||||
let sizeStyle;
|
||||
|
||||
switch (props.size) {
|
||||
@@ -99,16 +97,19 @@ const ActivityIndicator = (
|
||||
};
|
||||
|
||||
return (
|
||||
<View onLayout={onLayout} style={[styles.container, style]}>
|
||||
<View
|
||||
onLayout={onLayout}
|
||||
style={StyleSheet.compose(
|
||||
styles.container,
|
||||
style,
|
||||
)}>
|
||||
<RCTActivityIndicator {...nativeProps} />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
ActivityIndicator.displayName = 'ActivityIndicator'; // TODO(T30332650) remove workaround for hermes bug
|
||||
// $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet.
|
||||
const ActivityIndicatorWithRef = React.forwardRef((props: Props, ref) => {
|
||||
return <ActivityIndicator {...props} forwardedRef={ref} />;
|
||||
});
|
||||
const ActivityIndicatorWithRef = React.forwardRef(ActivityIndicator);
|
||||
|
||||
ActivityIndicatorWithRef.defaultProps = {
|
||||
animating: true,
|
||||
@@ -116,7 +117,6 @@ ActivityIndicatorWithRef.defaultProps = {
|
||||
hidesWhenStopped: true,
|
||||
size: 'small',
|
||||
};
|
||||
ActivityIndicatorWithRef.displayName = 'ActivityIndicator';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
|
||||
Reference in New Issue
Block a user