Skip to content

Canvas: trying to draw too large(157883040bytes) bitmap. #234

Description

@kdwkr

RuntimeException android.graphics.RecordingCanvas in throwIfCannotDraw

image
type HeaderBottomMaskedProps = {
  children?: ReactNode;
  disabled?: boolean;
};

const toBlack = ['rgba(0,0,0,0)', 'rgb(0,0,0)'];
const fromBlack = ['rgb(0,0,0)', 'rgba(0,0,0,0)'];
const blackStyle = {
  flex: 1,
  backgroundColor: '#000000',
  marginTop: -0.1,
  marginBottom: -0.1,
} as const;
const height20 = { height: 20 };
const maskedViewStyle = {
  flex: 1,
  display: 'flex',
  flexDirection: 'column',
} as const;

const HeaderBottomMasked: FC<HeaderBottomMaskedProps> = ({
  children,
  disabled = false,
}) => {
  const { height } = useWindowDimensions();
  return (
    <MaskedView
      maskElement={
        disabled ? (
          <View style={blackStyle} />
        ) : (
          <View
            style={{
              maxHeight: height,
              flex: 1,
              display: 'flex',
              flexDirection: 'column',
            }}
          >
            <LinearGradient colors={toBlack} style={height20} />
            <View style={blackStyle} />
            <LinearGradient colors={fromBlack} style={height20} />
          </View>
        )
      }
      style={maskedViewStyle}
    >
      {children}
    </MaskedView>
  );
};

export default memo(HeaderBottomMasked);

Anyone can help me?

children have FlatList

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions