标签: react-native-android

如何从 React Native 上的 uri 获取图像高度和宽度?

所以,我尝试使用 React Native 提供的 Image.getSize 函数。但是当我尝试在函数外使用高度和宽度时,它似乎为零。这是我的代码:

var theHeight = 0;
Image.getSize(url,(height, width)=>{
 theHeight = height;
})

console.log("test get height "+theHeight);
Run Code Online (Sandbox Code Playgroud)

结果是

测试得到高度 0

我做错了什么?

reactjs react-native react-native-android

2
推荐指数
2
解决办法
1万
查看次数

在 RN ScrollView 中动态设置 scrollEnabled 为 False

scrollEnabled当滚动到达某个位置时,如何更改React Native ScrollView param的 bool 值?

我确实在 ScrollView 中有一个 ScrollView,由于外部 ScrollView,内部 ScrollView 没有响应。当scrollEnabled参数设置为False外部 ScrollView时,内部 ScrollView 起作用。我的想法是将外部 ScrollView 动态设置为scrollEnabled={false}到达底部时。我该怎么做呢。

谢谢,

react-native react-native-listview react-native-scrollview react-native-android

2
推荐指数
1
解决办法
5290
查看次数

标记反应原生地图无法拖动

我已经使用 react-native-map air bnb 在我的本机应用程序中渲染谷歌地图。地图和标记显示出来,但标记不能拖动。这是我的脚本

<View style={Style.mapContainer}>
            <GeoLocation onSetInitalPos={this.onSetInitialPosition}
                         onSetLastPos={this.onSetLastPosition}/>
            <MapView style={Style.map} region={this.state.region} onRegionChange={this.onRegionChange}>
                <MapView.Marker draggable={this.state.draggable}
                                coordinate={this.state.marker.latlng}
                                title={this.state.marker.title}
                                description={this.state.marker.description}
                                onDrag={() => console.log('onDrag')}
                />
            </MapView>
            <AutoCompleteMap onSetNewPlace={this.setMarkerPosition}/>
        </View>
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-android react-native-maps

2
推荐指数
1
解决办法
7355
查看次数

React Native Image 不会改变

当我打开配置文件选项卡时,它会从 URL 加载图像(配置文件图像),如果用户想要更改他的图像,他可以,但是当他更改图像时,服务器上的图像已更改,但在应用程序上它不会更改,但如果我刷新了它确实改变的应用程序。

当用户登录他在 URL 上有图像时,URL 不会改变,当他更新图像时,URL 是相同的,但图片是不同的。

<Image style={{height: 70, width:70,borderRadius: 35}} source={{uri:'http://********************/'+GLOBAL.api_token}} />
Run Code Online (Sandbox Code Playgroud)

android react-native react-native-android react-native-ios react-native-image

2
推荐指数
1
解决办法
4181
查看次数

run-android 连接到设备时出错

我添加了一个闪屏,https://medium.com/handlebar-labs/how-to-add-a-splash-screen-to-a-react-native-app-ios-and-android-30a3cec835ae,到AwesomeProject 入门示例 ( https://facebook.github.io/react-native/docs/getting-started.html )。

我连接了我的 nexus 6p 并运行了 react-native run-android 并且我收到了这个错误

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Running /home/Android/Sdk/platform-tools/adb -s 84B7N15A10013562 reverse tcp:8081 tcp:8081
Starting the app on 84B7N15A10013562 (/home/Android/Sdk/platform-tools/adb -s 84B7N15A10013562 shell am start -n com.testprj1/.MainActivity)...
Starting: Intent { cmp=com.testprj1/.MainActivity }
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.testprj1/.MainActivity } from null (pid=23823, uid=2000) not exported from uid 10161
        at android.os.Parcel.readException(Parcel.java:1684)
        at android.os.Parcel.readException(Parcel.java:1637)
        at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:3137)
        at com.android.commands.am.Am.runStart(Am.java:643)
        at com.android.commands.am.Am.onRun(Am.java:394)
        at …
Run Code Online (Sandbox Code Playgroud)

android react-native react-native-android

2
推荐指数
1
解决办法
678
查看次数

错误:未找到组织或项目 :app:bundleReleaseJsAndAssets FAILED

在我的 React Native android 应用程序中集成 Sentry 后,无法构建发布的 Android APK。我收到了这个错误。

错误:未找到组织或项目 :app:bundleReleaseJsAndAssets FAILED

FAILURE:构建失败,出现异常。* 其中:脚本“/TF_ReactNative_Projects/Projects/MobilityOne/node_modules/react-native-sentry/sentry.gradle”行:126

  • 出了什么问题:任务“:app:bundleReleaseJsAndAssetsdebugSentryUpload”的执行失败。

    进程 'command'node_modules/sentry-cli-binary/bin/sentry-cli'' 以非零退出值 1 结束

sentry react-native react-native-android

2
推荐指数
1
解决办法
1055
查看次数

React Native 中的 RCTBridge

如果我的移动应用程序有多个 RCTRootView 用法。我应该重用相同的 RCTBridge 还是为每个创建一个。假设两个 RCTRootView 可以在同一个 VC 或不同的 VC 上。谢谢你。

react-native react-native-android react-native-ios

2
推荐指数
1
解决办法
2433
查看次数

模态反应原生模糊

我正在使用react-native-blur来模糊 react-native 上的视图,但正如此问题所述,它在模态内不起作用。

我已经通过在 imageLoad 之后设置超时来尝试评论中建议的想法,但它仍然没有模糊。

有什么解决方法吗?为什么它可以在模态之外工作,但不能在模态中工作?react-native 中模态渲染的方式有什么区别?不幸的是,这是我的应用程序的一个错误部分,我必须成功。

谢谢

编辑:我做的不同。由于 blurRadius 正在以模态形式处理 android 上的图像,因此我使用图像组合来准确显示我想要的图像。

react-native react-native-android

2
推荐指数
1
解决办法
6888
查看次数

检测何时在 React Native 应用程序中启动其他应用程序

我希望我的本机应用程序能够检测 Google 地图应用程序何时打开以显示一些旅行提示。是否可以?

react-native react-native-android react-native-ios

2
推荐指数
1
解决办法
753
查看次数

DatePicker NativeBase - 选择日期的格式

我使用DatePicker的NativeBase,想选择一个日期后更改显示的日期的格式。由于缺乏文档,我无法找到相关的道具。

有没有办法可以像DatePickerAndroid使用一样更改日期格式format="YYYY-MM-DD"?

datepicker react-native react-native-android native-base

2
推荐指数
1
解决办法
3672
查看次数