Skip to content

Commit

Permalink
Merge pull request #48474 from margelo/fix/48197-offline-crash
Browse files Browse the repository at this point in the history
fix: concurrent unmount when app is offline
  • Loading branch information
chiragsalian authored Sep 11, 2024
2 parents 7766b7b + e42ab85 commit 1e8d80e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/OfflineWithFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function OfflineWithFeedback({
)}
{!hideChildren && (
<View
style={[needsOpacity ? styles.offlineFeedback.pending : {}, contentContainerStyle]}
style={[needsOpacity ? styles.offlineFeedback.pending : styles.offlineFeedback.default, contentContainerStyle]}
needsOffscreenAlphaCompositing={shouldRenderOffscreen ? needsOpacity && needsOffscreenAlphaCompositing : undefined}
>
<CustomStylesForChildrenProvider style={needsStrikeThrough ? [styles.offlineFeedback.deleted, styles.userSelectNone] : null}>{children}</CustomStylesForChildrenProvider>
Expand Down
10 changes: 8 additions & 2 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {LineLayerStyleProps} from '@rnmapbox/maps/src/utils/MapboxStyles';
import lodashClamp from 'lodash/clamp';
import type {LineLayer} from 'react-map-gl';
import type {AnimatableNumericValue, Animated, ImageStyle, TextStyle, ViewStyle} from 'react-native';
import {StyleSheet} from 'react-native';
import {Platform, StyleSheet} from 'react-native';
import type {CustomAnimation} from 'react-native-animatable';
import type {PickerStyle} from 'react-native-picker-select';
import type {MixedStyleDeclaration, MixedStyleRecord} from 'react-native-render-html';
Expand Down Expand Up @@ -71,7 +71,7 @@ type WorkspaceUpgradeIntroBoxParams = {isExtraSmallScreenWidth: boolean; isSmall

type Translation = 'perspective' | 'rotate' | 'rotateX' | 'rotateY' | 'rotateZ' | 'scale' | 'scaleX' | 'scaleY' | 'translateX' | 'translateY' | 'skewX' | 'skewY' | 'matrix';

type OfflineFeedbackStyle = Record<'deleted' | 'pending' | 'error' | 'container' | 'textContainer' | 'text' | 'errorDot', ViewStyle | TextStyle>;
type OfflineFeedbackStyle = Record<'deleted' | 'pending' | 'default' | 'error' | 'container' | 'textContainer' | 'text' | 'errorDot', ViewStyle | TextStyle>;

type MapDirectionStyle = Pick<LineLayerStyleProps, 'lineColor' | 'lineWidth'>;

Expand Down Expand Up @@ -3450,6 +3450,12 @@ const styles = (theme: ThemeColors) =>
pending: {
opacity: 0.5,
},
default: {
// fixes a crash on iOS when we attempt to remove already unmounted children
// see https://github.com/Expensify/App/issues/48197 for more details
// it's a temporary solution while we are working on a permanent fix
opacity: Platform.OS === 'ios' ? 0.99 : undefined,
},
error: {
flexDirection: 'row',
alignItems: 'center',
Expand Down

0 comments on commit 1e8d80e

Please sign in to comment.