Bluesky app fork with some witchin' additions 💫

Remove Button error boundary (#3372)

authored by danabra.mov and committed by

GitHub 75d65354 75c9da93

+9 -41
+9 -41
src/components/Button.tsx
··· 14 import LinearGradient from 'react-native-linear-gradient' 15 import {Trans} from '@lingui/macro' 16 17 - import {logger} from '#/logger' 18 import {android, atoms as a, flatten, tokens, useTheme} from '#/alf' 19 import {Props as SVGIconProps} from '#/components/icons/common' 20 import {normalizeTextStyles} from '#/components/Typography' ··· 405 </View> 406 )} 407 <Context.Provider value={context}> 408 - <ButtonTextErrorBoundary> 409 - {/* @ts-ignore */} 410 - {typeof children === 'string' || children?.type === Trans ? ( 411 - /* @ts-ignore */ 412 - <ButtonText>{children}</ButtonText> 413 - ) : typeof children === 'function' ? ( 414 - children(context) 415 - ) : ( 416 - children 417 - )} 418 - </ButtonTextErrorBoundary> 419 </Context.Provider> 420 </Pressable> 421 ) 422 - } 423 - 424 - export class ButtonTextErrorBoundary extends React.Component< 425 - React.PropsWithChildren<{}>, 426 - {hasError: boolean; error: Error | undefined} 427 - > { 428 - public state = { 429 - hasError: false, 430 - error: undefined, 431 - } 432 - 433 - public static getDerivedStateFromError(error: Error) { 434 - return {hasError: true, error} 435 - } 436 - 437 - public componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { 438 - logger.error('ButtonTextErrorBoundary caught an error', { 439 - message: error.message, 440 - errorInfo, 441 - }) 442 - } 443 - 444 - public render() { 445 - if (this.state.hasError) { 446 - return <ButtonText>ERROR</ButtonText> 447 - } 448 - 449 - return this.props.children 450 - } 451 } 452 453 export function useSharedButtonTextStyles() {
··· 14 import LinearGradient from 'react-native-linear-gradient' 15 import {Trans} from '@lingui/macro' 16 17 import {android, atoms as a, flatten, tokens, useTheme} from '#/alf' 18 import {Props as SVGIconProps} from '#/components/icons/common' 19 import {normalizeTextStyles} from '#/components/Typography' ··· 404 </View> 405 )} 406 <Context.Provider value={context}> 407 + {/* @ts-ignore */} 408 + {typeof children === 'string' || children?.type === Trans ? ( 409 + /* @ts-ignore */ 410 + <ButtonText>{children}</ButtonText> 411 + ) : typeof children === 'function' ? ( 412 + children(context) 413 + ) : ( 414 + children 415 + )} 416 </Context.Provider> 417 </Pressable> 418 ) 419 } 420 421 export function useSharedButtonTextStyles() {