Clean up using real devices
This commit is contained in:
@@ -19,6 +19,7 @@ import PasteInput, {
|
|||||||
PasteInputRef,
|
PasteInputRef,
|
||||||
} from '@mattermost/react-native-paste-input'
|
} from '@mattermost/react-native-paste-input'
|
||||||
|
|
||||||
|
import {isAndroid} from '#/platform/detection'
|
||||||
import {POST_IMG_MAX} from 'lib/constants'
|
import {POST_IMG_MAX} from 'lib/constants'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {downloadAndResize} from 'lib/media/manip'
|
import {downloadAndResize} from 'lib/media/manip'
|
||||||
@@ -183,11 +184,30 @@ export const TextInput = forwardRef(function TextInputImpl(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const inputTextStyle = React.useMemo(() => {
|
const inputTextStyle = React.useMemo(() => {
|
||||||
return normalizeTextStyles([a.text_lg, a.leading_snug, t.atoms.text], {
|
const style = normalizeTextStyles(
|
||||||
fontScale: fonts.scaleMultiplier,
|
[a.text_xl, a.leading_snug, t.atoms.text],
|
||||||
fontFamily: fonts.family,
|
{
|
||||||
flags: {},
|
fontScale: fonts.scaleMultiplier,
|
||||||
})
|
fontFamily: fonts.family,
|
||||||
|
flags: {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* `PasteInput` appears to prefer no `lineHeight`
|
||||||
|
*/
|
||||||
|
style.lineHeight = undefined
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Android impl of `PasteInput` doesn't support the array syntax for `fontVariant`
|
||||||
|
*/
|
||||||
|
if (isAndroid) {
|
||||||
|
// @ts-ignore
|
||||||
|
style.fontVariant = style.fontVariant
|
||||||
|
? style.fontVariant.join(' ')
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
return style
|
||||||
}, [t, fonts])
|
}, [t, fonts])
|
||||||
|
|
||||||
const textDecorated = useMemo(() => {
|
const textDecorated = useMemo(() => {
|
||||||
|
|||||||
@@ -259,16 +259,21 @@ export const TextInput = React.forwardRef(function TextInputImpl(
|
|||||||
flags: {},
|
flags: {},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// TipTap component isn't a RN View, need to convert some props - esb
|
/*
|
||||||
|
* TipTap component isn't a RN View and while it seems to convert
|
||||||
|
* `fontSize` to `px`, it doesn't convert `lineHeight`.
|
||||||
|
*
|
||||||
|
* `lineHeight` should always be defined here, this is defensive.
|
||||||
|
*/
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
style.lineHeight = style.lineHeight += 'px'
|
style.lineHeight = style.lineHeight ? (style.lineHeight += 'px') : undefined
|
||||||
return style
|
return style
|
||||||
}, [t, fonts])
|
}, [t, fonts])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
{/* @ts-ignore inputStyle is fine - esb */}
|
{/* @ts-ignore inputStyle is fine */}
|
||||||
<EditorContent editor={editor} style={inputStyle} />
|
<EditorContent editor={editor} style={inputStyle} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user