StyleSheet,
Text,
View
} from ‘react-native’;
import AudioExample from ‘./js/AudioExample’
class HelloWorld extends React.Component {
render() {
return (
)
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: ‘center’,
},
hello: {
fontSize: 20,
textAlign: ‘center’,
margin: 10,
},
});
AppRegistry.registerComponent(‘android’, ()=> AudioExample);
稍微解析下,最前面有import的动作,跟java导包是类似,导入工程中需要用到的组件,比如AppRegistry
,如果是导入自己开发的组件,也是通过import来到导入:
import AudioExample from ‘./js/AudioExample’
导入当前目录下的js目录下的AudioExample.js文件.
然后,我们需要将这个组件注册到我们的App中,那么就有了这一句:
AppRegi