Revert "Small revert to be on the safe side (#7932)" (#7958)

This reverts commit 0014b8b9cd.
This commit is contained in:
Samuel Newman
2025-03-24 21:11:13 +02:00
committed by GitHub
parent 6a5770ee89
commit dba6f4bb1f
4 changed files with 41 additions and 28 deletions
+14 -22
View File
@@ -657,6 +657,7 @@ export const ComposePost = ({
ref={scrollViewRef} ref={scrollViewRef}
layout={native(LinearTransition)} layout={native(LinearTransition)}
onScroll={scrollHandler} onScroll={scrollHandler}
contentContainerStyle={a.flex_grow}
style={a.flex_1} style={a.flex_1}
keyboardShouldPersistTaps="always" keyboardShouldPersistTaps="always"
onContentSizeChange={onScrollViewContentSizeChange} onContentSizeChange={onScrollViewContentSizeChange}
@@ -795,19 +796,22 @@ let ComposerPost = React.memo(function ComposerPost({
) )
return ( return (
<View style={[styles.post, !isActive && styles.inactivePost]}> <View
<View style={[
style={[ a.mx_lg,
styles.textInputLayout, !isActive && styles.inactivePost,
isNative && styles.textInputLayoutMobile, isTextOnly && isNative && a.flex_grow,
]}> ]}>
<View style={[a.flex_row, isNative && a.flex_1]}>
<UserAvatar <UserAvatar
avatar={currentProfile?.avatar} avatar={currentProfile?.avatar}
size={50} size={50}
type={currentProfile?.associated?.labeler ? 'labeler' : 'user'} type={currentProfile?.associated?.labeler ? 'labeler' : 'user'}
style={[a.mt_xs]}
/> />
<TextInput <TextInput
ref={textInput} ref={textInput}
style={[a.pt_xs]}
richtext={richtext} richtext={richtext}
placeholder={selectTextInputPlaceholder} placeholder={selectTextInputPlaceholder}
autoFocus autoFocus
@@ -1077,9 +1081,8 @@ function ComposerEmbeds({
</Animated.View> </Animated.View>
)} )}
</LayoutAnimationConfig> </LayoutAnimationConfig>
{embed.quote?.uri ? (
<View style={!video ? [a.mt_md] : []}> <View style={!video ? [a.mt_md] : []}>
{embed.quote?.uri ? (
<View style={[s.mt5, s.mb2, isWeb && s.mb10]}> <View style={[s.mt5, s.mb2, isWeb && s.mb10]}>
<View style={{pointerEvents: 'none'}}> <View style={{pointerEvents: 'none'}}>
<LazyQuoteEmbed uri={embed.quote.uri} /> <LazyQuoteEmbed uri={embed.quote.uri} />
@@ -1088,8 +1091,8 @@ function ComposerEmbeds({
<QuoteX onRemove={() => dispatch({type: 'embed_remove_quote'})} /> <QuoteX onRemove={() => dispatch({type: 'embed_remove_quote'})} />
)} )}
</View> </View>
) : null} </View>
</View> ) : null}
</> </>
) )
} }
@@ -1469,7 +1472,6 @@ const styles = StyleSheet.create({
marginLeft: 12, marginLeft: 12,
}, },
stickyFooterWeb: { stickyFooterWeb: {
// @ts-ignore web-only
position: 'sticky', position: 'sticky',
bottom: 0, bottom: 0,
}, },
@@ -1503,19 +1505,9 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
marginRight: 5, marginRight: 5,
}, },
post: {
marginHorizontal: 16,
},
inactivePost: { inactivePost: {
opacity: 0.5, opacity: 0.5,
}, },
textInputLayout: {
flexDirection: 'row',
paddingTop: 4,
},
textInputLayoutMobile: {
flex: 1,
},
addExtLinkBtn: { addExtLinkBtn: {
borderWidth: 1, borderWidth: 1,
borderRadius: 24, borderRadius: 24,
@@ -249,9 +249,11 @@ export const TextInput = forwardRef(function TextInputImpl(
multiline multiline
scrollEnabled={false} scrollEnabled={false}
numberOfLines={2} numberOfLines={2}
{...props}
style={[ style={[
inputTextStyle, inputTextStyle,
a.w_full, a.w_full,
!autocompletePrefix && a.h_full,
{ {
textAlignVertical: 'top', textAlignVertical: 'top',
minHeight: 60, minHeight: 60,
@@ -261,8 +263,8 @@ export const TextInput = forwardRef(function TextInputImpl(
borderWidth: 1, borderWidth: 1,
borderColor: 'transparent', borderColor: 'transparent',
}, },
]} props.style,
{...props}> ]}>
{textDecorated} {textDecorated}
</PasteInput> </PasteInput>
<Autocomplete <Autocomplete
@@ -49,7 +49,7 @@ export function Autocomplete({
a.px_sm, a.px_sm,
a.py_md, a.py_md,
]} ]}
key={item.handle}> key={item.did}>
<PressableScale <PressableScale
testID="autocompleteButton" testID="autocompleteButton"
style={[ style={[
+22 -3
View File
@@ -1,5 +1,12 @@
import React, {memo, useMemo} from 'react' import React, {memo, useMemo} from 'react'
import {Image, Pressable, StyleSheet, View} from 'react-native' import {
Image,
Pressable,
StyleProp,
StyleSheet,
View,
ViewStyle,
} from 'react-native'
import {Image as RNImage} from 'react-native-image-crop-picker' import {Image as RNImage} from 'react-native-image-crop-picker'
import Svg, {Circle, Path, Rect} from 'react-native-svg' import Svg, {Circle, Path, Rect} from 'react-native-svg'
import {ModerationUI} from '@atproto/api' import {ModerationUI} from '@atproto/api'
@@ -48,6 +55,7 @@ interface UserAvatarProps extends BaseUserAvatarProps {
moderation?: ModerationUI moderation?: ModerationUI
usePlainRNImage?: boolean usePlainRNImage?: boolean
onLoad?: () => void onLoad?: () => void
style?: StyleProp<ViewStyle>
} }
interface EditableUserAvatarProps extends BaseUserAvatarProps { interface EditableUserAvatarProps extends BaseUserAvatarProps {
@@ -181,6 +189,7 @@ let UserAvatar = ({
moderation, moderation,
usePlainRNImage = false, usePlainRNImage = false,
onLoad, onLoad,
style,
}: UserAvatarProps): React.ReactNode => { }: UserAvatarProps): React.ReactNode => {
const pal = usePalette('default') const pal = usePalette('default')
const backgroundColor = pal.colors.backgroundLight const backgroundColor = pal.colors.backgroundLight
@@ -218,9 +227,19 @@ let UserAvatar = ({
) )
}, [moderation?.alert, size, pal]) }, [moderation?.alert, size, pal])
const containerStyle = useMemo(() => {
return [
{
width: size,
height: size,
},
style,
]
}, [size, style])
return avatar && return avatar &&
!((moderation?.blur && isAndroid) /* android crashes with blur */) ? ( !((moderation?.blur && isAndroid) /* android crashes with blur */) ? (
<View style={{width: size, height: size}}> <View style={containerStyle}>
{usePlainRNImage ? ( {usePlainRNImage ? (
<Image <Image
accessibilityIgnoresInvertColors accessibilityIgnoresInvertColors
@@ -249,7 +268,7 @@ let UserAvatar = ({
{alert} {alert}
</View> </View>
) : ( ) : (
<View style={{width: size, height: size}}> <View style={containerStyle}>
<DefaultAvatar type={type} shape={finalShape} size={size} /> <DefaultAvatar type={type} shape={finalShape} size={size} />
{alert} {alert}
</View> </View>