Ios 如何使用on press in react native打开另一个文件
如何使用on press功能打开另一个文件,我想在应用程序的主屏幕上打开一个JavaScript文件,基本上,我希望能够按下按钮并从我的第一个触摸屏连接到另一个JavaScript文件 这是密码Ios 如何使用on press in react native打开另一个文件,ios,reactjs,react-native,button,react-navigation,Ios,Reactjs,React Native,Button,React Navigation,如何使用on press功能打开另一个文件,我想在应用程序的主屏幕上打开一个JavaScript文件,基本上,我希望能够按下按钮并从我的第一个触摸屏连接到另一个JavaScript文件 这是密码 import React, { Component } from 'react'; import { StyleSheet, Text, View, Image,ImageBackground,button, TouchableOpacity, Dimensions,Button} fro
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>
);
}
}
import React,{Component}来自'React';
导入{样式表、文本、视图、图像、图像背景、按钮,
TouchableOpacity,维度,按钮}来自“react native”;
从“react navigation”导入{createStackNavigator,};
const width=Dimensions.get('window').width;
const height=维度.get('window')。高度;
const App=StackNavigator({
主页:{'./video1.js'},
配置文件:{screen:ProfileScreen},
});
导出默认类应用程序扩展组件{
render(){
返回(
导航{'Profile'}>
);
}
}
您可以使用react navigation
react navigation的设置是什么?它没有告诉我如何添加文件您设置的方式是错误的,我建议看一些示例,因为从您提供的代码中,有几个错误