小编Seb*_*ger的帖子

react-native-swiper 组件的动态高度

他,我正在使用该react-native-swiper组件来显示图像幻灯片。

目前我正在heightSwiper组件指定属性,但我想height根据 swiper 中显示的图像大小进行动态设置。

在我的情况下,图像是二次的,高度由其宽度决定。所以刷卡器显示的所有图像都具有相同的高度。

我当前的 Swiper(具有固定高度)看起来像:

<Swiper autoplay height={375}>
            {bounty.pictures.map((item, key) => {
              return (
                <View key={key}>
                  <Image styleName="large-square" source={{ uri: item.image }}></Image>
                </View>
              )
            })}
</Swiper>
Run Code Online (Sandbox Code Playgroud)

当我height在当前实现中没有指定任何内容时,该Swiper组件大约是底层图像大小的两倍。

我找不到任何react-native-swiper使用动态高度的示例,具体取决于显示的内容。

react-native

5
推荐指数
0
解决办法
2137
查看次数

无法将 Cloud Data Fusion 与 Google Cloud SQL for PostgreSQL 连接起来

我的目标是通过 Cloud Data Fusion 管道将数据从 Cloud SQL Postgres 读取到 BigQuery。

为此,我设置了一个 Cloud Data Fusion 实例并为服务帐户分配了以下两个权限:(请参阅https://cloud.google.com/data-fusion/docs/how-to/create-instance#setting_up_permissions

  • 云 SQL 客户端
  • Cloud Data Fusion API 服务代理

作为下一步,我将自己连接到 Cloud Data Fusion 实例,并导航到Wrangler -> Add Connection -> Database -> Google Cloud SQL for PostgreSQL.

作为驱动程序,我上传了postgres-socket-factory-1.0.13-jar-with-dependencies.jar我在此处下载的驱动程序:https : //github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

对于驱动程序配置,我设置:

  • 名称:cloudsql-postgresql
  • 类名:org.postgresql.Driver

对于数据库连接,我设置:

  • 连接名称: <PROJECT_NAME>:<REGION>:<INSTANCE_CONNECTION_NAME>
  • 连接字符串: jdbc:postgresql://google/<DATABASE_NAME>?cloudSqlInstance=<INSTANCE_CONNECTION_NAME>&socketFactory=com.google.cloud.sql.postgres.SocketFactory
  • 用户名:数据库用户名
  • 密码:数据库密码

单击测试连接后,我收到org.postgresql.Driver错误消息。

在此处输入图片说明

google-cloud-data-fusion

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

Python Stripe:'module'对象没有属性'Charge'

我在我的MacOSX Mavericks Macbook Pro(python 2.7)上安装了Stripe

但我总是收到以下错误消息:

$ sudo python stripe.py
Traceback (most recent call last):
  File "stripe.py", line 1, in <module>
    import stripe
  File "/Users/sebastian/Desktop/stripe.py", line 7, in <module>
    resp = stripe.Charge.create(
AttributeError: 'module' object has no attribute 'Charge'
Run Code Online (Sandbox Code Playgroud)

当我尝试执行以下脚本时:

import stripe

stripe.api_key = 'my_test_secret_key'

resp = stripe.Charge.create(
    amount=200,
    currency='usd',
    card={
        'number': '4242424242424242',
        'exp_month': 10,
        'exp_year': 2014
    },
    description='customer@gmail.com'
)
Run Code Online (Sandbox Code Playgroud)

python attributeerror stripe-payments

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

React Native:当props更改时更新ListView行

我有一个带有renderRow()函数的ListView组件.我的自定义ListBountiesView组件呈现ListView行也会调用一个prop,cr并根据值显示每行中的一些内容cr.

问题是,当this.props.customerRelationship更改其值时,ListView行不会更新.

我这样做: this.props.customerRelationship.points += responseJson.points;

我想这ListView只会在data属性发生变化时更新,但是如何将props移动到我的renderRow组件中以便它们也更新ListView?

SuperScreen.js

renderRow(bounty) {
  const { customerRelationship } = this.props;
  return (
    <ListBountiesView
      key={bounty.id}
      bounty={bounty}
      cr={customerRelationship}
      onPress={this.openDetailsScreen}
    />
  );
}

render() {
    const { bounties } = this.props;

    return (
      <ListView
          data={bounties}
          renderRow={this.renderRow}
          loading={loading}
      />
    )
Run Code Online (Sandbox Code Playgroud)

react-native react-native-listview shoutem

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