对于我的本机安卓应用程序,我写的代码大小只有12KB
但是生成的包大小为7.9MB.我怎么能减少这一点.
根据本地的反应文档,我已经在文件中找到了proguard app_root/android/app/proguard-rules.pro但是大小并没有减少
...
android {
...
buildTypes {
release {
...
minifyEnabled true
}
}
}
...
Run Code Online (Sandbox Code Playgroud)
有没有可用的解决方案?
android android-gradle-plugin react-native react-native-android
我有一个简单的应用程序,渲染后几秒钟即可播放声音。
一切正常,除了如果我锁定屏幕,应用程序将不会播放声音,直到我再次将其解锁。
这是我正在使用的简化版本:
import React, { Component, PropTypes } from 'react';
import { View, Text } from 'react-native';
import Sound from 'react-native-sound'; //for the bell sound
class SoundTest extends Component {
componenWillMount(){
setTimeout(this.playSound(), 5000);
}
playSound() {
let s = new Sound('bell.wav','', (e) => {
if (e) {
console.log('error', e);
} else {
console.log('duration', s.getDuration());
s.play();
}
});
}
render() {
return (
<View>
<Text>Hear some sound after a few!</Text>
</View>
)
}
}
AppRegistry.registerComponent('SoundTest', () => SoundTest);
// Works …Run Code Online (Sandbox Code Playgroud) 我正试图检测应用程序何时获得焦点(即从另一个应用程序切换到它)以执行某项任务.有没有办法在React Native中检测到这个?
我正在做的是将文件复制到临时位置,用外部查看器打开它,然后我想在用户从应用程序切换回来时删除该文件.
输入的占位符是绿色,但我也想输入绿色的文本(当我键入文本时,文本颜色显示为黑色,这在我的UI中不够明显)。我如何也可以使其绿色?
react-native react-native-android native-base react-native-ios
我是React Native的新手。在开发本机模块时,我遇到了回调问题。以下是来自React Native的错误消息
02-05 17:43:26.387 32301-32570/com.awesomeproject2 E/ReactNativeJNI: Got JS Exception: Exception calling object as function: abc,function f1() {
_ToastExample2.default.show('1111', _ToastExample2.default.SHORT);
},72,73 is not usable as a native method argument (<unknown file>:1845)
02-05 17:43:26.387 32301-32570/com.awesomeproject2 E/ReactNativeJNI: Got JS Stack: invariant@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:1838:26
enqueueNativeCall@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:2259:20
fn@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:1999:40
onBtnPress@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:58362:32
proxiedMethod@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:34324:37
proxiedMethod@[native code]
touchableHandlePress@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:37170:47
touchableHandlePress@[native code]
_performSideEffectsForTransition@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:36821:36
_performSideEffectsForTransition@[native code]
_receiveSignal@http://localhost:8081/index.delta?platform=android&dev=true&minify=false:36754:46
_receiveSignal@[native code]
touchableHandleResponderRelease@http://localhost:8081/index.delta?platform=android&dev=true&
02-05 17:43:26.393 32301-32570/com.awesomeproject2 E/unknown:ReactNative: Exception in native call
java.lang.RuntimeException: Error calling RCTEventEmitter.receiveTouches
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:135)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194) …Run Code Online (Sandbox Code Playgroud) 我需要在本机反应中实现AutoCompleteTextView。问题是没有这样的内置组件。可以用来模拟此功能的所有模块和库并不完全相似。主要问题是建议未出现在视图上方(例如选择框/选择器的建议)。即使是那样,它与KeyboardAvoidingView的表现也不完美。整个问题是它不能像Android的本机AutoCompleteTextView一样工作
另一种解决方案是使用本机UI元素。但是我想要这个组件同时适用于iOS和Android。任何帮助,将不胜感激。
PS:对不起,我正在使用移动设备时输入错误。
android ios react-native react-native-android react-native-ios
我无法创建以相同方向嵌套在FlatList内的FlatList;
结果是父级是水平的,而子级是垂直的;
这是我的代码:
renderSlides(question) {
return <View key={question.item.code}
style={{flex: 1,width:350}}>
<FlatList
ref='scrollPick'
data={[{k:'A'},{k:'b'},{k:'c'}}]}
horizontal={true}
renderItem={(rate)=>{return (
<View >
<Text>{rate.item.k}</Text>
</View>);}}
keyExtractor={ (item, index) => index}
/>
</View>;
}
render() {
return (
<View style={CONTAINERS.MAIN_COLUMN_BLUE}>
<View style={[NAV.CONTAINER_GENERAL, NAV.CONTAINER_ASSESSMENT, {flex: 1}]}>
<TopBar barType="ex" title={I18n.t('assessment.title')} navigator={this.props.navigator}
closeFunction={this.handleClose}></TopBar>
</View>
<FlatList
ref={(ref) => { this.flatListRef = ref; }}
horizontal={true}
data={[{k:'1'},{k:'2'},{k:'3'},{k:'4'},{k:'5'},{k:'6'},{k:'q'}]}
renderItem={this.renderSlides}
keyExtractor={(item, index) => index}
horizontal={true}
getItemLayout={this.getItemLayout}
contentContainerStyle={{ flexGrow: 1}}
/>
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud)
有人遇到过同样的问题吗? (而且我不能使用scrollView)
react-native react-native-scrollview react-native-android react-native-ios react-native-flatlist
我在React Native Android项目上工作,但我被卡在这个错误上
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.NonParcelField
FAILURE: Build failed with an exception.
Run Code Online (Sandbox Code Playgroud)
我试图在build.gradle中将multi dex更改为false
defaultconfig {...
multiDexEnabled false
...}
Run Code Online (Sandbox Code Playgroud)
我不想迁移到androidx,我只想摆脱androidx&这个错误; 请帮助我,在此先感谢
I just run below steps
1. git clone https://mycaccount@bitbucket.org/somename/appname.git
2.git checkout developer
3.git pull origin
4.get checkout mynewbrange
5. react-native run-android
This project is working in other 4 developers pc and they are using mac
I am using in windows 8 but when i run run-android commant it is not working
and i don't share any code because i guss this is some confoguration issue any one please help to solve this issue
if you need to view code then …
我可以运行我的本机项目。工作正常。我已经通过使用react-native运行进行了测试。但是,当我尝试在Android Studio中运行它时,出现以下错误。
*FAILURE: Build failed with an exception.
* Where:
Script 'D:\EmployeeApp\EmployeeMobileAppGit\employeemobile-app\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 195
* What went wrong:
A problem occurred evaluating settings 'employeeMobile'.
> Unable to determine the current character, it is not a string, number, array, or object
The current character read is 'E' with an int value of 69
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
Error: EPERM: operation not permitted, scandir 'D:/EmployeeApp/EmployeeMobileAppGit/employeemobile-app/android/app/build/intermediates/signing_config/debug/out/signing-config.json' …Run Code Online (Sandbox Code Playgroud) android gradle android-studio react-native react-native-android