我正在使用PushNotificationIOSAPI react-native来显示本地通知。在details用于显示本地通知的对象中,我不完全理解两个字段的用法
alertAction-这是仅用于将通知页脚中显示的文本从默认值更改view为其他值,还是可以将其用于其他目的。我在考虑是否可以在通知中包含自定义操作,并将自定义处理程序附加到此类操作。可以使用alertAction来满足该要求吗?category-我不确定如何使用此字段。官方文档说它是可操作通知所必需的。什么是可行通知?在文档上的示例用法中,category将设置为,REACT_NATIVE但是我不确定它可以解决什么目的。任何输入将不胜感激。
我react-native用于iOS移动应用程序,我用它ListView来显示警报列表.我创建了自己的可重用列表视图组件,ComponentListView在其中我可以传入我想在每行中呈现的组件和列表视图的数据.如果我有很多闹钟,我向下滚动查看最后的闹钟,它总是滚动到顶部(请参阅下面有关症状的rnplay上的示例应用程序)因此我最终无法对闹钟进行操作.我认为它可能与我如何创建ComponentListView组件有关,因为如果我只是使用一个简单的ListView组件,它按预期工作但我需要使用ComponentListView组件,因为我有许多不同的屏幕,我必须显示一个包含不同组件的列表它简化了我的工作.
我在rnplay上创建了一个示例应用程序来显示这些症状.请在iOS上运行.下面AlarmList是使用ComponentListView显示报警的列表,并AlarmSummary为每行中显示的组件.
我尝试使用ComponentListView的render方法中的一些控制台日志语句来调试它,以检查组件是否在滚动时一次又一次地重新渲染,但似乎并非如此.我也尝试在Chrome调试器中调试,但我有点想法,不知道如何/在哪里调试.
如果您有任何指示可以解决问题,请告诉我.
有在文件中的一个的一段代码react-native回购这里如下所示:
export type Operation =
& {instanceID: DebugID}
& (
| {type: 'mount', payload: string}
| {type: 'insert child', payload: {toIndex: number, content: string}}
| {type: 'move child', payload: {fromIndex: number, toIndex: number}}
| {type: 'replace children', payload: string}
| {type: 'replace text', payload: string}
| {type: 'replace with', payload: string}
| {type: 'update styles', payload: mixed /* Style Object */}
| {type: 'update attribute', payload: {[name: string]: string}}
| {type: 'remove attribute', payload: string});
Run Code Online (Sandbox Code Playgroud)
单身 …
我正在尝试为我的移动应用创建下载端点.该应用程序可在应用程序商店和游戏商店中使用.我希望有一个URL可供用户在iOS设备或Android设备上下载应用程序.我试图找出是否可以为此目的为firebase创建云功能.我正在考虑检查user-agent请求,并根据请求是来自iOS设备还是Android设备或Web浏览器,将用户重定向到适当的URL.我已经验证了user-agent标头中存在设备信息.例如
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0 Mobile/14C89 Safari/602.1 AppEngine-Google; (+http://code.google.com/appengine; appid: s~gcf-http-proxy)"
Run Code Online (Sandbox Code Playgroud)
我想下一步要做的是在上述情况下将用户重定向到应用商店网址.我尝试使用,res.redirect但这不起作用.这最终会将用户重定向到cloud-function-base-url/redirect-url而不仅仅是redirect-url.
以下是云功能的代码,该功能只是在从浏览器触发功能时尝试重定向到www.google.com.
exports.appDownload = functions.https.onRequest((req, res) => {
console.log(stringify(req.headers))
// This will eventually redirect to a store URL based on the phone in user-agent
res.redirect('www.google.com');
});
Run Code Online (Sandbox Code Playgroud)
这最终导致浏览器重定向base-url/www.google.com而不仅仅是www.google.com,我收到一条错误消息说Not Found.我想将浏览器重定向到www.google.com.
我想检查是否可以使用firebase的云功能来实现上述功能.
这是针对使用react-native 创建的iOS 应用程序。我正在使用KeyboardAvoidingView包含一些字段的表单TextInput。TextInput我观察到,当选择屏幕底部的字段时,视图移动的高度不足以容纳键盘。
我创建了一种小吃来演示这种行为(下面的链接)。我还观察到,在某些情况下,一台 iPhone 上的视图移动得足够高,但另一台 iPhone 上却没有。最初,该问题是针对 iPhone 6S Plus 报告的,用户报告说视图没有移动到足够高以容纳键盘,在这种情况下,他们无法看到他们在输入框中键入的内容。当我尝试制作一个零食来重现该问题时,我发现即使在 iPhone 5s 上也能重现该问题。
https://snack.expo.io/ry15dng2-
在上面的小吃中,如果单击带有TextInputvalue 的框jug,您应该看到键盘与输入框重叠并且不清晰可见。我对零食的质量感到抱歉。我只是尝试创建一个最小的示例来重现该问题。
我该如何解决这个问题?
我正在使用Firebase处理移动应用程序.在移动应用程序中,我需要根据他/她的手机号码注册用户,类似于Whatsapp.我打算使用Nexmo来验证用户的手机号码.验证号码涉及两个步骤.
我想使用firebase-queue来执行这些任务.我想询问是否有办法将任务的结果返回给客户端.我没有在firebase-queue文档中看到任何这样的示例.基本上,我想添加一个任务来将手机号码发送到Nexmo API,并希望获得request_id作为响应,以便我可以添加另一个任务来验证用户输入的代码.
我目前使用Firebase实时数据库为我的本机反应移动应用程序,我一直在寻找一些提供更好的查询功能的替代方案.Firestore的一个优点是它的查询功能.我想检查Firestore是否支持React Native.
我在我的一个react-native组件中有以下JSX
<TouchableOpacity onPress={this.onEnableNotifications} style={{marginHorizontal: 10}}>
<Image source={require('../../img/ic_warning.png')} style={{tintColor: colorThemes.Blue.red}}/>
</TouchableOpacity>
Run Code Online (Sandbox Code Playgroud)
我收到以下ESLint错误:
'require' is not defined. (no-undef)
Run Code Online (Sandbox Code Playgroud)
我尝试过添加行{ // eslint-disable-line no-undef },Image但这会产生解析错误.我怎样才能为这一行摆脱这个错误.
我正在使用Firebase作为群组协作应用程序(如Whatsapp),我正在使用云功能来确定哪些手机通讯录也在使用我的应用程序(再次类似于Whatsapp).云函数运行正常,直到我开始在函数日志中看到以下日志以进行某些调用.
Function execution took 60023 ms, finished with status: 'timeout'
我做了一些调试,发现对于这个特定的用户,他在手机的通讯录上有很多联系人,所以显然需要弄清楚哪些联系人正在使用该应用程序的工作也增加到了需要花费的时间. 60秒 以下是Cloud Function的代码
// contactsData is an array of contacts on the user's phone
// Each contact can contain one more phone numbers which are
// present in the phoneNumbers array. So, essentially, we need
// to query over all the phone numbers in the user's contact book
contactsData.forEach((contact) => {
contact.phoneNumbers.forEach((phoneNumber) => {
// Find if user with this phoneNumber is using the app
// Check against mobileNumber …Run Code Online (Sandbox Code Playgroud) javascript firebase firebase-realtime-database google-cloud-functions
我正在用来react-navigation createBottomTabNavigator创建底部选项卡导航。标签栏在 iOS 上显示正常,但在 Android 上显示如下:
我不确定是什么导致了这种奇怪的造型。下面是我创建底部标签栏的代码:
<Provider store={store}>
<NavigationContainer theme={GlobalConfig.theme}>
<Tab.Navigator
screenOptions={({route}) => ({
tabBarIcon: ({focused, color, size}) => {
let iconSrc
if (route.name === 'Alarms') {
iconSrc = require('../img/ic_alarm.png')
} else if (route.name === 'Settings') {
iconSrc = require('../img/ic_settings.png')
}
return (
<Image
source={iconSrc}
style={{
tintColor: focused
? GlobalConfig.theme.colors.primary
: GlobalConfig.theme.colors.tabBarIconUnselected
}}
/>
)
}
})}
tabBarOptions={{
activeTintColor: GlobalConfig.theme.colors.primary,
inactiveTintColor: GlobalConfig.theme.colors.tabBarIconUnselected
}}>
<Tab.Screen name={I18n.t('alarms')} component={AlarmsTab} />
<Tab.Screen name={I18n.t('settings')} component={SettingsTab} />
</Tab.Navigator>
</NavigationContainer>
</Provider>
Run Code Online (Sandbox Code Playgroud)
每个选项卡都是一个堆栈导航器。警报堆栈导航配置如下:
<Stack.Navigator
initialRouteName="AlarmListScreen" …Run Code Online (Sandbox Code Playgroud) react-native react-navigation react-navigation-stack react-navigation-bottom-tab
react-native ×7
firebase ×4
javascript ×2
database ×1
eslint ×1
ios ×1
jest ×1
node.js ×1
objective-c ×1
react-jsx ×1
react-navigation-bottom-tab ×1
reactjs ×1
xcode ×1