小编gal*_*lgo的帖子

离子标签徽章

我正在尝试在选项卡中的"我的图标"上添加徽章.目前的结果是:http://play.ionic.io/app/decfc14cb171

有谁知道如何把它们放在每个图标的右上角?

我试过用 但事实证明,在其他方面存在问题,尽管"徽章"属性更容易达到预期的效果.有没有办法在不使用离子标签的情况下复制它?

icons tabs badge ionic-framework ionic

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

iOS应用内购买噩梦

我们正在开发一款带有Ionic和cordova-plugin-inapppurchase的App.当我们尝试恢复购买时,我们遇到了以下错误,因此我们已经挣扎了一个多星期:

RMStore:未知产品ID com.company.appname.myID

{"errorMessage":"未知产品标识符","errorCode":100}

productId = 'com.company.appname.myID';
Run Code Online (Sandbox Code Playgroud)

itunesconnect in-app-purchase ios ionic-framework cordova-plugins

5
推荐指数
1
解决办法
919
查看次数

以动画背景作为加载器的 React-native 图像

我有一个平面列表,它可以渲染带有叠加层的图像等。

我创建了一个动画背景,它会随着图像加载而改变颜色(效果很好)。但一旦图像加载,我就很难让背景消失。我尝试使用 onLoad 但设置 this.state 适用于列表中的所有图像。另外,如果图像在加载之前是隐藏的,那就更好了。我更喜欢实时延迟加载,而不是在 ComponentWillMount 中预取它们。

有任何想法吗?

<Image
    source={{uri: image}}
    style={styles.cardImg}
    onLoad={() => this.state.imageLoaded = true}
/>
{!this.state.imageLoaded && (
    <Animated.View
        style={[styles.cardBg, {
            backgroundColor: this._animatedValue.interpolate({
                inputRange: [0, 100],
                outputRange: ['rgba(100,100,100, 0.3)', 'rgba(100,100,100,0.5)']
            })
        }]}
    />
)}
Run Code Online (Sandbox Code Playgroud)

更新

<FlatList
          ref={(ref) => { this.FlatList = ref; }}
          data={this.props.data}
          keyExtractor={(item) => item._id}
          renderItem={this._renderCard.bind(this)}
          onEndThreshold={50}
          onEndReached={this.props.loadMore}
          ListFooterComponent={this._renderFooter}
          showsVerticalScrollIndicator={false}
          style={styles.list}
          extraData={this.state}
          refreshControl={<RefreshControl
                    refreshing={this.props.loading}
                    onRefresh={this.props.onRefresh}
                />}
        />
Run Code Online (Sandbox Code Playgroud)

更新2

理想情况下,我正在寻找类似的东西(代码不起作用):

<Image source={{uri: image}} style={styles.cardImg} onError={(e) => {card.item.media.error = true}}/> 
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-native-ios

5
推荐指数
1
解决办法
4893
查看次数

React-native 滚动到顶部并拉动刷新 iOS

我有一个 react-native 应用程序,当 FlatList 在 iOS 中刷新时,我想滚动到顶部。我可以使用以下方法滚动到 FlaList 的顶部:

this.componentRef.FlatList.scrollToOffset({x: 0, y: 0, animated: true});
Run Code Online (Sandbox Code Playgroud)

现在,该列表启用了下拉刷新,因此我想在 iOS 中的刷新指示器上方滚动。

我试过:

this.componentRef.FlatList.scrollToOffset({x: 0, y: -20, animated: true});
Run Code Online (Sandbox Code Playgroud)

并使用 ref 将 RefreshControl 声明为 refreshcontrol(使用回调 ref 声明):

this.componentRef.FlatList.refreshcontrol.scrollToOffset({x: 0, y: 0, animated: true});
Run Code Online (Sandbox Code Playgroud)

this.componentRef.refreshcontrol.scrollToOffset({x: 0, y: 0, animated: true});
Run Code Online (Sandbox Code Playgroud)

但没有工作。有没有人知道我可以在刷新指示器上方滚动的方法(如果它打开)?这仅在 iOS 中发生,因为 Android 的刷新指示器的工作方式不同。

更新:

由于 RefrehControl 组件无法使用 scrollToOffset,因此它不会工作。这让我回到如何在 FlatList 中的 RefreshControl 上方滚动。我的最后一次尝试:

this.FlatList.scrollToOffset({x: 0, y: 0, animated: true});
Run Code Online (Sandbox Code Playgroud)

仍然滚动到列表的开头,但“RefreshControl”在视觉上是隐藏的。

我也尝试在上面添加一个空的 ScrollView 并滚动到它,因为它是空的,它不起作用。有任何想法吗?

更新 2

澄清一下,这就是一切的称呼(简化):

Main.js 中的 _scrollAndRefresh 方法:

  _scrollAndRefresh = () …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-ios

4
推荐指数
1
解决办法
9298
查看次数

离子输入并排选择

我想同时显示一个输入和一个选择。

我尝试了几种无济于事的方法。

当前代码如下

<form name="signup">
<ion-list>
<label class="item item-input">
<input placeholder="Identificación" name="identificacion" type="text" ng-click="registro.msg = null" ng-model="registro.identificacion" required>
</label>
<label class="item item-input item-select" name="tipo_id" ng-model="registro.tipo_id">
<div class="input-label">Tipo de Identificación</div>
<select ng-model="registro.tipo_id">
<option ng-repeat="tipo in defaultTipo" value="{{tipo.id}}" ng-selected="{{tipo.selected}}">{{tipo.tipo}}</option>
</select>
</label>
</ion-list>
</form>
Run Code Online (Sandbox Code Playgroud)

输出以下内容:

在此处输入图片说明

我需要在同一行中将输入置于左侧,将选择置于右侧。

有任何想法吗?

ionic-framework ionic

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

反应本机基础吐司错误

我已经设置了以下React Native App,并且正在尝试使用Native Base中的Toast组件:

app.js

import React, {Component} from 'react';
import {AppRegistry} from 'react-native';
import { Root } from "native-base";
import {StackNavigator} from 'react-navigation';
import MainView from './assets/screens/MainView';
import ConfigView from './assets/screens/ConfigView';

export default class myApp extends Component {

render() {
  return (
    <Root>
    <AppNavigator />
  </Root>
  );
}
}
const Screens = StackNavigator({
  Main: {screen: MainView},
  Config: {screen: ConfigView}
})

AppRegistry.registerComponent('myApp', () => Screens);
Run Code Online (Sandbox Code Playgroud)

MainView.js(简体)

import React, {Component} from 'react';
import { StyleProvider, Card, CardItem, Left, Right, Body, Icon, …
Run Code Online (Sandbox Code Playgroud)

react-native native-base

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