2016-09-03 2 views
0

EDIT : 이미지 문제가 해결되었지만 여전히 링크가 확실하지 않습니다.일부 이미지가 나타나지 않음, 링크가 작동하지 않음 기본 네이티브

오케이 그럼 두 가지 이상한 질문이 있습니다. 그리고 코드에 대한 사전 사과.

첫 번째 문제는 유효하지만 일부 이미지는 표시되지 않습니다. 내 IOS 시뮬레이터에서 이것을 실행할 때 첫 번째 이미지가 표시되지 않습니다. 그러나 일부 이미지는 항상 작동합니다.

두 번째로 두 가지 질문이 필요한 경우 알려 주시고 외부 사이트에 연결하십시오. IOS에서 Linking.open을 수행 할 수있는 것으로 보이지 않습니다. 그래서 나는 안드로이드와 IOS 모두에서 단순히 외부 URL을 여는 것 또는 링크를 통해 가장 쉬운 방법이 무엇인지 궁금 했습니까?

고맙습니다.

openUrl(url) { 
    Linking.canOpenURL(url).then(supported => { 
     if (supported) { 
      Linking.open(url); 
     } else { 
      console.log('nope :: ' + url); 
     } 
    }).catch(err => console.error('An error occurred', err)); 
     // browser.open(url); 
    }, 


    renderImage(event, index) { 
     if (this.state.showBox && this.state.boxIndex == index) { 
     return (
      <View> 
      <TouchableHighlight onPress={()=>this._clickImage(event, index)}> 
       <Image source={{ uri: event.image }} style={[styles.image, this.calculatedSize(), this.getImageStyles(event.featured), { height: 100 }]} /> 
      </TouchableHighlight> 
      <View style={{ flexDirection:'row', padding: 15 }}> 
       <Text style={styles.price}>{event.price}</Text> 
       <Text style={styles.time}>{event.time}</Text> 
       <TouchableHighlight onPress={()=>this.openUrl(event.website)}> 
        <Text style={styles.btn}>Website</Text> 
       </TouchableHighlight> 
      </View> 

       {renderif(event.venue)(
        <TouchableHighlight onPress={()=>this.openUrl(event.venue)}> 
         <Text style={styles.btn}>Venue</Text> 
        </TouchableHighlight> 
       )} 

      </View> 
     ) 


     } else { 
     return (
      <View> 
       <TouchableHighlight onPress={()=>this._clickImage(event, index)}> 
        <Image source={{ uri: event.image }} style={[styles.image, this.calculatedSize(), this.getImageStyles(event.featured)]} /> 
       </TouchableHighlight> 
      </View> 
     ) 
     } 
    }, 

답변

1

일부 이미지는 http 연결에서 이미지를로드하려고하기 때문에 발생합니다 .IOS 앱은 이미지에 https를 사용해야합니다. 이

{ 
     title: 'test', 
     image: 'http://www.piedmontpark.org/images/bird_pine_warbler_330.jpg', 
     featured: true, 
     category: 'Music', 
     price: '$8.00', 
     time: '7:00 PM-11:00 PM', 
     venue: '', 
     website: 'http://google.com' 
    } 

당신의 '이미지'의 예를 들어

는 HTTP에서 JPG를로드하기 위해 노력하고있다.

Check this out on how to configure your info.plist to accept http

+0

감사합니다. 일했다, 디버그하는 이상한 사람이었다. 연결 문제에 대한 의견이 있으십니까? – charliepage88

+1

실제로 보안 상 https를 사용하여 이미지를로드하는 것이 좋습니다. –

관련 문제