Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native react native maps标记抛出和IndexOutofBoundsException:索引1无效,大小为0_React Native_React Native Android_React Native Maps - Fatal编程技术网

React native react native maps标记抛出和IndexOutofBoundsException:索引1无效,大小为0

React native react native maps标记抛出和IndexOutofBoundsException:索引1无效,大小为0,react-native,react-native-android,react-native-maps,React Native,React Native Android,React Native Maps,我正试图在我的Android设备上显示一个react native maps标记(在iOS上工作很好),但它给我带来了一个IndexOutofBoundsException:索引1无效,渲染时大小为0错误 render(){ const INITIAL_REGION={纬度:52.221835,经度:21.000896,纬度:0.0922,经度:0.0421}; 返回( 这一点。显示在半径(5)}>Wszystkie~5km内 本图显示半径(10)}>Wszystkie~10km 此图显示在半

我正试图在我的Android设备上显示一个react native maps标记(在iOS上工作很好),但它给我带来了一个IndexOutofBoundsException:索引1无效,渲染时大小为0错误

render(){
const INITIAL_REGION={纬度:52.221835,经度:21.000896,纬度:0.0922,经度:0.0421};
返回(
这一点。显示在半径(5)}>Wszystkie~5km内
本图显示半径(10)}>Wszystkie~10km
此图显示在半径(15)}>Wszystkie~15km处
this.showAllOffers()}>Wszystkie of erty
{console.log(this.state.offerLocation)}
);
}

知道是什么导致了这种行为吗?我已尝试从MapView组件中删除视图块,但似乎没有帮助。在实际的应用程序中,我计划通过一个对象传递坐标,该对象似乎在fitToCoordinates方法中工作。

无需担心,实际上是MapView中的视图组件导致了问题。

无需担心,事实上,是MapView中的视图组件导致了问题。

没有解决此问题的方法,但它帮助我理解并修复了我的问题。 我不认为
视图
是问题,而是组件渲染的顺序。 在Android上,渲染顺序似乎很重要。 因此,将
Markers
渲染为
MapView
的第一个子项为我解决了这个问题

这里还提到:


希望我能帮忙

这个问题没有解决方案,但它帮助我理解并解决了我的问题。 我不认为
视图
是问题,而是组件渲染的顺序。 在Android上,渲染顺序似乎很重要。 因此,将
Markers
渲染为
MapView
的第一个子项为我解决了这个问题

这里还提到:


希望我能帮忙

将内部视图和市场放在一个视图中,这将解决问题。

将内部视图和市场放在一个视图中,这将解决问题。

对我来说,解决方案是删除任何视图(可以是视图、图像等)。
它与对象和订单都没有关系。

对我来说,解决方案是从中删除任何视图(可以是视图、图像等)。
它与对象和订单都没有连接。

但是我想在地图视图上显示“设计城市”和“搜索栏”选项“我如何插入”如果您解释视图组件的问题,那就太好了!但是我想在地图视图上显示设计城市和搜索栏选项如何插入如果您解释了视图组件的问题,那就太好了!
render() {
    const INITIAL_REGION = { latitude: 52.221835, longitude: 21.000896, latitudeDelta: 0.0922, longitudeDelta: 0.0421 };
    return (
        <MapView ref="map"
            showsUserLocation = { true }
            loadingEnabled = { true }
            showsTraffic = { false }
            showsBuildings = { false }
            style = { styles.map, {flex: 1} }
            initialRegion = { INITIAL_REGION }
        >
            <View style={{flex: 0.1, flexDirection: 'row', position: 'absolute', justifyContent: 'space-between', backgroundColor: 'transparent'}}>
                <Button onPress={() => this.showWithinRadius(5)}>Wszystkie ~5km</Button>
                <Button onPress={() => this.showWithinRadius(10)}>Wszystkie ~10km</Button>
                <Button onPress={() => this.showWithinRadius(15)}>Wszystkie ~15km</Button>
                <Button onPress={() => this.showAllOffers()}>Wszystkie oferty</Button>
            </View>
            { console.log(this.state.offerLocation) }
            <Marker
                coordinate = { {latitude: 52.259216308593, longitude: 21.041564941406} }
                title = { this.props.selectedOffer.offer.title }
            />
        </MapView>
    );
}