我正在构建一个应用程序并引用此链接 我为我的应用程序实现了相同的代码,但我收到错误“无法读取未定义的属性'getSelectedItemsExt'”。另一个错误是“提交”按钮也没有显示。我已经尝试了所有方法,但都失败了。
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, TextInput, View, ListView, Alert, Button, Platform, ToastAndroid, TouchableOpacity, ActivityIndicator, Text, Picker, ScrollView }
from 'react-native';
import { StackNavigator } from 'react-navigation';
import MultiSelect from 'react-native-multiple-select';
class manage_publishers extends Component {
static navigationOptions = {
title: 'Manage Publishers',
};
constructor() {
super()
this.state = {
isLoading: true,
selectedPublishers1:[],
publishersByCategory: [],
publishersByClient: [],
publishersByGroup: [],
dataSource:[]
}
}
componentDidMount()
{
const base64 = require('base-64');
fetch('APIURL'+this.props.navigation.state.params.id,
{
method: 'GET', …Run Code Online (Sandbox Code Playgroud) 出于测试和共享目的,我在终端中使用以下代码创建了一个 apk
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debugScanning
Run Code Online (Sandbox Code Playgroud)
并使用创建 apk
Create debug build:
cd android
./gradlew assembleDebug
Run Code Online (Sandbox Code Playgroud)
上面的解决方案来自成功创建一个好的 apk 文件的 stackoverflow,
但是,当我测试 apk 时,它没有显示文件夹中的图标
"react-native-project-name/assets"
Run Code Online (Sandbox Code Playgroud)
只显示空白而不是图标。测试了一些解决方案,但注意解决了这个问题。
版本
react-native-cli: 2.0.1
react-native: 0.55.4
Run Code Online (Sandbox Code Playgroud) 我想添加last seen at today 1pm用户上次访问或打开我的应用程序的时间 - WhatsApp 和其他聊天应用程序等具有的功能。
在我的 React Native 聊天应用程序中,我使用 redux 进行状态处理。我在后端使用 Firebase。我的聊天应用程序快完成了,但我不知道如何添加用户上次看到的功能。
react-native react-native-android react-native-ios react-native-firebase
我正在 React Native 项目中工作,我需要在我的应用程序中实现来自服务器的推送通知。我尝试使用 firebase 作为通知提供程序。为此,我使用了 react-native-firebase 包。我试过这个例子链接它在应用程序运行时工作正常。但是当应用程序关闭时通知失败了。那么我怎样才能做到这一点
我的目标 Android 版本是 KitKat
android firebase react-native react-native-android react-native-firebase
我正在测试嵌套在导航器中的 FlatList 并试图了解它是如何工作的。下面的代码工作正常:
<FlatList
data={[{key: 'a'}, {key: 'b'}]}
renderItem={({item}) => <Text>{item.key}</Text>}
horizontal={true}
/>
Run Code Online (Sandbox Code Playgroud)
但这不会:
<FlatList
data={[{key: 'a'}, {key: 'b'}]}
renderItem={({item}) => <TextComp data={item}/>}
horizontal={true}
/>
Run Code Online (Sandbox Code Playgroud)
TextComp 只是一个显示 item.key 的组件,并且在单独测试时按预期工作。代码是
<View>
<Text>{this.props.data.key}</Text>
</View>
Run Code Online (Sandbox Code Playgroud)
我还尝试在两个组件周围绘制边框,似乎 FlatList 肯定正在呈现,但项目不是。
我正在我的 Android 设备上进行测试。
更新:我向 TextComp 组件添加了 console.log(this.props) 语句,它正确显示了道具,因此正确的数据正在从 FlatList 传递到 TextComp,但 TextComp 没有被呈现。
reactjs react-native react-native-android react-native-ios react-native-flatlist
我正在使用这样的视频组件:
<Video style={[videoPlayerStyle, this.props.containerStyle, {height: videoHeight, width: videoWidth}] }
source={{uri: this.props.videoURL}}
ref={(ref) => {
this.player = ref
}}
paused={this.state.paused}
controls={nativeControls}
playInBackground={false}
repeat={false}
key="something123"
muted={this.state.mute}
onBuffer={this.onBuffer}
onEnd={this.onEnd}
onError={this.onError}
onLoad={this.onLoad}
onLoadStart={this.onLoadStart}
onProgress={this.onProgress}
/>
Run Code Online (Sandbox Code Playgroud)
视频结束后,我会显示一个按钮,允许用户再次播放。我尝试使用:
restartPlayingVideo = (dict) => {
this.player.seek(0) // I tried with and without this
this.setState({paused: false})
}
Run Code Online (Sandbox Code Playgroud)
但该视频不会在 Android 上再次开始(在 iOS 上运行良好)。
我错过了什么吗?
我正在构建一个基于Expo的 React 本机应用程序,我还想结合Firebase 实时数据库利用 Expo 的推送通知功能。我基本上按照此处描述的步骤进行操作。在到达必须提取推送通知令牌的部分之前,一切都很顺利。
registerForPushNotificationsAsync = async (userInfo) => {
// ... Stuff
// Get the token that uniquely identifies this device
let token = await Notifications.getExpoPushTokenAsync();
console.log("Expo token: " + token);
var updates = {}
updates['/expoToken'] = token
firebase.database().ref('Users').child(userInfo.user.uid).update(updates)
}
Run Code Online (Sandbox Code Playgroud)
问题发生在这一行:
let token = await Notifications.getExpoPushTokenAsync();
Run Code Online (Sandbox Code Playgroud)
它从不返回值,我无法获得推送令牌。这是 Android 特定的(Android 7.0),它不会出现在 iPhone (iOS 11.0.2) 上。在 iPhone 上返回一个令牌,我成功地将它存储在数据库中。
我正在做的是使用他们的 CLI 开始博览会并扫描生成的二维码(使用他们的 IOS/Android 客户端应用程序)。然后,再次在浏览器加载的 CLI 中,我分别在 iPhone 和 Android 手机上观察应用程序运行时发生的情况。软件包的版本如下:
世博会@31.0.2
firebase@5.5.7 …
push-notification react-native react-native-android firebase-cloud-messaging expo
在我的本机 android 项目中,我想将限制设置为 Android 版本 >= 5。
在build.gradle我设置minSdkVersion 21.
此设置是否足够,并且 android < 5 的用户将无法从商店获取它?
我正在尝试提供在给定 Base64 字符串的情况下下载 PDF 的能力。我可以使用“react-native-view-pdf”查看PDF。只是无法弄清楚如何实际下载文件。这将需要适用于 android 和 ios。
我已经尝试了各种论坛,但遗憾的是却无处可去。
注意:this.props.pdf 是 Base64 字符串。
尝试 1)
var path = RNFetchBlob.fs.dirs.DocumentDir + "/bill.pdf";
RNFetchBlob.fs.writeFile(path, this.props.pdf, "base64").then(res => {
console.log("File : ", res);
});
Run Code Online (Sandbox Code Playgroud)
尝试 2)
RNFetchBlob.config({
fileCache : true,
appendExt : 'pdf'
})
.fetch('GET',`${this.props.PDFLink}`)
.then((res) => {
// open the document directly
if(Platform.OS == "ios"){
RNFetchBlob.ios.previewDocument(res.path())
}
else{
RNFetchBlob
.config({
addAndroidDownloads : {
useDownloadManager : true, // <-- this is the only thing required
// Optional, override notification setting (default to true) …Run Code Online (Sandbox Code Playgroud) react-native react-native-android react-native-ios react-native-fetch-blob
我正在尝试在 react-native 项目中实现 heremap api 。虽然搜索得到了https://www.npmjs.com/package/react-native-hemaps。但是没有合适的文档来使用这个库。我是本机反应的新手。请给我一些建议来实现这一点。