我们正在构建一个带有React本机前端的LibGdx应用。我们在React Native 0.56上。我最近添加了一个WebView来显示来自youtube的帮助视频。
{this.props.appData.showLearningVideos ?
<View style={styles.WebViewContainer}>
<WebView
useWebKit={true}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={true}
style={{flex: 1, margin: 0, padding: 0}}
source={{uri: 'https://www.youtube.com/embed/'+ this.state.selectedVideo +'?rel=0&autoplay=0&showinfo=0&controls=0'}}
/>
{this.state.showVideoMenu?
<View style={styles.videoList}>
<FlatList
scrollEnabled = {false}
data={this.state.videoList}
renderItem={({item}) =>
<View style={styles.menuItem}>
<TouchableOpacity
onPress={() => {
this.setState({selectedVideo: item.YTId, showVideoMenu: false});
}}>
<Text style={styles.menuText}>{item.label}</Text>
</TouchableOpacity>
</View>
}
keyExtractor={(item, index) => index.toString()}
/>
<View style={styles.menuItem}>
<TouchableOpacity
onPress={() => {
this.props.showLearningVideo(false);
}}>
<Text style={styles.menuText}>Exit</Text>
</TouchableOpacity>
</View>
</View> :
<View style={styles.videoMenu}>
<TouchableOpacity
onPress={() => {
this.setState({showVideoMenu: true});;
}}>
<Icon name="menu"
size={25}
color="#7C7C7C"/>
</TouchableOpacity>
</View>}
</View>:null}
WebView在Android上像超级按钮一样工作,但是ios给我一个错误:本机模块不能为空