这件事突然发生,我不知道发生了什么。
我开始运行我的应用程序并收到此错误:
我相信它来自react-native-vector-icons。
我尝试切换到旧版本的react-native-vector-icons,但仍然收到相同的结果。
我还尝试卸载react-native-vector-icons,当我这样做时,我收到一个编译错误。
** BUILD FAILED **
The following build commands failed:
CompileC /Users/lukeschoenberger/Documents/Programming/news-
arg/test6/ios/build/test6/Build/Intermediates.noindex/Pods.build/Debug-
iphonesimulator/RNVectorIcons.build/Objects-
normal/x86_64/RNVectorIconsManager.o
/Users/lukeschoenberger/Documents/Programming/news-
arg/test6/node_modules/react-native-vector-
icons/RNVectorIconsManager/RNVectorIconsManager.m normal x86_64
objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Run Code Online (Sandbox Code Playgroud)
我现在很困惑。
编辑:
在链接react-native-vector-desing并清除构建文件夹后,我收到此错误:
Build system information
error: Multiple commands produce '/Users/lukeschoenberger/Documents/Programming/news-arg/test6/ios/build/test6/Build/Products/Debug-iphonesimulator/test6.app/AntDesign.ttf':
1) Target 'test6' (project 'test6') has copy command from
'/Users/lukeschoenberger/Documents/Programming/news-
arg/test6/node_modules/native-base/Fonts/AntDesign.ttf' to
'/Users/lukeschoenberger/Documents/Programming/news-
arg/test6/ios/build/test6/Build/Products/Debug-
iphonesimulator/test6.app/AntDesign.ttf'
2) Target 'test6' (project 'test6') has copy command from
'/Users/lukeschoenberger/Documents/Programming/news-
arg/test6/node_modules/react-native-vector-icons/Fonts/AntDesign.ttf' to
'/Users/lukeschoenberger/Documents/Programming/news-
arg/test6/ios/build/test6/Build/Products/Debug-
iphonesimulator/test6.app/AntDesign.ttf'
** BUILD FAILED **
Run Code Online (Sandbox Code Playgroud) 当我尝试实现 codepush 时,收到此错误:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
70 actionable tasks: 7 executed, 63 up-to-date
/Users/lukeschoenberger/Documents/Programming/news-arg/test7/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:59: error: cannot find symbol
new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),
^
symbol: variable reactNativeCodePush_androidDeploymentKey
location: class string
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try: …Run Code Online (Sandbox Code Playgroud) 我已经关注了其他提出类似问题的帖子,但他们没有提供解决方案。
我无法在 React Hook 中暂停音频。
这是我的反应钩子:
import React, { useState } from "react";
export default (App = props => {
const [audioStatus, changeAudioStatus] = useState(false);
const audio = new Audio(
"https://mcdn.podbean.com/mf/web/xm5ngf/The_Challenge_Chronicles_-_Episode_48_7ys6e.mp3"
);
audio.load();
const startAudio = () => {
audio.play();
changeAudioStatus(true);
};
const pauseAudio = () => {
console.log("here");
audio.pause();
changeAudioStatus(false);
};
return (
<>
{audioStatus ? (
<button onClick={pauseAudio}>pause</button>
) : (
<button onClick={startAudio}>start</button>
)}
</>
);
Run Code Online (Sandbox Code Playgroud)
我还创建了一个沙箱:https : //codesandbox.io/s/great-gagarin-v0vi1
我正在尝试对齐包含在 React Native 中的文本元素中的文本和图像。
我想让它对齐,这样它就均匀了。
这是我目前拥有的代码:
<Text>
<Text
key={i}
onPress={() => this.updateCurrentFilter(i)}
style={{
paddingLeft: 10,
fontFamily: "Montserrat-Regular",
fontSize: 12,
}}
>{v.filter_name}</Text>
<Image
source={require('../assets/outline_toggle_off_black_18dp.png')}
style={{
width: 25,
height: 25,
color: 'black',
resizeMode: 'contain',
}}
/>
</Text>
Run Code Online (Sandbox Code Playgroud)