我正在寻找社交媒体分享世博会的解决方案.我已经尝试过来自npm的react-native-social-share,但它不适用于Expo.有什么办法吗?
谢谢
我刚刚使用无服务器部署了 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) 根据标题得到错误。我找到的解决方案是针对 Typescript 的,由于我对 JS 和 Tailwind 很陌生,所以我无法从中得到任何东西。我该如何解决这个问题?
module.exports = {
content: [],
theme: {
extend: {},
},
plugins: [
require('@tailwindcss/aspect-ratio'),
],
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我在尝试获取世博会中的当前位置时收到此错误。我在 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) 我遇到了一个在我看来有点奇怪的错误。我第一次点击任何按钮时它是未定义的,但之后每次它都能正常工作。我在创建它们时尝试了一些不同的东西,但结果是一样的。是的,我确定代码很糟糕,但这是我第一次使用 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) reactjs ×4
react-native ×3
javascript ×2
amazon-s3 ×1
expo ×1
python ×1
python-3.x ×1
tailwind-css ×1