我可以从任何其他库获得 Electrode native 的功能吗
Can i get functionality of Electrode native from any other library
我已经在 React Native 上创建了一个应用程序。其中只有 2 个活动,现在我想将它们集成到我现有的 android 应用程序 (Native android app).
我开始知道 React-native 的核心不提供生成 .arr
文件或 native code
的功能。为此,我们需要使用 Electrode Native
.
我的问题是:是否有任何其他方法可以从 react-native 代码生成本机 (iOS/android) 代码?是否存在任何其他工具?如果他们这样做了,还有哪些其他功能 Electrode native
会让人考虑呢?
React Native 提供了一个模块来检测应用所在的平台运行。您可以使用检测逻辑来实现特定于平台的代码。当只有一小部分组件是特定于平台的时使用此选项。
import {Platform, StyleSheet} from 'react-native';
const styles = StyleSheet.create({
height: Platform.OS === 'ios' ? 200 : 100,
});
当 iOS 上 运行 时,Platform.OS 将是 ios,Android 上 运行 时,android。
还有一个 Platform.select 方法可用,给定一个包含 Platform.OS 作为键的对象,return 是您当前 运行 所在平台的值.
import {Platform, StyleSheet} from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: 'red',
},
android: {
backgroundColor: 'blue',
},
}),
},
});
这将导致容器在两个平台上都具有 flex: 1,在 iOS 上具有红色背景色,在 Android 上具有蓝色背景色。
因为它接受任何值,您也可以将它用于 return 平台特定组件,如下所示:
const Component = Platform.select({
ios: () => require('ComponentIOS'),
android: () => require('ComponentAndroid'),
})();
<Component />;
检测Android版本
在 Android 上,平台模块也可用于检测应用所在 Android 平台的版本 运行:
import {Platform} from 'react-native';
if (Platform.Version === 25) {
console.log('Running on Nougat!');
}
检测iOS版本
在 iOS 上,Version 是 -[UIDevice systemVersion] 的结果,它是一个包含当前操作系统版本的字符串。系统版本的示例是“10.3”。例如,要检测 iOS 上的主要版本号:
import {Platform} from 'react-native';
const majorVersionIOS = parseInt(Platform.Version, 10);
if (majorVersionIOS <= 9) {
console.log('Work around a change in behavior');
}
回答 what other features Electrode native offers to make one consider it?
上的问题
When developing, integrating, and reusing multiple and distinct React Native components into an existing mobile application, developers face clear challenges.
Electrode Native takes on those challenges by providing an open source platform that reduces the friction for both React Native developers and mobile app developers. Using the Electrode Native platform solution, developers can leverage their knowledge without having to drastically change their workflow to accommodate the integration of multiple React Native components in their mobile application(s)
Electrode Native allows Mobile application developers to easily integrate individual React Native components within their existing mobile application--without changes to their infrastructure or the need to deal with or install any JavaScript based tools--not even Electrode Native itself!
The bottom line: Using Electrode Native, developers can concentrate on functionality and building their apps--without the hassles of reuse or integration issues.
在此处阅读有关 Why electrode native 的更多信息。
我已经在 React Native 上创建了一个应用程序。其中只有 2 个活动,现在我想将它们集成到我现有的 android 应用程序 (Native android app).
我开始知道 React-native 的核心不提供生成 .arr
文件或 native code
的功能。为此,我们需要使用 Electrode Native
.
我的问题是:是否有任何其他方法可以从 react-native 代码生成本机 (iOS/android) 代码?是否存在任何其他工具?如果他们这样做了,还有哪些其他功能 Electrode native
会让人考虑呢?
React Native 提供了一个模块来检测应用所在的平台运行。您可以使用检测逻辑来实现特定于平台的代码。当只有一小部分组件是特定于平台的时使用此选项。
import {Platform, StyleSheet} from 'react-native';
const styles = StyleSheet.create({
height: Platform.OS === 'ios' ? 200 : 100,
});
Platform.OS 将是 ios,Android 上 运行 时,android。
还有一个 Platform.select 方法可用,给定一个包含 Platform.OS 作为键的对象,return 是您当前 运行 所在平台的值.
import {Platform, StyleSheet} from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: 'red',
},
android: {
backgroundColor: 'blue',
},
}),
},
});
这将导致容器在两个平台上都具有 flex: 1,在 iOS 上具有红色背景色,在 Android 上具有蓝色背景色。
因为它接受任何值,您也可以将它用于 return 平台特定组件,如下所示:
const Component = Platform.select({
ios: () => require('ComponentIOS'),
android: () => require('ComponentAndroid'),
})();
<Component />;
检测Android版本 在 Android 上,平台模块也可用于检测应用所在 Android 平台的版本 运行:
import {Platform} from 'react-native';
if (Platform.Version === 25) {
console.log('Running on Nougat!');
}
检测iOS版本 在 iOS 上,Version 是 -[UIDevice systemVersion] 的结果,它是一个包含当前操作系统版本的字符串。系统版本的示例是“10.3”。例如,要检测 iOS 上的主要版本号:
import {Platform} from 'react-native';
const majorVersionIOS = parseInt(Platform.Version, 10);
if (majorVersionIOS <= 9) {
console.log('Work around a change in behavior');
}
回答 what other features Electrode native offers to make one consider it?
When developing, integrating, and reusing multiple and distinct React Native components into an existing mobile application, developers face clear challenges.
Electrode Native takes on those challenges by providing an open source platform that reduces the friction for both React Native developers and mobile app developers. Using the Electrode Native platform solution, developers can leverage their knowledge without having to drastically change their workflow to accommodate the integration of multiple React Native components in their mobile application(s)
Electrode Native allows Mobile application developers to easily integrate individual React Native components within their existing mobile application--without changes to their infrastructure or the need to deal with or install any JavaScript based tools--not even Electrode Native itself!
The bottom line: Using Electrode Native, developers can concentrate on functionality and building their apps--without the hassles of reuse or integration issues.
在此处阅读有关 Why electrode native 的更多信息。