小编J. *_*Doe的帖子

React-native - Expo,在twitter上分享

我正在寻找社交媒体分享世博会的解决方案.我已经尝试过来自npm的react-native-social-share,但它不适用于Expo.有什么办法吗?

谢谢

reactjs react-native expo

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

AWS - ClientError:调用 GetObject 操作时发生错误 (AccessDenied):访问被拒绝

我刚刚使用无服务器部署了 lambda,但不允许我访问我想要的 s3 存储桶。这段代码中有什么明显损坏的地方吗?

service: handler
frameworkVersion: '2'

provider:
  name: aws
  runtime: python3.8
  lambdaHashingVersion: 20201221
  iam:
    role:
      statements:
        - Effect: 'Allow'
          Action:
            - 's3:GetObject'
            - 's3:PutObject'
          Resource: "arn:aws:s3:::my_bucket"
plugins:
  - serverless-python-requirements

package:
  exclude:
    - node_modules/**
functions:
  login:
    handler: handler.login
    events:
     - httpApi:
          path: /login
          method: post
Run Code Online (Sandbox Code Playgroud)

这是尝试访问 s3 的函数

def check_s3(user):
    s3 = boto3.client('s3')
    obj = s3.get_object(Bucket="my_bucket", Key=user)
    data = json.loads(obj['Body'].read())
    return data
Run Code Online (Sandbox Code Playgroud)

我收到的错误:

[ERROR] ClientError: An error occurred (AccessDenied) when calling the GetObject operation: Access Denied
Traceback (most recent …
Run Code Online (Sandbox Code Playgroud)

python amazon-s3 amazon-web-services python-3.x

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

找不到模块“@tailwindcss/aspect-ratio”的声明文件

根据标题得到错误。我找到的解决方案是针对 Typescript 的,由于我对 JS 和 Tailwind 很陌生,所以我无法从中得到任何东西。我该如何解决这个问题?

    module.exports = {
      content: [],
      theme: {
        extend: {},
      },
      plugins: [
        require('@tailwindcss/aspect-ratio'),
      ],
    }
Run Code Online (Sandbox Code Playgroud)

谢谢!

reactjs tailwind-css

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

React-native,地图,道具'region.latitude'在'MapView'中被标记为必需,但它的值为null

我在尝试获取世博会中的当前位置时收到此错误。我在 console.log 中得到了正确的值,所以我不知道问题是什么。在 Expo 中,它说“执行 UI 块时抛出异常,NSNull 双值:无法识别的选择器发送到实例”。这是我的代码:

this.state = { text: 'Destination' ,
  latitude: null,
  longitude: null,
  error: null,

componentDidMount() {
navigator.geolocation.getCurrentPosition(
  (position) => {
    this.setState({
      latitude: position.coords.latitude,
      longitude: position.coords.longitude,
      error: null,
    });
  },
  (error) => this.setState({ error: error.message }),
  { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 },
);

{.....}
render()
<MapView style={styles.map}
    region ={{
    latitude:this.state.latitude,
    longitude:this.state.longitude,
    latitudeDelta: 0.1,
    longitudeDelta: 0.1,
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

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

React-native - this.setState 仅在第二次点击后更新

我遇到了一个在我看来有点奇怪的错误。我第一次点击任何按钮时它是未定义的,但之后每次它都能正常工作。我在创建它们时尝试了一些不同的东西,但结果是一样的。是的,我确定代码很糟糕,但这是我第一次使用 react/javascript,所以有一些疏忽。

地方:

    export default class Place extends Component {
        render() {
            return (

              <TouchableOpacity onPress={this.props.findPlace} style={styles.findPlace}>
                <View key={this.props.keyval} style={styles.place}>

            </Text>
                    <TouchableOpacity onPress={this.props.findPlace} style={styles.findPlace}>
                    <Text style={styles.placeText}>{this.props.val.place}</Text>


                    <TouchableOpacity onPress={this.props.deleteMethod} style={styles.placeDelete}>
                        <Text style={styles.placeDeleteText}>Delete</Text>
                    </TouchableOpacity>
                </View>

            );
        }
    }
Run Code Online (Sandbox Code Playgroud)

最喜欢的地方:

let testing = this.state.savedPlaces.map((val, key)=>{
    return <Place key={key} keyval={key} val={val}
            onPress={() => {
            this.findPlace(val);
            }}
            deleteMethod={()=>this.deletePlace(key)}
               findPlace={()=>this.findPlace(val)}
            />

        return (
            <View style={styles.container}>
                <View style={styles.header}>
                <TouchableOpacity onPress={ this.addTest.bind(this) } style={styles.addButton}>
                    <Text style={styles.addButtonText}>+</Text>
                </TouchableOpacity>
                    <TextInput
                        style={styles.textInput}
                        placeholder='New'
                        onChangeText={(placeText)=> this.setState({placeText})}
                        value={this.state.placeText}
                        placeholderTextColor='white'
                        underlineColorAndroid='transparent'>
                    </TextInput>
                  //
                </View> …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

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