При попытке визуализации текста в MapView. Я сталкиваюсь с этой ошибкой.
Всякий раз, когда я создаю Text
в RealTimePosition.js
, я получаю сообщение об ошибке index = 8, count = 2
. Я не понимаю, почему эта ошибка происходит и как ее исправить. Пожалуйста, помогите мне решить.
работает нормально в устройстве IOS
Component where the error is occurring
class RealTimePosition extends Component{
....
return(
<View>
<View>
<Text>
//after removing this View and Text code is working fine but adding the View gives me error.
</Text>
</View>
{
showBus?
<MapView.Marker
coordinate = {realTimeData}
anchor = {{x:0.5, y:0.5}}
flat = {true}
>
<Image
source={require("../../assets/images/schoolBus.png")}
style = {{ width:42, height:42, transform: [{ rotate :
`${rotation}deg`}]}}
/>
</MapView.Marker>:
null
}
</View>
)
}
calling RealTimePosition from this MapAnimateToRegion.js
class MapAnimateToRegion extends Component{
...
return(
<View>
<MapView>
{
CrossButtonvisible?
<RealTimePosition
routeId = {routeId}
polyLinedata = {this.state.pickData}
HomeCoordinate = {this.HomeCoordinate}
onRef={ref => (this.parentReference = ref)}
parentReference = {this.parentMethod.bind(this)}
/>:
null
}
</MapView>
</View>
)
}
parent Component
class Parent extends Component{
....
render(){
if(this.state.currentScreen == "showMap")
{
const {stopsData} = this.state;
const {stopId} = this.state;
const {stopSequence} = this.state;
const {routeId} = this.state;
const {pickData} =this.state
return(
<View style={styles.container}>
<MapAnimateToRegion
stopsData = {stopsData}
stopId = {stopId}
routeId = {routeId}
stopSequence = {stopSequence}
Data = {pickData}
onRef={ref => (this.TimeparentReference = ref)}
TimeparentReference = {this.onTimeChange.bind(this)}
/>
</View>
)
}