react-native App with Expo crashes only in iOS

This RN Component:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>import { getRandomColor } from '@shared/lib/helpers'
import { AvatarContainer, InitialText } from './styles'
export const InitialAvatar = ({ name }) => {
const backgroundColor = getRandomColor()
const initial = name.charAt(0).toUpperCase()
// TODO - FIX -this crashes the app when accessing the screen in iOS.
// Somehow it works fine on Android
console.log({ initial })
console.log({ backgroundColor })
return (
<AvatarContainer style={{ backgroundColor }}>
<InitialText>{initial}</InitialText>
</AvatarContainer>
)
}
</code>
<code>import { getRandomColor } from '@shared/lib/helpers' import { AvatarContainer, InitialText } from './styles' export const InitialAvatar = ({ name }) => { const backgroundColor = getRandomColor() const initial = name.charAt(0).toUpperCase() // TODO - FIX -this crashes the app when accessing the screen in iOS. // Somehow it works fine on Android console.log({ initial }) console.log({ backgroundColor }) return ( <AvatarContainer style={{ backgroundColor }}> <InitialText>{initial}</InitialText> </AvatarContainer> ) } </code>
import { getRandomColor } from '@shared/lib/helpers'

import { AvatarContainer, InitialText } from './styles'

export const InitialAvatar = ({ name }) => {
  const backgroundColor = getRandomColor()
  const initial = name.charAt(0).toUpperCase()
  // TODO - FIX -this crashes the app when accessing the screen in iOS.
  // Somehow it works fine on Android
  console.log({ initial })
  console.log({ backgroundColor })
  return (
    <AvatarContainer style={{ backgroundColor }}>
      <InitialText>{initial}</InitialText>
    </AvatarContainer>
  )
}

with these styles:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>import sc from 'styled-components/native'
export const AvatarContainer = sc.View`
width: 50px;
height: 50px;
border-radius: 25px;
justify-content: center;
align-items: center;
`
export const InitialText = sc.Text`
color: white;
font-size: 20px;
font-weight: bold;
`
</code>
<code>import sc from 'styled-components/native' export const AvatarContainer = sc.View` width: 50px; height: 50px; border-radius: 25px; justify-content: center; align-items: center; ` export const InitialText = sc.Text` color: white; font-size: 20px; font-weight: bold; ` </code>
import sc from 'styled-components/native'

export const AvatarContainer = sc.View`
  width: 50px;
  height: 50px;
  border-radius: 25px;
  justify-content: center;
  align-items: center;
`

export const InitialText = sc.Text`
  color: white;
  font-size: 20px;
  font-weight: bold;
`

also using this helper:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>
export const getRandomColor = () => {
const colors = ['#FFCDD2', '#BBDEFB', '#C8E6C9', '#FFE082', '#E1BEE7']
return colors[Math.floor(Math.random() * colors.length)]
}
</code>
<code> export const getRandomColor = () => { const colors = ['#FFCDD2', '#BBDEFB', '#C8E6C9', '#FFE082', '#E1BEE7'] return colors[Math.floor(Math.random() * colors.length)] } </code>

export const getRandomColor = () => {
  const colors = ['#FFCDD2', '#BBDEFB', '#C8E6C9', '#FFE082', '#E1BEE7']
  return colors[Math.floor(Math.random() * colors.length)]
}

and console.loging correct values:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> LOG {"initial": "S"}
LOG {"backgroundColor": "#E1BEE7"}
LOG {"initial": "R"}
LOG {"backgroundColor": "#C8E6C9"}
LOG {"initial": "H"}
LOG {"backgroundColor": "#FFCDD2"}
LOG {"initial": "S"}
LOG {"backgroundColor": "#BBDEFB"}
LOG {"initial": "H"}
LOG {"backgroundColor": "#E1BEE7"}
</code>
<code> LOG {"initial": "S"} LOG {"backgroundColor": "#E1BEE7"} LOG {"initial": "R"} LOG {"backgroundColor": "#C8E6C9"} LOG {"initial": "H"} LOG {"backgroundColor": "#FFCDD2"} LOG {"initial": "S"} LOG {"backgroundColor": "#BBDEFB"} LOG {"initial": "H"} LOG {"backgroundColor": "#E1BEE7"} </code>
 LOG  {"initial": "S"}
 LOG  {"backgroundColor": "#E1BEE7"}
 LOG  {"initial": "R"}
 LOG  {"backgroundColor": "#C8E6C9"}
 LOG  {"initial": "H"}
 LOG  {"backgroundColor": "#FFCDD2"}
 LOG  {"initial": "S"}
 LOG  {"backgroundColor": "#BBDEFB"}
 LOG  {"initial": "H"}
 LOG  {"backgroundColor": "#E1BEE7"}

is somehow making my App fully crash on iOS when I try to access the screen where the InitialAvatar is placed in.

If I comment out {/* <InitialText>{initial}</InitialText> */} it renders all fine again. But I would like to understand why. No errors logged. Try / catch results in a successfull try, but the App crashes anyway.

It all works perfectly fine on Android.

Has anyone an idea what can be the issue here? I appreciate any hint.

I tried to narrow down the error until I found that is the problem. But I do not understand why.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật