react-native-simple-twitter
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "react-native-simple-twitter", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Twitter API client for React Native", | ||
@@ -27,2 +27,2 @@ "main": "index.js", | ||
} | ||
} | ||
} |
@@ -31,2 +31,3 @@ # React-Native-Simple-Twitter | ||
Text, | ||
Alert, | ||
StyleSheet | ||
@@ -38,8 +39,8 @@ } from 'react-native' | ||
/* other */ | ||
import twitter, { TWLoginButton } from '../../util/twitter' | ||
/* import twitter */ | ||
import twitter, { TWLoginButton } from 'react-native-simple-twitter' | ||
@connect( | ||
state => ({ | ||
user:state.user | ||
user: state.user | ||
}) | ||
@@ -66,3 +67,3 @@ ) | ||
componentWillMount() { | ||
async componentWillMount() { | ||
if (this.props.user.token) { | ||
@@ -93,2 +94,20 @@ twitter.setAccessToken(this.props.user.token, this.props.user.token_secret) | ||
this.props.dispatch({ type: "USER_SET", user: user }) | ||
Alert.alert( | ||
"Success", | ||
"ログインできました", | ||
[ | ||
{ | ||
text: 'Go HomeScreen', | ||
onPress: () => { | ||
this.props.dispatch(NavigationActions.reset({ | ||
index: 0, | ||
actions: [ | ||
NavigationActions.navigate({ routeName: 'Home' }) | ||
] | ||
})) | ||
} | ||
} | ||
] | ||
) | ||
} | ||
@@ -163,3 +182,3 @@ | ||
``` | ||
Checkout [example](#usage). | ||
Checkout [example](https://github.com/watanabeyu/react-native-simple-twitter/tree/v1.0.x/example). | ||
@@ -166,0 +185,0 @@ ## TWLoginButton props |
@@ -5,2 +5,4 @@ /* lib */ | ||
export default Request = async (_method = "GET", _url = "", _params = {}) => { | ||
url = _url.replace(/\!/g, "%21").replace(/\'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29").replace(/\*/g, "%2A"); | ||
const options = { | ||
@@ -13,3 +15,3 @@ method: _method, | ||
return await fetch(_url, options) | ||
return await fetch(url, options) | ||
.then(response => { | ||
@@ -16,0 +18,0 @@ const contentType = response.headers.get("content-type") |
@@ -65,3 +65,3 @@ /* npm */ | ||
export const createSignature = (_params, _method, _url, _consumerSecret, _tokenSecret = null) => { | ||
const encodedParameters = encodeParamsToString(_params); | ||
const encodedParameters = encodeParamsToString(_params).replace(/\!/g, '%21').replace(/\'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A'); | ||
const encodedRequestURL = encodeURIComponent(_url); | ||
@@ -68,0 +68,0 @@ |
370463
52
23
648
207