如何使用按一下功能打开另一个文件,我想从应用程序的主屏幕中打开一个JavaScript文件,基本上,我希望能够按下按钮并连接到我的其他javascript文件从我的第一个touchable-opacity
这是代码
import React, { Component } from 'react';
import { StyleSheet, Text, View, Image,ImageBackground,button,
TouchableOpacity, Dimensions,Button} from 'react-native';
import {createStackNavigator,} from 'react-navigation';
const width = Dimensions.get('window').width;
const height = Dimensions.get('window').height;
const App = StackNavigator({
Home: { './video1.js' },
Profile: { screen: ProfileScreen },
});
export default class App extends Component {
render() {
return (
<View style={{flexDirection: "row"}}>
<ImageBackground source={{uri: 'https://lumiere-a.akamaihd.net/v1/images/usa_avengers_sb_bkgd8_1024_0ae5b001.jpeg?region=0%2C0%2C1024%2C576'}}
style={{width: width, height: height,}}>
<TouchableOpacity style={styles.spiderman} onPress={() =>
navigate{'Profile'}>
<Image source={{uri: 'http://www.pngmart.com/files/2/Spider-Man-Transparent-Background.png'}}
style={{width: 190, height:250,}} />
</TouchableOpacity>
<TouchableOpacity style={styles.panther}>
<Image source={{uri:
'https://vignette.wikia.nocookie.net/avengers-assemble/images/a/a0/Usa_avengers_herochi_blackpanther_r_e1954416.png/revision/latest?cb=20170417131405'}}
style={{width: 190, height: 300, }} />
</TouchableOpacity>
<TouchableOpacity style={styles.hulk}>
<Image source={{uri: 'https://clipart.info/images/ccovers/1516942387Hulk-Png-Cartoon.png'}}
style={{width: 225, height: 350}} />
</TouchableOpacity>
</ImageBackground>
</View>
);
}
}