我的React Native应用程序在更新目标Sdk版本和compileSdkVersion 31后崩溃。它是工作版本30。Google Play强迫我们进行此更新。该应用程序在 Android 12 版本设备上崩溃。它适用于 Android 10 或 11。
我的 package.json 文件:
{
"name": "app",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@notifee/react-native": "^0.12.2",
"@react-native-community/async-storage": "^1.9.0",
"@react-native-community/checkbox": "^0.5.7",
"@react-native-community/datetimepicker": "^3.0.3",
"@react-native-community/masked-view": "^0.1.9",
"@react-native-community/netinfo": "^9.3.6",
"@react-native-community/picker": "^1.5.1",
"@react-native-community/progress-bar-android": "^1.0.3",
"@react-native-community/progress-view": "^1.2.1",
"@react-native-community/push-notification-ios": "^1.4.1",
"@react-native-firebase/app": "^8.4.1",
"@react-native-firebase/messaging": "7.8.4",
"axios": "^0.21.1",
"date-fns": "^2.28.0",
"moment": "^2.24.0",
"react": "16.13.1",
"react-native": …Run Code Online (Sandbox Code Playgroud) 构建失败并显示以下消息:
Details: createItemModels creation requirements should not create a capability item model for a capability item model that already exists.
Function: createItemModels(for:itemModelSource:)
Thread: <_NSMainThread: 0x130609930>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **
The following build commands failed:
CompileC /Users/myusername/Library/Developer/Xcode/DerivedData/rsmclient-cqisjblhpcnxszfpjsdthcauhgsz/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-hermes.build/Objects-normal/arm64/MessageTypes.o /Users/myusername/Desktop/rsmclient/node_modules/react-native/ReactCommon/hermes/inspector/chrome/MessageTypes.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-hermes' from project 'Pods')
(1 failure)
Run Code Online (Sandbox Code Playgroud)
使用以下命令使用 React Native0.72.6和 React初始化项目:18.2.0
arch -arm64 …Run Code Online (Sandbox Code Playgroud) 我有一个关于 React Native 屏幕设计的问题。
我正在与 Expo 一起构建一个应用程序。它在我的 AS 模拟器 - Nexus 5x 上运行。当我拿起我的真实设备 - 三星 S9 时,页面看起来有所不同,例如左侧和右侧的文本被切掉,因为屏幕似乎太小。然而,这两款设备的宽度相同,均为 72 毫米和 69 毫米,但 S9 是弯曲的。你们如何保持应用程序的响应能力?
我已经做了一些 componentWillMount 检查,如果屏幕太高,我会增大字段高度。我应该对宽度做同样的事情吗?或者我应该使用react-native-responsive-screen 包吗?如果有一些更有经验的 RN 开发人员,请给我一个关于如何实际管理此问题的快速提示。
编辑:: 下面的代码实际上是一个好的做法吗?这是我的样式表,我尝试使用绝对位置 - 这在模拟器上看起来不错,但我想这不是一个好的做法。我应该重写样式吗?
const styles = StyleSheet.create({
container: {
justifyContent: "center",
alignItems: "center"
},
headerText: {
fontSize: 30,
color: "black"
},
DateContainer: {
marginTop: 10,
marginBottom: 10
},
DateText: {
position: "absolute",
fontSize: 16,
color: "black",
top: 14,
left: -100
},
phaseButton: {
position: "absolute",
top: -42,
right: -95,
height: …Run Code Online (Sandbox Code Playgroud) 我在我的 React 本机应用程序中添加了一个 Lottie 加载动画,该动画到目前为止正在运行,但不知何故颜色没有显示,而仅显示白色动画。
这是代码。
<View style={styles.lottieLoadingWrapper}>
<LottieView
style={styles.lottieLoading}
source={require('../assets/loading-2.json')}
autoPlay
loop
/>
</View>
Run Code Online (Sandbox Code Playgroud)
我没有在样式表中做任何事情。我尝试过多种动画,但都是简单的白色。我在这里犯的错误可能是什么?
更新:以下是样式代码
lottieLoadingWrapper: {
width: 50,
height: 50,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'yellow',
alignSelf: 'center',
},
lottieLoading:{
width: 50,
height: 50,
backgroundColor: 'rgba(120, 120, 120, 0.66)',
justifyContent: 'center',
alignItems: 'center',
}
Run Code Online (Sandbox Code Playgroud)
以下是我正在使用的动画