Prevent rendering notes on profiles when they aren't present

This commit is contained in:
Nat 2022-03-29 20:50:24 -07:00
parent e67064d0c3
commit 55901c33e5
1 changed files with 16 additions and 3 deletions

View File

@ -250,6 +250,21 @@ const ProfileJsx = ({ navigation }) => {
const RawProfileJsx = (props) => { const RawProfileJsx = (props) => {
let profileButton; let profileButton;
/* Some profiles won't have a note, and react-native-render-html will
* issue a warning if it isn't passed any content. So, if there's no
* note with the account (or if it's an empty string, possibly), the
* element shouldn't be rendered at all.
*/
let noteIfPresent = <></>;
if (props.profile.note != null && props.profile.note.length != "") {
noteIfPresent = (
<HTML
source = { { html: props.profile.note } }
contentWidth = { SCREEN_WIDTH } />
);
}
if (props.own) { if (props.own) {
profileButton = ( profileButton = (
<TouchableOpacity <TouchableOpacity
@ -349,9 +364,7 @@ const RawProfileJsx = (props) => {
</Text> </Text>
</Text> </Text>
<HTML { noteIfPresent }
source = { { html: props.profile.note } }
contentWidth = { SCREEN_WIDTH } />
<View style = { styles.fields.container }> <View style = { styles.fields.container }>
{ props.profile.fields { props.profile.fields
? props.profile.fields.map((field, index) => ( ? props.profile.fields.map((field, index) => (