[英]Create-React-Native-App - using native modules
I have a question related to using native modules with react-native apps. 我有一个关于将本机模块与react-native应用程序一起使用的问题。
As described here it appears that application created with CRNA is not supposed to be used with native modules. 如所描述的在这里它显示带有CRNA创建该应用程序是不应该与天然模块一起使用。 Is it still true?
还是这样吗?
Recently I was able to integrate @shoutem/ui
module with my app created with CRNA (as far as I understand this is native module because it requires me to run react-native link command) and it was working just fine on my android and ios phones and ios simulator as well. 最近,我能够将
@shoutem/ui
模块与使用@shoutem/ui
创建的应用程序集成(据我所知,这是本机模块,因为它需要我运行react-native link命令),并且在我的android和ios上运行良好手机和ios模拟器。
As this PR explains, using react-native link should display error message but I cannot observe it at all. 正如该 PR解释的那样,使用react-native链接应该显示错误消息,但我根本看不到它。
Has anything changed? 有什么改变吗? This is really confusing.
这真是令人困惑。 Or maybe my understanding of native modules in react-native is wrong?
还是我对react-native中的本地模块的理解是错误的?
If you've imported the fonts used in the toolkit (as described in this Github issue ): 如果您已导入工具包中使用的字体(如本Github问题中所述 ):
async componentWillMount() {
await Font.loadAsync({
'Rubik-Black': require('./node_modules/@shoutem/ui/fonts/Rubik-Black.ttf'),
'Rubik-BlackItalic': require('./node_modules/@shoutem/ui/fonts/Rubik-BlackItalic.ttf'),
'Rubik-Bold': require('./node_modules/@shoutem/ui/fonts/Rubik-Bold.ttf'),
'Rubik-BoldItalic': require('./node_modules/@shoutem/ui/fonts/Rubik-BoldItalic.ttf'),
'Rubik-Italic': require('./node_modules/@shoutem/ui/fonts/Rubik-Italic.ttf'),
'Rubik-Light': require('./node_modules/@shoutem/ui/fonts/Rubik-Light.ttf'),
'Rubik-LightItalic': require('./node_modules/@shoutem/ui/fonts/Rubik-LightItalic.ttf'),
'Rubik-Medium': require('./node_modules/@shoutem/ui/fonts/Rubik-Medium.ttf'),
'Rubik-MediumItalic': require('./node_modules/@shoutem/ui/fonts/Rubik-MediumItalic.ttf'),
'Rubik-Regular': require('./node_modules/@shoutem/ui/fonts/Rubik-Regular.ttf'),
'rubicon-icon-font': require('./node_modules/@shoutem/ui/fonts/rubicon-icon-font.ttf'),
});
this.setState({fontsLoaded: true});
}
You shouldn't have issues using Shoutem UI toolkit components. 使用Shoutem UI工具包组件应该不会有问题。
Fonts are linked into the app's binary and are therefore considered a native dependency. 字体链接到应用程序的二进制文件中,因此被视为本机依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.